diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-05-15 21:35:43 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-05-16 09:55:12 +0200 |
commit | a193da0a46f9613a3eefe0e35c8fa000b2f19fd3 (patch) | |
tree | 6e636caa94ce3f2af418fc71b4bf218359978daf | |
parent | a399853f864ace2d4bd7e9a3a3b3eeb8a2379e4a (diff) |
split methods up
Change-Id: Ib6f27574b8a45b29d6887d268f2e291314c796bf
Reviewed-on: https://gerrit.libreoffice.org/72382
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/svx/sdr/overlay/overlaymanager.hxx | 2 | ||||
-rw-r--r-- | include/svx/svdpntv.hxx | 1 | ||||
-rw-r--r-- | svx/source/sdr/overlay/overlaymanager.cxx | 53 | ||||
-rw-r--r-- | svx/source/svdraw/sdrpaintwindow.cxx | 29 |
4 files changed, 48 insertions, 37 deletions
diff --git a/include/svx/sdr/overlay/overlaymanager.hxx b/include/svx/sdr/overlay/overlaymanager.hxx index 58b6d620984e..ae49f2d59b75 100644 --- a/include/svx/sdr/overlay/overlaymanager.hxx +++ b/include/svx/sdr/overlay/overlaymanager.hxx @@ -88,6 +88,8 @@ namespace sdr // ViewTransformation and evtl. correct mfDiscreteOne double getDiscreteOne() const; + tools::Rectangle RangeToInvalidateRectangle(const basegfx::B2DRange& rRange) const; + OverlayManager(OutputDevice& rOutputDevice); virtual ~OverlayManager() override; diff --git a/include/svx/svdpntv.hxx b/include/svx/svdpntv.hxx index 43bcd34e234f..a5eee136faec 100644 --- a/include/svx/svdpntv.hxx +++ b/include/svx/svdpntv.hxx @@ -230,6 +230,7 @@ protected: // Interface to SdrPaintWindow void DeletePaintWindow(SdrPaintWindow& rOld); void ConfigurationChanged( ::utl::ConfigurationBroadcaster*, ConfigurationHints ) override; + void InitOverlayManager(rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager) const; public: sal_uInt32 PaintWindowCount() const { return maPaintWindows.size(); } diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx index d3b3ecb6b676..62d0e5d8d9a1 100644 --- a/svx/source/sdr/overlay/overlaymanager.cxx +++ b/svx/source/sdr/overlay/overlaymanager.cxx @@ -283,34 +283,37 @@ namespace sdr } } + tools::Rectangle OverlayManager::RangeToInvalidateRectangle(const basegfx::B2DRange& rRange) const + { + if (getDrawinglayerOpt().IsAntiAliasing()) + { + // assume AA needs one pixel more and invalidate one pixel more + const double fDiscreteOne(getDiscreteOne()); + const tools::Rectangle aInvalidateRectangle( + static_cast<sal_Int32>(floor(rRange.getMinX() - fDiscreteOne)), + static_cast<sal_Int32>(floor(rRange.getMinY() - fDiscreteOne)), + static_cast<sal_Int32>(ceil(rRange.getMaxX() + fDiscreteOne)), + static_cast<sal_Int32>(ceil(rRange.getMaxY() + fDiscreteOne))); + return aInvalidateRectangle; + } + else + { + // #i77674# transform to rectangle. Use floor/ceil to get all covered + // discrete pixels, see #i75163# and OverlayManagerBuffered::invalidateRange + const tools::Rectangle aInvalidateRectangle( + static_cast<sal_Int32>(floor(rRange.getMinX())), static_cast<sal_Int32>(floor(rRange.getMinY())), + static_cast<sal_Int32>(ceil(rRange.getMaxX())), static_cast<sal_Int32>(ceil(rRange.getMaxY()))); + return aInvalidateRectangle; + } + } + void OverlayManager::invalidateRange(const basegfx::B2DRange& rRange) { - if(OUTDEV_WINDOW == getOutputDevice().GetOutDevType()) + if (OUTDEV_WINDOW == getOutputDevice().GetOutDevType()) { - if(getDrawinglayerOpt().IsAntiAliasing()) - { - // assume AA needs one pixel more and invalidate one pixel more - const double fDiscreteOne(getDiscreteOne()); - const tools::Rectangle aInvalidateRectangle( - static_cast<sal_Int32>(floor(rRange.getMinX() - fDiscreteOne)), - static_cast<sal_Int32>(floor(rRange.getMinY() - fDiscreteOne)), - static_cast<sal_Int32>(ceil(rRange.getMaxX() + fDiscreteOne)), - static_cast<sal_Int32>(ceil(rRange.getMaxY() + fDiscreteOne))); - - // simply invalidate - static_cast<vcl::Window&>(getOutputDevice()).Invalidate(aInvalidateRectangle, InvalidateFlags::NoErase); - } - else - { - // #i77674# transform to rectangle. Use floor/ceil to get all covered - // discrete pixels, see #i75163# and OverlayManagerBuffered::invalidateRange - const tools::Rectangle aInvalidateRectangle( - static_cast<sal_Int32>(floor(rRange.getMinX())), static_cast<sal_Int32>(floor(rRange.getMinY())), - static_cast<sal_Int32>(ceil(rRange.getMaxX())), static_cast<sal_Int32>(ceil(rRange.getMaxY()))); - - // simply invalidate - static_cast<vcl::Window&>(getOutputDevice()).Invalidate(aInvalidateRectangle, InvalidateFlags::NoErase); - } + tools::Rectangle aInvalidateRectangle(RangeToInvalidateRectangle(rRange)); + // simply invalidate + static_cast<vcl::Window&>(getOutputDevice()).Invalidate(aInvalidateRectangle, InvalidateFlags::NoErase); } } diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx index 060437fa77a1..91ca3860e7b0 100644 --- a/svx/source/svdraw/sdrpaintwindow.cxx +++ b/svx/source/svdraw/sdrpaintwindow.cxx @@ -168,6 +168,22 @@ void SdrPreRenderDevice::OutputPreRenderDevice(const vcl::Region& rExpandedRegio mpPreRenderDevice->EnableMapMode(bMapModeWasEnabledSource); } +void SdrPaintView::InitOverlayManager(rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager) const +{ + Color aColA(getOptionsDrawinglayer().GetStripeColorA()); + Color aColB(getOptionsDrawinglayer().GetStripeColorB()); + + if (Application::GetSettings().GetStyleSettings().GetHighContrastMode()) + { + aColA = aColB = Application::GetSettings().GetStyleSettings().GetHighlightColor(); + aColB.Invert(); + } + + xOverlayManager->setStripeColorA(aColA); + xOverlayManager->setStripeColorB(aColB); + xOverlayManager->setStripeLengthPixel(getOptionsDrawinglayer().GetStripeLength()); +} + rtl::Reference<sdr::overlay::OverlayManager> SdrPaintView::CreateOverlayManager(OutputDevice& rOutputDevice) const { rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager; @@ -204,18 +220,7 @@ rtl::Reference<sdr::overlay::OverlayManager> SdrPaintView::CreateOverlayManager( rWindow.Invalidate(); } - Color aColA(getOptionsDrawinglayer().GetStripeColorA()); - Color aColB(getOptionsDrawinglayer().GetStripeColorB()); - - if(Application::GetSettings().GetStyleSettings().GetHighContrastMode()) - { - aColA = aColB = Application::GetSettings().GetStyleSettings().GetHighlightColor(); - aColB.Invert(); - } - - xOverlayManager->setStripeColorA(aColA); - xOverlayManager->setStripeColorB(aColB); - xOverlayManager->setStripeLengthPixel(getOptionsDrawinglayer().GetStripeLength()); + InitOverlayManager(xOverlayManager); } return xOverlayManager; } |