drawinglayer/source/processor2d/cairopixelprocessor2d.cxx |    2 +-
 drawinglayer/source/processor2d/vclhelperbufferdevice.cxx |    7 ++-----
 drawinglayer/source/processor2d/vclhelperbufferdevice.hxx |    2 +-
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx   |    2 +-
 drawinglayer/source/processor2d/vclprocessor2d.cxx        |   10 +++++++---
 5 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit f5b8ec6b3fbc9a48bded4e621cc1bf3a8093f824
Author:     Noel Grandin <[email protected]>
AuthorDate: Fri Oct 17 13:25:32 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Sat Oct 18 10:52:29 2025 +0200

    tdf#168730 impBufferDevice and caller should have the same mask rect
    
    VclPixelProcessor2D::processPatternFillPrimitive2D and
    impBufferDevice were independently calculating the mask rect in
    different ways. So move the calculation to the callers.
    
    This only fixed a tiny part of the problems in this bugreport,
    it just helps with off-by-one at zoom levels.
    
    Change-Id: I933f5271e31ba79794951a6b1f469fc28094d0a8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192572
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
index b9691f4db9f3..14d6800af5d2 100644
--- a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
@@ -3490,7 +3490,7 @@ void CairoPixelProcessor2D::processPatternFillPrimitive2D(
         return;
     }
 
-    impBufferDevice aBufferDevice(*mpTargetOutputDevice, aMaskRange);
+    impBufferDevice aBufferDevice(*mpTargetOutputDevice, aMaskRect);
     if (!aBufferDevice.isVisible())
         return;
     // remember last OutDev and set to content
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx 
b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index d62606ac803b..0ab4a8d9c707 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -389,15 +389,12 @@ VDevBuffer& getVDevBuffer()
     return *aVDevBuffer.get();
 }
 
-impBufferDevice::impBufferDevice(OutputDevice& rOutDev, const 
basegfx::B2DRange& rRange)
+impBufferDevice::impBufferDevice(OutputDevice& rOutDev, const 
tools::Rectangle& rDestPixel)
     : mrOutDev(rOutDev)
     , mpContent(nullptr)
     , mpAlpha(nullptr)
+    , maDestPixel(rDestPixel)
 {
-    basegfx::B2DRange aRangePixel(rRange);
-    aRangePixel.transform(mrOutDev.GetViewTransformation());
-    maDestPixel = tools::Rectangle(floor(aRangePixel.getMinX()), 
floor(aRangePixel.getMinY()),
-                                   ceil(aRangePixel.getMaxX()), 
ceil(aRangePixel.getMaxY()));
     maDestPixel.Intersection(tools::Rectangle{ Point{}, 
mrOutDev.GetOutputSizePixel() });
 
     if (!isVisible())
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx 
b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
index 618fb38209a5..ebdc75d57474 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
@@ -99,7 +99,7 @@ class impBufferDevice
     tools::Rectangle maDestPixel;
 
 public:
-    impBufferDevice(OutputDevice& rOutDev, const basegfx::B2DRange& rRange);
+    impBufferDevice(OutputDevice& rOutDev, const tools::Rectangle& rDestPixel);
     ~impBufferDevice();
 
     void paint(double fTrans = 0.0);
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index d271b5ee2ca3..e9260abd6cde 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -1095,7 +1095,7 @@ void VclPixelProcessor2D::processPatternFillPrimitive2D(
         return;
     }
 
-    impBufferDevice aBufferDevice(*mpOutputDevice, aMaskRange);
+    impBufferDevice aBufferDevice(*mpOutputDevice, aMaskRect);
 
     if (!aBufferDevice.isVisible())
         return;
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index eebb5a99f9b0..390f46c83766 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -26,6 +26,7 @@
 #include <tools/debug.hxx>
 #include <tools/fract.hxx>
 #include <utility>
+#include <vcl/canvastools.hxx>
 #include <vcl/glyphitemcache.hxx>
 #include <vcl/graph.hxx>
 #include <vcl/kernarray.hxx>
@@ -923,7 +924,8 @@ void VclProcessor2D::RenderMaskPrimitive2DPixel(const 
primitive2d::MaskPrimitive
     }
 
     const basegfx::B2DRange aRange(basegfx::utils::getRange(aMask));
-    impBufferDevice aBufferDevice(*mpOutputDevice, aRange);
+    tools::Rectangle aMaskRect = 
vcl::unotools::rectangleFromB2DRectangle(aRange);
+    impBufferDevice aBufferDevice(*mpOutputDevice, aMaskRect);
 
     if (!aBufferDevice.isVisible())
         return;
@@ -977,7 +979,8 @@ void VclProcessor2D::RenderUnifiedTransparencePrimitive2D(
         // transparence is in visible range
         basegfx::B2DRange 
aRange(rTransCandidate.getChildren().getB2DRange(getViewInformation2D()));
         aRange.transform(maCurrentTransformation);
-        impBufferDevice aBufferDevice(*mpOutputDevice, aRange);
+        tools::Rectangle aRangeRect = 
vcl::unotools::rectangleFromB2DRectangle(aRange);
+        impBufferDevice aBufferDevice(*mpOutputDevice, aRangeRect);
 
         if (aBufferDevice.isVisible())
         {
@@ -1006,7 +1009,8 @@ void VclProcessor2D::RenderTransparencePrimitive2D(
 
     basegfx::B2DRange 
aRange(rTransCandidate.getChildren().getB2DRange(getViewInformation2D()));
     aRange.transform(maCurrentTransformation);
-    impBufferDevice aBufferDevice(*mpOutputDevice, aRange);
+    tools::Rectangle aRangeRect = 
vcl::unotools::rectangleFromB2DRectangle(aRange);
+    impBufferDevice aBufferDevice(*mpOutputDevice, aRangeRect);
 
     if (!aBufferDevice.isVisible())
         return;

Reply via email to