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