本文整理汇总了C++中calculateSize函数的典型用法代码示例。如果您正苦于以下问题:C++ calculateSize函数的具体用法?C++ calculateSize怎么用?C++ calculateSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了calculateSize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: calculateSize
void UIFont::setText(const char* text)
{
m_Text.assign(text);
//Calculate the text's size based on the font data
calculateSize();
}
开发者ID:delu0009,项目名称:Assignment-3-master,代码行数:7,代码来源:UIFont.cpp
示例2: return
int PacketHandler::calculateCryptedSize(int dataLen)
{
int align = dataLen % 8;
if (align)
dataLen = dataLen + 8 - align;
return (calculateSize(dataLen));
}
开发者ID:mapleelpam,项目名称:DRTA,代码行数:7,代码来源:PacketHandler.cpp
示例3: calculateSize
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);
}
}
开发者ID:duketheluke,项目名称:ewol,代码行数:7,代码来源:Container.cpp
示例4: addToFront
void CTECList<Type>:: addToFront(const Type& value)
{
ArrayNode<Type> * newNode = new ArrayNode<Type>(value, head);
head = newNode;
calculateSize();
}
开发者ID:billykonesavanh17,项目名称:NodeProject,代码行数:7,代码来源:CTECList.cpp
示例5: freeMemory
//-----------------------------------------------------------------------------
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;
}
开发者ID:ballisticwhisper,项目名称:ogre,代码行数:35,代码来源:OgreImage.cpp
示例6: assert
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;
}
开发者ID:lance1313,项目名称:NodeProject,代码行数:35,代码来源:CTECList.cpp
示例7: QPainterPath
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 );
}
}
开发者ID:asneuvon,项目名称:QGIS,代码行数:29,代码来源:qgsellipsesymbollayerv2.cpp
示例8: 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();
}
}
}
开发者ID:monisha4,项目名称:kstars-hackfest,代码行数:32,代码来源:legend.cpp
示例9: OgreGuard
//-----------------------------------------------------------------------------
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 );
}
开发者ID:brock7,项目名称:TianLong,代码行数:26,代码来源:OgreImage.cpp
示例10: assert
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;
}
开发者ID:Sydothekido11,项目名称:NodeProject,代码行数:34,代码来源:CTECList.cpp
示例11: calculateSize
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;
}
开发者ID:MCMrARM,项目名称:mcpe-json-editor,代码行数:8,代码来源:MinecraftGUIComponent.cpp
示例12: calculateSize
/**
* 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);
}
开发者ID:RomanSchwienbacher,项目名称:DBI,代码行数:15,代码来源:segment.cpp
示例13: calculateSize
MeshObject::MeshObject(const String& name, const String& meshname)
{
if (meshname.length() > 0)
{
mMovableObject = CoreSubsystem::getSingletonPtr()->getWorld()
->getSceneManager()->createEntity(name, meshname);
calculateSize();
}
}
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:9,代码来源:MeshObject.cpp
示例14: 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;
}
开发者ID:CS-SI,项目名称:QGIS,代码行数:57,代码来源:qgsellipsesymbollayer.cpp
示例15: addToEnd
void CTECList<Type>:: addToEnd(const Type& value)
{
ArrayNode<Type> * newNode = new ArrayNode<Type>(value);
end -> setNext(newNode);
end = newNode;
calculateSize();
}
开发者ID:billykonesavanh17,项目名称:NodeProject,代码行数:9,代码来源:CTECList.cpp
示例16:
Type CTECList<Type>::removeFromEnd()
{
//Loop over size
Type valueToRemove;
this>calculateSize();
return valueToRemove;
}
开发者ID:taurrem,项目名称:NodeProject,代码行数:9,代码来源:CTECList.cpp
示例17: QPainterPath
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 );
}
}
开发者ID:CS-SI,项目名称:QGIS,代码行数:56,代码来源:qgsellipsesymbollayer.cpp
示例18: Matrix
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
) {}
开发者ID:psobczyk,项目名称:admixedMOSGWA,代码行数:10,代码来源:AutoMatrix.cpp
示例19: calculateSize
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;
}
开发者ID:psobczyk,项目名称:admixedMOSGWA,代码行数:43,代码来源:AutoMatrix.cpp
示例20: calculateSize
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);
}
开发者ID:euroelessar,项目名称:FBReader,代码行数:10,代码来源:W32StandaloneDialogPanel.cpp
注:本文中的calculateSize函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论