[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - drawinglayer/source

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Fri May 21 19:13:09 UTC 2021


 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |   24 ++++++++++------
 1 file changed, 16 insertions(+), 8 deletions(-)

New commits:
commit 343743e769dd6d4a4e8bbb49b317398629456c50
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri May 21 14:48:58 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Fri May 21 21:12:36 2021 +0200

    properly draw only parts of FillGradientPrimitive2D (tdf#139000)
    
    The size of the whole gradient is getDefinitionRange(), while
    getOutputRange() gives the area of it to draw.
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115923
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    (cherry picked from commit 9bf9fea0afadef0912d38f0d08b2bf2959569100)
    
    Change-Id: I85dd7fe51bcc9c332a6fb0e6748d5ac89266b910
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115954
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 1cbd664d3eb1..46d58551ef34 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -917,13 +917,6 @@ GradientStyle convertGradientStyle(drawinglayer::attribute::GradientStyle eGradi
 
             GradientStyle eGradientStyle = convertGradientStyle(rFillGradient.getStyle());
 
-            basegfx::B2DRange aRange(rPrimitive.getOutputRange());
-            aRange.transform(maCurrentTransformation);
-
-            const tools::Rectangle aRectangle(
-                sal_Int32(std::floor(aRange.getMinX())), sal_Int32(std::floor(aRange.getMinY())),
-                sal_Int32(std::ceil(aRange.getMaxX())), sal_Int32(std::ceil(aRange.getMaxY())));
-
             Gradient aGradient(eGradientStyle, Color(rFillGradient.getStartColor()),
                                Color(rFillGradient.getEndColor()));
 
@@ -933,7 +926,22 @@ GradientStyle convertGradientStyle(drawinglayer::attribute::GradientStyle eGradi
             aGradient.SetOfsY(rFillGradient.getOffsetY() * 100.0);
             aGradient.SetSteps(rFillGradient.getSteps());
 
-            mpOutputDevice->DrawGradient(aRectangle, aGradient);
+            basegfx::B2DRange aOutputRange(rPrimitive.getOutputRange());
+            aOutputRange.transform(maCurrentTransformation);
+            basegfx::B2DRange aFullRange(rPrimitive.getDefinitionRange());
+            aFullRange.transform(maCurrentTransformation);
+
+            const tools::Rectangle aOutputRectangle(
+                std::floor(aOutputRange.getMinX()), std::floor(aOutputRange.getMinY()),
+                std::ceil(aOutputRange.getMaxX()), std::ceil(aOutputRange.getMaxY()));
+            const tools::Rectangle aFullRectangle(
+                std::floor(aFullRange.getMinX()), std::floor(aFullRange.getMinY()),
+                std::ceil(aFullRange.getMaxX()), std::ceil(aFullRange.getMaxY()));
+
+            mpOutputDevice->Push(PushFlags::CLIPREGION);
+            mpOutputDevice->IntersectClipRegion(aOutputRectangle);
+            mpOutputDevice->DrawGradient(aFullRectangle, aGradient);
+            mpOutputDevice->Pop();
         }
 
     } // end of namespace processor2d


More information about the Libreoffice-commits mailing list