示例#1
0
static void handleViewResized(void *self, WMNotification * notification)
{
	WMSplitView *sPtr = (WMSplitView *) self;

#if 0
	printf("---- (handleViewResized - 1) ----\n");
	dumpSubviews(sPtr);
#endif

	updateConstraints(sPtr);
	checkSizes(sPtr);

	if (sPtr->constrainProc || sPtr->flags.subviewsWereManuallyMoved) {
		distributeOffsetFormEnd(sPtr, _GetSplitViewSize() - getTotalSize(sPtr));
		checkPositions(sPtr);
		updateSubviewsGeom(sPtr);
	} else
		adjustSplitViewSubviews(sPtr);

	assert(checkSizes(sPtr) == 0);

#if 0
	printf("---- (handleViewResized - 2) ----\n");
	dumpSubviews(sPtr);
#endif
}
示例#2
0
//LCOV_EXCL_START :
void NAType::print(FILE* ofd, const char* indent)
{
#ifdef TRACING_ENABLED  // NT_PORT ( bd 8/4/96 )
  fprintf(ofd,"%s nominal size %d, total %d\n",
          indent,getNominalSize(),getTotalSize());
#endif
}
    int writePendingData()
    {
        const int numToDo = getTotalSize() / 4;

        int start1, size1, start2, size2;
        prepareToRead (numToDo, start1, size1, start2, size2);

        if (size1 <= 0)
            return 10;

        writer->writeFromAudioSampleBuffer (buffer, start1, size1);

        const ScopedLock sl (thumbnailLock);
        if (receiver != nullptr)
            receiver->addBlock (samplesWritten, buffer, start1, size1);

        samplesWritten += size1;

        if (size2 > 0)
        {
            writer->writeFromAudioSampleBuffer (buffer, start2, size2);

            if (receiver != nullptr)
                receiver->addBlock (samplesWritten, buffer, start2, size2);

            samplesWritten += size2;
        }

        finishedRead (size1 + size2);
        return 0;
    }
示例#4
0
void Filter::OnHdnEndtrackList1(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMHEADER phdr = reinterpret_cast<LPNMHEADER>(pNMHDR);
	int tot = getTotalSize();
	tot -= listctrl->GetColumnWidth(phdr->iItem);
	tot += phdr->pitem->cxy;
	int diff = phdr->pitem->cxy - listctrl->GetColumnWidth(phdr->iItem);
	if(phdr->iItem == 3){
		phdr->pitem->cxy = listctrl->GetColumnWidth(phdr->iItem);
	}else if(diff > 0){
		if(listctrl->GetColumnWidth(phdr->iItem+1)-diff<10){
			phdr->pitem->cxy = listctrl->GetColumnWidth(phdr->iItem);
		}else{
			listctrl->SetColumnWidth(phdr->iItem+1,listctrl->GetColumnWidth(phdr->iItem+1)-diff);
		}
	}else{
		int resize = diff * -1;
		if(listctrl->GetColumnWidth(phdr->iItem)-resize<10){
			phdr->pitem->cxy = listctrl->GetColumnWidth(phdr->iItem);
		}else{
			listctrl->SetColumnWidth(phdr->iItem+1,listctrl->GetColumnWidth(phdr->iItem+1)+resize);
		}
	}
	savePropersize(phdr->iItem,phdr->pitem->cxy);
	fixSizing();
	*pResult = 0;
}
示例#5
0
	Size FlowLayout::getSizeWith(const Size&,size_func) const {
		if(_ctrls.size() == 0)
			return Size();
		Size size = _sameSize ? getMaxSize() : getTotalSize();
		if(_orientation == HORIZONTAL)
			return Size(size.width * _ctrls.size() + _gap * (_ctrls.size() - 1),size.height);
		return Size(size.width,size.height * _ctrls.size() + _gap * (_ctrls.size() - 1));
	}
