don't recreate textures when the target size for non scalable graphics
has changed
This commit is contained in:
parent
c375989dc5
commit
6dc7fcd6c9
@ -51,12 +51,23 @@ void QskGraphicNode::setGraphic(
|
||||
{
|
||||
bool isTextureDirty = ( QskTextureNode::textureId() == 0 );
|
||||
|
||||
QSize textureSize;
|
||||
|
||||
if ( graphic.isScalable() )
|
||||
{
|
||||
textureSize = rect.size().toSize();
|
||||
|
||||
if ( !isTextureDirty )
|
||||
{
|
||||
const auto oldRect = QskTextureNode::rect();
|
||||
isTextureDirty = ( rect.width() != static_cast< int >( oldRect.width() ) ) ||
|
||||
( rect.height() != static_cast< int >( oldRect.height() ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
textureSize = graphic.defaultSize().toSize();
|
||||
}
|
||||
|
||||
QskTextureNode::setRect( rect );
|
||||
|
||||
@ -70,7 +81,7 @@ void QskGraphicNode::setGraphic(
|
||||
if ( isTextureDirty )
|
||||
{
|
||||
const uint textureId = QskTextureRenderer::createTextureFromGraphic(
|
||||
renderMode, rect.size().toSize(), graphic, colorFilter, Qt::IgnoreAspectRatio );
|
||||
renderMode, textureSize, graphic, colorFilter, Qt::IgnoreAspectRatio );
|
||||
|
||||
QskTextureNode::setTextureId( textureId );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user