summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-05-21 14:48:58 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2021-06-04 16:33:46 +0200
commitfaf86ac0cbbf7c5910fada6e9026409990c01895 (patch)
tree7f26ec70e39db6951e4f8f7dfd13e0a253458414
parent8228c7aa3a753cb74345b98ceb5e076b2b55a74c (diff)
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. Change-Id: I85dd7fe51bcc9c332a6fb0e6748d5ac89266b910 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115923 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com> (cherry picked from commit 9bf9fea0afadef0912d38f0d08b2bf2959569100) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115850 (cherry picked from commit 887f1dbbda9dd371f52111c2f5a3bbbc67fc5615) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115960 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx24
1 files changed, 16 insertions, 8 deletions
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index ebbc41744734..47f39e87bf8b 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -1207,13 +1207,6 @@ void VclPixelProcessor2D::processFillGradientPrimitive2D(
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()));
@@ -1223,7 +1216,22 @@ void VclPixelProcessor2D::processFillGradientPrimitive2D(
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