From 0a618246fc83f6ba7bd48de6164de7efc123f06f Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 19 Jun 2020 12:17:18 +0300 Subject: tdf#134134: consider color modifier stack when pixel-processing Add initial color stack as an optional processor ctor argument, so that it wouldn't be possibe to modify it after construction from outside randomly (which could break the stack state). Change-Id: I8aae4b806531fa61cc67def865297f5de1cf0755 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96684 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 2 +- drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 5 +++-- drawinglayer/source/processor2d/vclpixelprocessor2d.hxx | 4 +++- drawinglayer/source/processor2d/vclprocessor2d.cxx | 5 +++-- drawinglayer/source/processor2d/vclprocessor2d.hxx | 3 ++- 5 files changed, 12 insertions(+), 7 deletions(-) (limited to 'drawinglayer') diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 297fd725c7b7..1de36cd9f47d 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -2397,7 +2397,7 @@ void VclMetafileProcessor2D::processPrimitive2DOnPixelProcessor( auto pBufferDevice(CreateBufferDevice(aViewRange, 500000, aViewInfo, aRectLogic, aSizePixel)); if (pBufferDevice) { - VclPixelProcessor2D aBufferProcessor(aViewInfo, *pBufferDevice); + VclPixelProcessor2D aBufferProcessor(aViewInfo, *pBufferDevice, maBColorModifierStack); // draw content using pixel renderer primitive2d::Primitive2DReference aRef( diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 864f5ca107b6..b91bf57c360d 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -81,8 +81,9 @@ struct VclPixelProcessor2D::Impl }; VclPixelProcessor2D::VclPixelProcessor2D(const geometry::ViewInformation2D& rViewInformation, - OutputDevice& rOutDev) - : VclProcessor2D(rViewInformation, rOutDev) + OutputDevice& rOutDev, + const basegfx::BColorModifierStack& rInitStack) + : VclProcessor2D(rViewInformation, rOutDev, rInitStack) , m_pImpl(new Impl(rOutDev)) { // prepare maCurrentTransformation matrix with viewTransformation to target directly to pixels diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx index 5a23499f9a9b..c3bd19141669 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx @@ -102,7 +102,9 @@ class VclPixelProcessor2D final : public VclProcessor2D public: /// constructor/destructor - VclPixelProcessor2D(const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev); + VclPixelProcessor2D(const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev, + const basegfx::BColorModifierStack& rInitStack + = basegfx::BColorModifierStack()); virtual ~VclPixelProcessor2D() override; }; } // end of namespace drawinglayer::processor2d diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index e64995c8b50a..5a0a85f911ef 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -1485,10 +1485,11 @@ void VclProcessor2D::adaptTextToFillDrawMode() const // process support VclProcessor2D::VclProcessor2D(const geometry::ViewInformation2D& rViewInformation, - OutputDevice& rOutDev) + OutputDevice& rOutDev, + const basegfx::BColorModifierStack& rInitStack) : BaseProcessor2D(rViewInformation) , mpOutputDevice(&rOutDev) - , maBColorModifierStack() + , maBColorModifierStack(rInitStack) , maCurrentTransformation() , maDrawinglayerOpt() , mnPolygonStrokePrimitive2D(0) diff --git a/drawinglayer/source/processor2d/vclprocessor2d.hxx b/drawinglayer/source/processor2d/vclprocessor2d.hxx index 3b1b997a7cc4..dbca9ed4ba25 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.hxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.hxx @@ -120,7 +120,8 @@ protected: public: // constructor/destructor - VclProcessor2D(const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev); + VclProcessor2D(const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev, + const basegfx::BColorModifierStack& rInitStack = basegfx::BColorModifierStack()); virtual ~VclProcessor2D() override; // access to Drawinglayer configuration options -- cgit