示例#6
0
void CloneThread::run()
{
    QStringList files;
    QStringList absoluteSourceFiles;
    QStringList absoluteDestinationFiles;
    quint64     totalSize;

    // Searching
    {
        emit OnProgressChanged(tr("Searching..."), 0, 0);

        if (!getFiles(files))
        {
            return;
        }

        if (!getAbsolutePaths(files, absoluteSourceFiles, absoluteDestinationFiles))
        {
            return;
        }

        printLists(files, absoluteSourceFiles, absoluteDestinationFiles);
    }

    // Calculating
    {
        emit OnProgressChanged(tr("Calculating..."), 0, 0);

        totalSize = getTotalSize(absoluteSourceFiles);

        if (mTerminated)
        {
            return;
        }

        qDebug() << "Total size: " << totalSize;
    }

    // Deleting
    {
        emit OnProgressChanged(tr("Deleting old folder..."), 0, 0);

        if (!deleteFolder(mDestinationPath))
        {
            return;
        }
    }

    // Cloning
    {
        if (!cloneFiles(absoluteSourceFiles, absoluteDestinationFiles, totalSize))
        {
            return;
        }
    }
}
示例#7
0
void HDRImage3c::rfftplanUpdate ()
{
	uint2 total = getTotalSize()-uint2(0,2);
	m_rfftplanR = fftwf_plan_dft_c2r_2d (total.y, total.x, 
			m_red, m_hdriRFFT->getRedBuffer(), FFTW_MEASURE);
	m_rfftplanG = fftwf_plan_dft_c2r_2d (total.y, total.x, 
			m_green, m_hdriRFFT->getGreenBuffer(), FFTW_MEASURE);
	m_rfftplanB = fftwf_plan_dft_c2r_2d (total.y, total.x, 
			m_blue, m_hdriRFFT->getBlueBuffer(), FFTW_MEASURE);
}
示例#8
0
seec::Maybe<MemoryArea>
FunctionState::getContainingMemoryArea(stateptr_ty Address) const {
  auto const Alloca = getAllocaContaining(Address);
  if (Alloca)
    return MemoryArea(Alloca->getAddress(), Alloca->getTotalSize());
  
  for (auto const &ParamByVal : ParamByVals)
    if (ParamByVal.getArea().contains(Address))
      return ParamByVal.getArea();
  
  return seec::Maybe<MemoryArea>();
}
示例#9
0
bool DisassemblyMacro::disassemble(u32 address, DisassemblyLineInfo& dest, bool insertSymbols)
{
	char buffer[64];
	dest.type = DISTYPE_MACRO;
	dest.info = MIPSAnalyst::GetOpcodeInfo(DisassemblyManager::getCpu(),address);

	std::string addressSymbol;
	switch (type)
	{
	case MACRO_LI:
		dest.name = name;
		
		addressSymbol = symbolMap.GetLabelString(immediate);
		if (!addressSymbol.empty() && insertSymbols)
		{
			sprintf(buffer,"%s,%s",DisassemblyManager::getCpu()->GetRegName(0,rt),addressSymbol.c_str());
		} else {
			sprintf(buffer,"%s,0x%08X",DisassemblyManager::getCpu()->GetRegName(0,rt),immediate);
		}

		dest.params = buffer;
		
		dest.info.hasRelevantAddress = true;
		dest.info.releventAddress = immediate;
		break;
	case MACRO_MEMORYIMM:
		dest.name = name;

		addressSymbol = symbolMap.GetLabelString(immediate);
		if (!addressSymbol.empty() && insertSymbols)
		{
			sprintf(buffer,"%s,%s",DisassemblyManager::getCpu()->GetRegName(0,rt),addressSymbol.c_str());
		} else {
			sprintf(buffer,"%s,0x%08X",DisassemblyManager::getCpu()->GetRegName(0,rt),immediate);
		}

		dest.params = buffer;

		dest.info.isDataAccess = true;
		dest.info.dataAddress = immediate;
		dest.info.dataSize = dataSize;

		dest.info.hasRelevantAddress = true;
		dest.info.releventAddress = immediate;
		break;
	default:
		return false;
	}

	dest.totalSize = getTotalSize();
	return true;
}
示例#10
0
void QEnhancedTableView::paint(QPainter &painter, QRect pageRec)
{
    painter.save();
    painter.translate(pageRec.topLeft());
    QSizeF size=getTotalSize();
    double vhw=verticalHeader()->width()+8;
    double hhh=horizontalHeader()->height()+8;
    double scaleX=size.width()/double(pageRec.width());
    double scaleY=size.height()/double(pageRec.height());
    double scale=qMin(scaleX, scaleY);
    QList<int>pageCols, pageRows;
    pageCols<<0<<model()->columnCount();
    pageRows<<0<<model()->rowCount();
    paint(painter, scale, -1, hhh, vhw, pageCols, pageRows);
    painter.restore();
}
示例#11
0
	bool FlowLayout::rearrange() {
		if(!_p || _ctrls.size() == 0)
			return false;

		bool res = false;
		gsize_t pad = _p->getTheme().getPadding();
		Size size = _p->getSize() - Size(pad * 2,pad * 2);
		Size all = _sameSize ? getMaxSize() : getTotalSize();
		Pos pos(pad,pad);

		if(_orientation == VERTICAL) {
			swap(size.width,size.height);
			swap(all.width,all.height);
		}

		gsize_t totalWidth = all.width * _ctrls.size() + _gap * (_ctrls.size() - 1);
		pos.y = size.height / 2 - all.height / 2;
		switch(_align) {
			case FRONT:
				break;
			case CENTER:
				pos.x = (size.width / 2) - (totalWidth / 2);
				break;
			case BACK:
				pos.x = pad + size.width - totalWidth;
				break;
		}

		if(_orientation == VERTICAL) {
			swap(pos.x,pos.y);
			swap(all.width,all.height);
		}

		for(auto it = _ctrls.begin(); it != _ctrls.end(); ++it) {
			Size csize = _sameSize ? all : (*it)->getPreferredSize();
			res |= configureControl(*it,pos,csize);
			if(_orientation == VERTICAL)
				pos.y += csize.height + _gap;
			else
				pos.x += csize.width + _gap;
		}
		return res;
	}
