void DepthModel::depthUpdateOrders(QList<DepthItem> *items) { if(items==0)return; for(int n=0;n<items->count();n++)depthUpdateOrder(items->at(n)); delete items; calculateSize(); }
void UIFont::setText(const char* text) { m_Text.assign(text); //Calculate the text's size based on the font data calculateSize(); }
int PacketHandler::calculateCryptedSize(int dataLen) { int align = dataLen % 8; if (align) dataLen = dataLen + 8 - align; return (calculateSize(dataLen)); }
void ewol::widget::Container::setOffset(const vec2& _newVal) { if (m_offset != _newVal) { ewol::Widget::setOffset(_newVal); // recalculate the new sise and position of sub widget ... calculateSize(m_size); } }
void CTECList<Type>:: addToFront(const Type& value) { ArrayNode<Type> * newNode = new ArrayNode<Type>(value, head); head = newNode; calculateSize(); }
//----------------------------------------------------------------------------- Image& Image::loadDynamicImage( uchar* pData, uint32 uWidth, uint32 uHeight, uint32 depth, PixelFormat eFormat, bool autoDelete, size_t numFaces, uint8 numMipMaps) { freeMemory(); // Set image metadata mWidth = uWidth; mHeight = uHeight; mDepth = depth; mFormat = eFormat; mPixelSize = static_cast<uchar>(PixelUtil::getNumElemBytes( mFormat )); mNumMipmaps = numMipMaps; mFlags = 0; // Set flags if (PixelUtil::isCompressed(eFormat)) mFlags |= IF_COMPRESSED; if (mDepth != 1) mFlags |= IF_3D_TEXTURE; if(numFaces == 6) mFlags |= IF_CUBEMAP; if(numFaces != 6 && numFaces != 1) OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "Number of faces currently must be 6 or 1.", "Image::loadDynamicImage"); mBufSize = calculateSize(numMipMaps, numFaces, uWidth, uHeight, depth, eFormat); mBuffer = pData; mAutoDelete = autoDelete; return *this; }
Type CTECList<Type>::removeFromEnd() { //defencive code assert(this->size > 0); Type returnValue; ArrayNode<Type> * newTail = new ArrayNode<Type>(); ArrayNode<Type> * current = ArrayNode<Type>(); if(size == 1) { ArrayNode<Type> * toRemove = tail; returnValue = removeFromFront(); tail = nullptr; } else { ArrayNode<Type> * current = head; for(int index = 0; index < size-1; index ++) { current = current->getNext(); } returnValue = tail->getValue(); delete tail; current = newTail; calculateSize(); current->setNext(nullptr); } return returnValue; }
void QgsEllipseSymbolLayerV2::preparePath( const QString& symbolName, QgsSymbolV2RenderContext& context, double* scaledWidth, double* scaledHeight, const QgsFeature* ) { mPainterPath = QPainterPath(); QSizeF size = calculateSize( context, scaledWidth, scaledHeight ); if ( symbolName == "circle" ) { mPainterPath.addEllipse( QRectF( -size.width() / 2.0, -size.height() / 2.0, size.width(), size.height() ) ); } else if ( symbolName == "rectangle" ) { mPainterPath.addRect( QRectF( -size.width() / 2.0, -size.height() / 2.0, size.width(), size.height() ) ); } else if ( symbolName == "cross" ) { mPainterPath.moveTo( 0, -size.height() / 2.0 ); mPainterPath.lineTo( 0, size.height() / 2.0 ); mPainterPath.moveTo( -size.width() / 2.0, 0 ); mPainterPath.lineTo( size.width() / 2.0, 0 ); } else if ( symbolName == "triangle" ) { mPainterPath.moveTo( 0, -size.height() / 2.0 ); mPainterPath.lineTo( -size.width() / 2.0, size.height() / 2.0 ); mPainterPath.lineTo( size.width() / 2.0, size.height() / 2.0 ); mPainterPath.lineTo( 0, -size.height() / 2.0 ); } }
Type CTECList<Type>::set(int index, const Type& value) { assert(this->size > 0); ArrayNode<Type> * previous = ArrayNode<Type>(); ArrayNode<Type> * insert = previous; ArrayNode<Type> * current = ArrayNode<Type>(); ArrayNode<Type> * newNode = ArrayNode<Type>(); if(index == 0) { current->addToFront(); } else if( index == size - 1) { current->addToEnd(); } else { for(index = 0;index < size -1;index++) { current = current->next; } current = head; return current->getValue(); calculateSize(); } }
QPoint Legend::positionToDeviceCoord(QPaintDevice *pd) { QSize legendSize = calculateSize(); switch(m_Position) { case LP_UPPER_LEFT: // position: upper left corner { return QPoint(0, 0); } case LP_UPPER_RIGHT: // position: upper right corner { return QPoint(pd->width() - legendSize.width(), 0); } case LP_LOWER_LEFT: // position: lower left corner { return QPoint(0, pd->height() - legendSize.height()); } case LP_LOWER_RIGHT: // position: lower right corner { return QPoint(pd->width() - legendSize.width(), pd->height() - legendSize.height()); } default: // legend is floating { return QPoint(); } } }
//----------------------------------------------------------------------------- Image & Image::loadRawData( DataStreamPtr& stream, size_t uWidth, size_t uHeight, size_t uDepth, PixelFormat eFormat, size_t numFaces, size_t numMipMaps) { OgreGuard( "Image::loadRawData" ); size_t size = calculateSize(numMipMaps, numFaces, uWidth, uHeight, uDepth, eFormat); if (size + stream->tell() != stream->size()) { OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "Stream size does not match calculated image size", "Image::loadRawData"); } uchar *buffer = new uchar[ size ]; stream->read(buffer, size); loadDynamicImage(buffer, uWidth, uHeight, uDepth, eFormat, true, numFaces, numMipMaps); OgreUnguardRet( *this ); }
Type CTECList<Type>::removeFromBack() { assert(size > 0); Type returnValue; if(size == 1) { ArrayNode<Type> * toRemove = end; returnValue = removeFromFront(); end = nullptr; head = nullptr; delete toRemove; } else { ArrayNode<Type> * current = head; for(int index = 0; index < size - 1; index++) { current = current->getNext(); } returnValue = end->getValue(); delete end; current = end; current->setNext(nullptr); } calculateSize(); return returnValue; }
Vec2 MCGUILayoutComponent::getPos(MCGUIContext *context) { Vec2 parentSize = context->getParentComponentSize(); Vec2 off = offset.get(context).get(parentSize); Vec2 size = calculateSize(context); Vec2 parentAnchorPos = MCGUIGetAnchorPoint(parentSize, anchorFrom.get(context)); Vec2 myAnchorPos = MCGUIGetAnchorPoint(size, anchorTo.get(context)); return parentAnchorPos - myAnchorPos + off; }
/** * Constructor for Regular segments * @param extents: extents used for the segment * @param segId: id of the segment * @param bm: buffer manager for writing to disk */ Segment::Segment(std::vector<uint64_t> extents, uint64_t segId, FSISegment * fsi, BufferManager * bm) { Segment::segId = segId; Segment::extents = extents; Segment::fsi = fsi; Segment::bm = bm; size = calculateSize(extents); //Segment::expandExtents(extents); }
MeshObject::MeshObject(const String& name, const String& meshname) { if (meshname.length() > 0) { mMovableObject = CoreSubsystem::getSingletonPtr()->getWorld() ->getSceneManager()->createEntity(name, meshname); calculateSize(); } }
QRectF QgsEllipseSymbolLayer::bounds( QPointF point, QgsSymbolRenderContext &context ) { QSizeF size = calculateSize( context ); bool hasDataDefinedRotation = false; QPointF offset; double angle = 0; calculateOffsetAndRotation( context, size.width(), size.height(), hasDataDefinedRotation, offset, angle ); QMatrix transform; // move to the desired position transform.translate( point.x() + offset.x(), point.y() + offset.y() ); if ( !qgsDoubleNear( angle, 0.0 ) ) transform.rotate( angle ); double penWidth = 0.0; if ( mDataDefinedProperties.isActive( QgsSymbolLayer::PropertyStrokeWidth ) ) { context.setOriginalValueVariable( mStrokeWidth ); QVariant exprVal = mDataDefinedProperties.value( QgsSymbolLayer::PropertyStrokeWidth, context.renderContext().expressionContext() ); if ( exprVal.isValid() ) { bool ok; double strokeWidth = exprVal.toDouble( &ok ); if ( ok ) { penWidth = context.renderContext().convertToPainterUnits( strokeWidth, mStrokeWidthUnit, mStrokeWidthMapUnitScale ); } } } if ( mDataDefinedProperties.isActive( QgsSymbolLayer::PropertyStrokeStyle ) ) { context.setOriginalValueVariable( QgsSymbolLayerUtils::encodePenStyle( mStrokeStyle ) ); QVariant exprVal = mDataDefinedProperties.value( QgsSymbolLayer::PropertyStrokeStyle, context.renderContext().expressionContext() ); if ( exprVal.isValid() && exprVal.toString() == QLatin1String( "no" ) ) { penWidth = 0.0; } } //antialiasing, add 1 pixel penWidth += 1; QRectF symbolBounds = transform.mapRect( QRectF( -size.width() / 2.0, -size.height() / 2.0, size.width(), size.height() ) ); //extend bounds by pen width / 2.0 symbolBounds.adjust( -penWidth / 2.0, -penWidth / 2.0, penWidth / 2.0, penWidth / 2.0 ); return symbolBounds; }
void CTECList<Type>:: addToEnd(const Type& value) { ArrayNode<Type> * newNode = new ArrayNode<Type>(value); end -> setNext(newNode); end = newNode; calculateSize(); }
Type CTECList<Type>::removeFromEnd() { //Loop over size Type valueToRemove; this>calculateSize(); return valueToRemove; }
void QgsEllipseSymbolLayer::preparePath( const QString &symbolName, QgsSymbolRenderContext &context, double *scaledWidth, double *scaledHeight, const QgsFeature * ) { mPainterPath = QPainterPath(); QSizeF size = calculateSize( context, scaledWidth, scaledHeight ); if ( symbolName == QLatin1String( "circle" ) ) { mPainterPath.addEllipse( QRectF( -size.width() / 2.0, -size.height() / 2.0, size.width(), size.height() ) ); } else if ( symbolName == QLatin1String( "semi_circle" ) ) { mPainterPath.arcTo( -size.width() / 2.0, -size.height() / 2.0, size.width(), size.height(), 0, 180 ); mPainterPath.lineTo( 0, 0 ); } else if ( symbolName == QLatin1String( "rectangle" ) ) { mPainterPath.addRect( QRectF( -size.width() / 2.0, -size.height() / 2.0, size.width(), size.height() ) ); } else if ( symbolName == QLatin1String( "diamond" ) ) { mPainterPath.moveTo( -size.width() / 2.0, 0 ); mPainterPath.lineTo( 0, size.height() / 2.0 ); mPainterPath.lineTo( size.width() / 2.0, 0 ); mPainterPath.lineTo( 0, -size.height() / 2.0 ); mPainterPath.lineTo( -size.width() / 2.0, 0 ); } else if ( symbolName == QLatin1String( "cross" ) ) { mPainterPath.moveTo( 0, -size.height() / 2.0 ); mPainterPath.lineTo( 0, size.height() / 2.0 ); mPainterPath.moveTo( -size.width() / 2.0, 0 ); mPainterPath.lineTo( size.width() / 2.0, 0 ); } else if ( symbolName == QLatin1String( "triangle" ) ) { mPainterPath.moveTo( 0, -size.height() / 2.0 ); mPainterPath.lineTo( -size.width() / 2.0, size.height() / 2.0 ); mPainterPath.lineTo( size.width() / 2.0, size.height() / 2.0 ); mPainterPath.lineTo( 0, -size.height() / 2.0 ); } else if ( symbolName == QLatin1String( "left_half_triangle" ) ) { mPainterPath.moveTo( 0, size.height() / 2.0 ); mPainterPath.lineTo( size.width() / 2.0, size.height() / 2.0 ); mPainterPath.lineTo( 0, -size.height() / 2.0 ); mPainterPath.lineTo( 0, size.height() / 2.0 ); } else if ( symbolName == QLatin1String( "right_half_triangle" ) ) { mPainterPath.moveTo( -size.width() / 2.0, size.height() / 2.0 ); mPainterPath.lineTo( 0, size.height() / 2.0 ); mPainterPath.lineTo( 0, -size.height() / 2.0 ); mPainterPath.lineTo( -size.width() / 2.0, size.height() / 2.0 ); } }
AutoMatrix::AutoMatrix ( const size_t rows, const size_t cols ) : Matrix( rows, cols, // if not here, size would be initialised after parent class portion static_cast<double*>( malloc( size = calculateSize( rows, cols ) ) ), cols ) {}
AutoMatrix& AutoMatrix::operator= ( const AutoMatrix& original ) { if ( this != &original ) { const size_t rows = original.countRows(), cols = original.countColumns(); const size_t used = calculateSize( rows, cols ); double* newArray; if ( used <= size ) { newArray = matrix.data; } else { newArray = static_cast<double*>( malloc( used ) ); if ( NULL == newArray ) { throw bad_alloc(); } free( matrix.data ); matrix.data = newArray; size = used; } gslInit( rows, cols, newArray, calculateSize( rows, original.matrix.tda ) <= size ? original.matrix.tda : cols // try to copy tda ); // the following copy is like in the copy constructor if ( cols == original.matrix.tda ) { // copy one big lump memcpy( matrix.data, original.matrix.data, used ); } else { // copy row by row const size_t blockSize = cols * sizeof( double ); const double *source = original.matrix.data; double *target = matrix.data; for ( size_t row = 0; row < rows; ++row ) { memcpy( target, source, blockSize ); source += original.matrix.tda; target += matrix.tda; } } } return *this; }
bool W32StandaloneDialogPanel::runDialog(short width, short height) { if ((width > 0) && (height > 0)) { calculateSize(); W32Widget::Size size = minimumSize(); size.Width = std::max(size.Width, width); size.Height = std::max(size.Height, height); setSize(size); } return DialogBoxIndirectParam(GetModuleHandle(0), dialogTemplate(), myMainWindow, StaticCallback, (LPARAM)this); }
void tBlob::calculateMidpnt() { calculateSize(); double mx = _min.x() + _max.x(); uint32_t xmid = roundToInt( mx / 2.0 ); double my = ( _min.y() + _max.y() ); uint32_t ymid = roundToInt( my / 2.0 ); _midpoint = int32_xy( xmid, ymid ); }
QRectF QgsEllipseSymbolLayerV2::bounds( QPointF point, QgsSymbolV2RenderContext& context ) { QSizeF size = calculateSize( context ); bool hasDataDefinedRotation = false; QPointF offset; double angle = 0; calculateOffsetAndRotation( context, size.width(), size.height(), hasDataDefinedRotation, offset, angle ); double pixelSize = 1.0 / context.renderContext().rasterScaleFactor(); QMatrix transform; // move to the desired position transform.translate( point.x() + offset.x(), point.y() + offset.y() ); if ( !qgsDoubleNear( angle, 0.0 ) ) transform.rotate( angle ); double penWidth = 0.0; bool ok = true; if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH ) ) { context.setOriginalValueVariable( mOutlineWidth ); double outlineWidth = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH, context, QVariant(), &ok ).toDouble(); if ( ok ) { penWidth = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), outlineWidth, mOutlineWidthUnit, mOutlineWidthMapUnitScale ); } } if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_STYLE ) ) { context.setOriginalValueVariable( QgsSymbolLayerV2Utils::encodePenStyle( mOutlineStyle ) ); QString outlineStyle = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_STYLE, context, QVariant(), &ok ).toString(); if ( ok && outlineStyle == "no" ) { penWidth = 0.0; } } //antialiasing penWidth += pixelSize; QRectF symbolBounds = transform.mapRect( QRectF( -size.width() / 2.0, -size.height() / 2.0, size.width(), size.height() ) ); //extend bounds by pen width / 2.0 symbolBounds.adjust( -penWidth / 2.0, -penWidth / 2.0, penWidth / 2.0, penWidth / 2.0 ); return symbolBounds; }
std::vector<uint64_t> Segment::grow(uint64_t addedSpace) { std::vector<uint64_t> addExtents; addExtents = fsi->getFreeExtents(addedSpace); extents = mergeExtents(extents, addExtents); size = calculateSize(extents); return addExtents; }
void CTECList<Type>::addToEnd(const Type& value) { ArrayNode<Type> * newTail; ArrayNode<Type> * current; tail= newTail; current->setValue(value); current->setNext(tail); tail = current; calculateSize(); }
//------------------------------------------------------------------------ /// <TODO: insert function description here> /// @return bool <TODO: insert return value description here> bool TerrainCollisionShape::_rebuildFromCachedData() { //assert(mVertexBuf && mFaceBuf); Opcode::OPCODECREATE opcc; _prepareOpcodeCreateParams(opcc); opcModel.Build(opcc); calculateSize(); return true; }
spRequest RequestBuffer::buildAndRemoveRequest() { spRequest request = spRequest(new Request); if (size == 0 || bytes.size() < sizeof(size)) { log(LOG_ERROR, "buildAndRemoveRequest called with invalid request size."); return request; } std::string reqStr(bytes.begin() + sizeof(size), bytes.begin() + sizeof(size) + size); bytes.erase(bytes.begin(), bytes.begin() + sizeof(size) + size); request->ParseFromString(reqStr); calculateSize(); return request; }
inline bool Malloc::findStartCluster(unsigned long &size, signed long &table, unsigned char &bit) { unsigned long loop = calculateSize(clusterSize); if(!size) return false; unsigned long index, cmp, defualt, sub; if(size <= 32) { defualt = 0xffffffff >> (32 - size); }
inline signed long Malloc::findValidTable(void) { signed long i; signed long loop = calculateSize(mallocSize); for(i=0;i<loop;i++) { if(!addrTable[i].addr) { return i; } } return -1; }