Kaydet (Commit) a193da0a authored tarafından Caolán McNamara's avatar Caolán McNamara

split methods up

Change-Id: Ib6f27574b8a45b29d6887d268f2e291314c796bf
Reviewed-on: https://gerrit.libreoffice.org/72382
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst a399853f
......@@ -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;
......
......@@ -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(); }
......
......@@ -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);
}
}
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment