code simplified

This commit is contained in:
Uwe Rathmann 2018-01-03 17:23:40 +01:00
parent ed9433c229
commit 184157a025
2 changed files with 16 additions and 20 deletions

View File

@ -44,30 +44,27 @@ void QskTextNode::setTextData( const QQuickItem* item,
const QskTextOptions& options, const QskTextColors& colors, const QskTextOptions& options, const QskTextColors& colors,
Qt::Alignment alignment, Qsk::TextStyle textStyle ) Qt::Alignment alignment, Qsk::TextStyle textStyle )
{ {
if ( m_rect != rect ) QMatrix4x4 matrix;
{ matrix.translate( rect.left(), rect.top() );
QMatrix4x4 matrix;
matrix.translate( rect.left(), rect.top() );
if ( matrix != this->matrix() ) // avoid setting DirtyMatrix accidently if ( matrix != this->matrix() ) // avoid setting DirtyMatrix accidently
setMatrix( matrix ); setMatrix( matrix );
}
const uint hash = qskHash( text, rect.size(), font, const uint hash = qskHash( text, rect.size(), font,
options, colors, alignment, textStyle ); options, colors, alignment, textStyle );
if ( hash == m_hash ) if ( hash != m_hash )
return; {
m_hash = hash;
m_hash = hash; const QRectF textRect( 0, 0, rect.width(), rect.height() );
const QRectF textRect( 0, 0, rect.width(), rect.height() ); /*
In case of having color changes only we would could
/* go a faster update path: see QskPlainTextRenderer::updateNodeColor.
In case of having color changes only we would could TODO ...
go a faster update path: see QskPlainTextRenderer::updateNodeColor. */
TODO ... QskTextRenderer::updateNode( text, font, options, textStyle,
*/ colors, alignment, textRect, item, this );
QskTextRenderer::updateNode( text, font, options, textStyle, }
colors, alignment, textRect, item, this );
} }

View File

@ -30,7 +30,6 @@ public:
Qt::Alignment, Qsk::TextStyle ); Qt::Alignment, Qsk::TextStyle );
private: private:
QRectF m_rect;
uint m_hash; uint m_hash;
}; };