diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-06-24 19:50:30 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2013-11-05 11:18:12 +0100 |
commit | da6b080707139f49c1001d10093079d25753a27e (patch) | |
tree | a8936cdf1b713f20aa974fcc9fc4946d568b8200 /svx | |
parent | b8ac8a830bac7f563b196925255a09befa61fc09 (diff) |
fdo#58029: replace quadratic child window loop with linear
... which should speed things up without introducing problems.
(Window::GetChild(n) is inefficient because the children are a linked
list)
Change-Id: I343d51a6866c5014cbca4c256b0c15f938958c39
(cherry picked from commit 38dcfadda85058a0ee87292c8943aec82e34b81e)
Reviewed-on: https://gerrit.libreoffice.org/4491
Reviewed-by: Thorsten Behrens <tbehrens@suse.com>
Tested-by: Thorsten Behrens <tbehrens@suse.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/svx/sdrpaintwindow.hxx | 6 | ||||
-rw-r--r-- | svx/source/sdr/overlay/overlaymanagerbuffered.cxx | 29 | ||||
-rw-r--r-- | svx/source/svdraw/sdrpaintwindow.cxx | 27 |
3 files changed, 40 insertions, 22 deletions
diff --git a/svx/inc/svx/sdrpaintwindow.hxx b/svx/inc/svx/sdrpaintwindow.hxx index fa2f6e99377d..1eed124e8c5f 100644 --- a/svx/inc/svx/sdrpaintwindow.hxx +++ b/svx/inc/svx/sdrpaintwindow.hxx @@ -41,6 +41,12 @@ namespace sdr #endif //////////////////////////////////////////////////////////////////////////////////////////////////// +/// paint the transparent children of rWin that overlap rPixelRect +/// (for example, transparent form controls like check boxes) +void SVX_DLLPUBLIC +PaintTransparentChildren(Window & rWindow, Rectangle const& rPixelRect); + + class SdrPreRenderDevice { // The original OutputDevice diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx index 64ac99d1f565..56159a28e157 100644 --- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx +++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx @@ -18,6 +18,7 @@ */ #include <svx/sdr/overlay/overlaymanagerbuffered.hxx> +#include <svx/sdrpaintwindow.hxx> #include <vcl/outdev.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/range/b2drange.hxx> @@ -349,28 +350,12 @@ namespace sdr { Window& rWindow = static_cast< Window& >(rmOutputDevice); - if(rWindow.IsChildTransparentModeEnabled() && rWindow.GetChildCount()) - { - const Rectangle aRegionRectanglePixel( - maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(), - maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY()); - - for(sal_uInt16 a(0); a < rWindow.GetChildCount(); a++) - { - Window* pCandidate = rWindow.GetChild(a); - - if(pCandidate && pCandidate->IsPaintTransparent()) - { - const Rectangle aCandidatePosSizePixel(pCandidate->GetPosPixel(), pCandidate->GetSizePixel()); - - if(aCandidatePosSizePixel.IsOver(aRegionRectanglePixel)) - { - pCandidate->Invalidate(INVALIDATE_NOTRANSPARENT|INVALIDATE_CHILDREN); - pCandidate->Update(); - } - } - } - } + const Rectangle aRegionRectanglePixel( + maBufferRememberedRangePixel.getMinX(), + maBufferRememberedRangePixel.getMinY(), + maBufferRememberedRangePixel.getMaxX(), + maBufferRememberedRangePixel.getMaxY()); + PaintTransparentChildren(rWindow, aRegionRectanglePixel); } // #i80730# restore visibility of VCL cursor diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx index cf9548dbe02d..f5cedd8b8212 100644 --- a/svx/source/svdraw/sdrpaintwindow.cxx +++ b/svx/source/svdraw/sdrpaintwindow.cxx @@ -23,6 +23,33 @@ #include <vcl/gdimtf.hxx> #include <vcl/svapp.hxx> + +void PaintTransparentChildren(Window & rWindow, Rectangle const& rPixelRect) +{ + if (rWindow.IsChildTransparentModeEnabled()) + { + Window * pCandidate = rWindow.GetWindow( WINDOW_FIRSTCHILD ); + while (pCandidate) + { + if (pCandidate->IsPaintTransparent()) + { + const Rectangle aCandidatePosSizePixel( + pCandidate->GetPosPixel(), + pCandidate->GetSizePixel()); + + if (aCandidatePosSizePixel.IsOver(rPixelRect)) + { + pCandidate->Invalidate( + INVALIDATE_NOTRANSPARENT|INVALIDATE_CHILDREN ); + // important: actually paint the child here! + pCandidate->Update(); + } + } + pCandidate = pCandidate->GetWindow( WINDOW_NEXT ); + } + } +} + //////////////////////////////////////////////////////////////////////////////////////////////////// SdrPreRenderDevice::SdrPreRenderDevice(OutputDevice& rOriginal) |