From 0be0b4e57cbeaab3e73f1d12ef2ad9b55fd1c885 Mon Sep 17 00:00:00 2001 From: "Armin Le Grand (allotropia)" Date: Tue, 28 Jun 2022 11:16:56 +0200 Subject: tdf#149754 correct gradient paint for outside definition range Change-Id: I45fc0a7a024a4288f698eb5f0abf6b0d1440edfc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136561 Tested-by: Jenkins Reviewed-by: Armin Le Grand --- .../source/processor2d/vclpixelprocessor2d.cxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'drawinglayer') diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 362d0ddf9cab..f2bf82a9ce7b 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -1211,6 +1211,25 @@ void VclPixelProcessor2D::processFillGradientPrimitive2D( return; } + // tdf#149754 VCL gradient draw is not capable to handle all primitive gradient definitions, + // what should be clear due to being developed to ectend/replace them in + // capabilities & precision. + // It is e.g. not capable to correctly paint if the OutputRange is not completely + // inside the DefinitionRange, thus forcing to paint gradent parts *outside* the + // DefinitionRange. + // This happens for Writer with Frames anchored in Frames (and was broken due to + // falling back to VCL Gradient paint here), and for the new SlideBackgroundFill + // Fill mode for objects using it that reach outside the page (which is the + // DefinitionRange in that case). + // I see no real reason to fallback here to OutputDevice::DrawGradient and VCL + // gradient paint at all (system-dependent renderers wouldn't in the future), but + // will for convenience only add that needed additional correcting case + if (!rPrimitive.getDefinitionRange().isInside(rPrimitive.getOutputRange())) + { + process(rPrimitive); + return; + } + GradientStyle eGradientStyle = convertGradientStyle(rFillGradient.getStyle()); Gradient aGradient(eGradientStyle, Color(rFillGradient.getStartColor()), -- cgit