summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-05-15 21:35:43 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-05-16 09:55:12 +0200
commita193da0a46f9613a3eefe0e35c8fa000b2f19fd3 (patch)
tree6e636caa94ce3f2af418fc71b4bf218359978daf /svx
parenta399853f864ace2d4bd7e9a3a3b3eeb8a2379e4a (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>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/sdr/overlay/overlaymanager.cxx53
-rw-r--r--svx/source/svdraw/sdrpaintwindow.cxx29
2 files changed, 45 insertions, 37 deletions
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;
}