Speed up printing when drawing opaque primitives.
We only need to merge the rectangles into a region if we are painting a non-opaque a primitive with alpha. Performance measurements QT_print_speed_bug.zip: Excluding patch: 244686 ms Including patch: 5070 ms This is an improvement of 48x (for debug build) Task-number: QTBUG-48334 Change-Id: I03684c6e7d8a5fb039ea6477ed1a860f09e1b08c Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
This commit is contained in:
parent
68ea2f7e9b
commit
d797a04adc
@ -376,6 +376,7 @@ QAlphaPaintEnginePrivate::QAlphaPaintEnginePrivate()
|
||||
m_pic(0),
|
||||
m_picengine(0),
|
||||
m_picpainter(0),
|
||||
m_numberOfCachedRects(0),
|
||||
m_hasalpha(false),
|
||||
m_alphaPen(false),
|
||||
m_alphaBrush(false),
|
||||
@ -426,7 +427,14 @@ void QAlphaPaintEnginePrivate::addAlphaRect(const QRectF &rect)
|
||||
|
||||
bool QAlphaPaintEnginePrivate::canSeeTroughBackground(bool somethingInRectHasAlpha, const QRectF &rect) const
|
||||
{
|
||||
return somethingInRectHasAlpha && m_dirtyrgn.intersects(rect.toAlignedRect());
|
||||
if (somethingInRectHasAlpha) {
|
||||
if (m_dirtyRects.count() != m_numberOfCachedRects) {
|
||||
m_cachedDirtyRgn.setRects(m_dirtyRects.constData(), m_dirtyRects.count());
|
||||
m_numberOfCachedRects = m_dirtyRects.count();
|
||||
}
|
||||
return m_cachedDirtyRgn.intersects(rect.toAlignedRect());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void QAlphaPaintEnginePrivate::drawAlphaImage(const QRectF &rect)
|
||||
|
@ -99,7 +99,9 @@ public:
|
||||
|
||||
QRegion m_alphargn;
|
||||
QRegion m_cliprgn;
|
||||
QRegion m_dirtyrgn;
|
||||
mutable QRegion m_cachedDirtyRgn;
|
||||
mutable int m_numberOfCachedRects;
|
||||
QVector<QRect> m_dirtyRects;
|
||||
|
||||
bool m_hasalpha;
|
||||
bool m_alphaPen;
|
||||
@ -115,7 +117,7 @@ public:
|
||||
QPen m_pen;
|
||||
|
||||
void addAlphaRect(const QRectF &rect);
|
||||
void addDirtyRect(const QRectF &rect) { m_dirtyrgn |= rect.toAlignedRect(); }
|
||||
void addDirtyRect(const QRectF &rect) { m_dirtyRects.append(rect.toAlignedRect()); }
|
||||
bool canSeeTroughBackground(bool somethingInRectHasAlpha, const QRectF &rect) const;
|
||||
|
||||
QRectF addPenWidth(const QPainterPath &path);
|
||||
|
Loading…
Reference in New Issue
Block a user