From ed9433c2296cecc1f5660b80d04d5ae609b8464a Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 3 Jan 2018 15:44:40 +0100 Subject: [PATCH] no reason for recreating a texture, when it is only translated --- src/nodes/QskGraphicNode.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/nodes/QskGraphicNode.cpp b/src/nodes/QskGraphicNode.cpp index 7563728c..19657f0e 100644 --- a/src/nodes/QskGraphicNode.cpp +++ b/src/nodes/QskGraphicNode.cpp @@ -42,7 +42,14 @@ void QskGraphicNode::setGraphic( const QskGraphic& graphic, const QskColorFilter& colorFilter, QskGraphicTextureFactory::RenderMode renderMode, const QRect& rect ) { - bool isDirty = rect != QskTextureNode::rect(); + bool isTextureDirty = ( QskTextureNode::textureId() == 0 ); + + if ( !isTextureDirty ) + { + const auto oldRect = QskTextureNode::rect(); + isTextureDirty = ( rect.width() != static_cast( oldRect.width() ) ) + || ( rect.height() != static_cast( oldRect.height() ) ); + } QskTextureNode::setRect( rect ); @@ -50,10 +57,10 @@ void QskGraphicNode::setGraphic( if ( hash != m_hash ) { m_hash = hash; - isDirty = true; + isTextureDirty = true; } - if ( isDirty ) + if ( isTextureDirty ) { const QRect textureRect( 0, 0, rect.width(), rect.height() );