diff options
author | Jan Arve Saether <jan-arve.saether@theqtcompany.com> | 2015-09-22 13:36:22 +0200 |
---|---|---|
committer | Jan Arve Sæther <jan-arve.saether@theqtcompany.com> | 2015-09-23 16:38:07 +0000 |
commit | d797a04adc5a76146ecff36e17b2a8658b0a5022 (patch) | |
tree | 311a28528602324bfd7bffe820b83148a636a236 /src/printsupport/kernel/qpaintengine_alpha_p.h | |
parent | 68ea2f7e9bb2d4ea6182101521325dbfd9b74abb (diff) |
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>
Diffstat (limited to 'src/printsupport/kernel/qpaintengine_alpha_p.h')
-rw-r--r-- | src/printsupport/kernel/qpaintengine_alpha_p.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/printsupport/kernel/qpaintengine_alpha_p.h b/src/printsupport/kernel/qpaintengine_alpha_p.h index 2becad7379..49a9938e56 100644 --- a/src/printsupport/kernel/qpaintengine_alpha_p.h +++ b/src/printsupport/kernel/qpaintengine_alpha_p.h @@ -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); |