示例#12
0
 std::string UniformBlock::dumpFloats() const
 {
     std::ostringstream os;
     const float* ptr = (const float*) mUniformData;
     int n = 16;
     int offset = 0;
     int totalsize = getTotalSize() / sizeof(float);
     while (offset < totalsize)
     {
         os << *ptr++ << " ";
         offset++;
         if (--n <= 0)
         {
             os << std::endl;
             n = 16;
         }
     }
     os << std::endl;
     return os.str();
 }
示例#13
0
boost::shared_ptr<HDRImage3f> HDRImage3c::computeRFFT ()
{
	if (! m_hdriRFFT.get())
		m_hdriRFFT = boost::shared_ptr<HDRImage3f> (new HDRImage3f);
	uint2 size = (getSize()-uint2(0,1))*uint2(1,2);
	uint2 append = (getTotalSize()-uint2(0,1))*uint2(1,2)-size;
	if (size != m_hdriRFFT->getSize() || append != m_hdriRFFT->getAppendSize())
		m_hdriRFFT->setSize (size, append);
	if (m_rfftplanNeedUpdate)
	{
		rfftplanUpdate ();			
		m_rfftplanNeedUpdate = false;
	}

	m_hdriRFFT->setMult (getMult()/m_hdriRFFT->getTotalSize().getArea());

	fftwf_execute (m_rfftplanR);
	fftwf_execute (m_rfftplanG);
	fftwf_execute (m_rfftplanB);
	return m_hdriRFFT;
}
示例#14
0
Int64 HHDFSStatsBase::getEstimatedRowCount() const
{
   return  ( getTotalSize() / getEstimatedRecordLength() );
}
示例#15
0
MemoryStateRegion AllocaState::getMemoryRegion() const {
  auto &Thread = Parent->getParent();
  auto &Process = Thread.getParent();
  auto &Memory = Process.getMemory();
  return Memory.getRegion(MemoryArea(Address, getTotalSize()));
}
示例#16
0
int main(int argc, const char * argv[]) {
    int exit = 0;
    char input;
    while (!exit) {
        
        printf("Welcome to MemTest!\n\n");
        printf("1. Allocate Memory\n");
        printf("2. Free Memory\n");
        printf("3. Exit\n\n");
        
        input = getchar();
        
        if (input == '1') {
            int size = 0;
            printf("Enter the size you would like to allocate: ");
            scanf("%d", &size);
            getchar();
            if ((size + getTotalSize()) > MAXMEMORY) {
                printf("Not enough space for %d bytes!\n", size);
            } else {
                segment_t* segment;
                segment = mem_alloc(size);
                if (!segment) {
                    printf("Memory could not be allocated!\n");
                } else {
                    printf("A segment of %d bytes has been allocated at %d\n", segment->size, segment);
                }
            }
        }
        
        if (input == '2') {
            segment_t* next;
            int count = 0;
            int indexInput;
            if (!getBase()) {
                printf("You must allocate before you can free!\n");
                getchar();
            } else {
                printf("Here is a list of segment pointers:\n\n");
                next = getBase();
                while (next) {
                    count++;
                    char* allocated;
                    if (next->status == ALLOCATED) {
                        allocated = "Allocated";
                    } else {
                        allocated = "Free";
                    }
                    printf("%d. %d | %d Bytes | %s\n", count, next, next->size, allocated);
                    next = next->next;
                }
                printf("\nType the index for the pointer you wish to free: ");
                scanf("%d", &indexInput);
                getchar();
                count = 1;
                next = getBase();
                while (next) {
                    if (count == indexInput) {
                        mem_free(next);
                        break;
                    } else {
                        count++;
                        next = next->next;
                    }
                }
                if (count == indexInput && next) {
                    printf("Segment \"%d\" has been freed! %d bytes are freed!\n", next, next->size);
                } else {
                    printf("That segment was not found!\n");
                }
            }
        }
        
        if (input == '3') {
            if (getBase()) {
                segment_t* next = getBase();
                while (next) {
                    mem_free(next);
                    next = next->next;
                }
            }
            exit = 1;
        }
        
    }
    return 0;
}
示例#17
0
status_t TiffWriter::write(Output* out, StripSource** sources, size_t sourcesCount,
        Endianness end) {
    status_t ret = OK;
    EndianOutput endOut(out, end);

    if (mIfd == NULL) {
        ALOGE("%s: Tiff header is empty.", __FUNCTION__);
        return BAD_VALUE;
    }

    uint32_t totalSize = getTotalSize();

    KeyedVector<uint32_t, uint32_t> offsetVector;

    for (size_t i = 0; i < mNamedIfds.size(); ++i) {
        if (mNamedIfds[i]->uninitializedOffsets()) {
            uint32_t stripSize = mNamedIfds[i]->getStripSize();
            if (mNamedIfds[i]->setStripOffset(totalSize) != OK) {
                ALOGE("%s: Could not set strip offsets.", __FUNCTION__);
                return BAD_VALUE;
            }
            totalSize += stripSize;
            WORD_ALIGN(totalSize);
            offsetVector.add(mNamedIfds.keyAt(i), totalSize);
        }
    }

    size_t offVecSize = offsetVector.size();
    if (offVecSize != sourcesCount) {
        ALOGE("%s: Mismatch between number of IFDs with uninitialized strips (%zu) and"
                " sources (%zu).", __FUNCTION__, offVecSize, sourcesCount);
        return BAD_VALUE;
    }

    BAIL_ON_FAIL(writeFileHeader(endOut), ret);

    uint32_t offset = FILE_HEADER_SIZE;
    sp<TiffIfd> ifd = mIfd;
    while(ifd != NULL) {
        BAIL_ON_FAIL(ifd->writeData(offset, &endOut), ret);
        offset += ifd->getSize();
        ifd = ifd->getNextIfd();
    }

    if (LOG_NDEBUG == 0) {
        log();
    }

    for (size_t i = 0; i < offVecSize; ++i) {
        uint32_t ifdKey = offsetVector.keyAt(i);
        uint32_t sizeToWrite = mNamedIfds[ifdKey]->getStripSize();
        bool found = false;
        for (size_t j = 0; j < sourcesCount; ++j) {
            if (sources[j]->getIfd() == ifdKey) {
                if ((ret = sources[i]->writeToStream(endOut, sizeToWrite)) != OK) {
                    ALOGE("%s: Could not write to stream, received %d.", __FUNCTION__, ret);
                    return ret;
                }
                ZERO_TILL_WORD(&endOut, sizeToWrite, ret);
                found = true;
                break;
            }
        }
        if (!found) {
            ALOGE("%s: No stream for byte strips for IFD %u", __FUNCTION__, ifdKey);
            return BAD_VALUE;
        }
        assert(offsetVector[i] == endOut.getCurrentOffset());
    }

    return ret;
}
示例#18
0
static void dragDivider(WMSplitView * sPtr, int clickX, int clickY)
{
	int divider, pos, ofs, done, dragging;
	int i, count;
	XEvent ev;
	WMScreen *scr;
	int minCoord, maxCoord, coord;

	if (sPtr->constrainProc) {
		updateConstraints(sPtr);
		checkSizes(sPtr);
		distributeOffsetFormEnd(sPtr, _GetSplitViewSize() - getTotalSize(sPtr));
		checkPositions(sPtr);
		updateSubviewsGeom(sPtr);
	}

	scr = sPtr->view->screen;
	divider = ofs = pos = done = 0;
	coord = (sPtr->flags.vertical) ? clickX : clickY;
	count = _GetSubviewsCount();
	if (count < 2)
		return;

	for (i = 0; i < count - 1; i++) {
		pos += _GetSizeAt(i) + DIVIDER_THICKNESS;
		if (coord < pos) {
			ofs = coord - pos + DIVIDER_THICKNESS;
			done = 1;
			break;
		}
		divider++;
	}

	if (!done)
		return;

	getMinMaxDividerCoord(sPtr, divider, &minCoord, &maxCoord);

	done = 0;
	dragging = 0;
	while (!done) {
		WMMaskEvent(scr->display, ButtonMotionMask | ButtonReleaseMask | ExposureMask, &ev);

		coord = (sPtr->flags.vertical) ? ev.xmotion.x : ev.xmotion.y;

		switch (ev.type) {
		case ButtonRelease:
			done = 1;
			if (dragging)
				drawDragingRectangle(sPtr, pos);
			break;

		case MotionNotify:
			if (dragging)
				drawDragingRectangle(sPtr, pos);
			if (coord - ofs < minCoord)
				pos = minCoord;
			else if (coord - ofs > maxCoord)
				pos = maxCoord;
			else
				pos = coord - ofs;
			drawDragingRectangle(sPtr, pos);
			dragging = 1;
			break;

		default:
			WMHandleEvent(&ev);
			break;
		}
	}

	if (dragging) {
		W_SplitViewSubview *p1, *p2;
		int totSize;

		p1 = _GetPSubviewStructAt(divider);
		p2 = _GetPSubviewStructAt(divider + 1);

		totSize = p1->size + DIVIDER_THICKNESS + p2->size;

		p1->size = pos - p1->pos;
		p2->size = totSize - p1->size - DIVIDER_THICKNESS;
		p2->pos = p1->pos + p1->size + DIVIDER_THICKNESS;

		resizeView(sPtr, p1->view, p1->size);
		moveView(sPtr, p2->view, p2->pos);
		resizeView(sPtr, p2->view, p2->size);
		sPtr->flags.subviewsWereManuallyMoved = 1;
	}
}