summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-05-14 14:42:24 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2020-05-29 10:30:12 +0200
commit58e74f32a8f0b003226b8897d51bfd5516a966bb (patch)
treea873847eb48980d06669d878c2a916b975edfc1b /drawinglayer
parent86e509b9cfc3249fc97f9f49fbeafdc4a7d8af12 (diff)
tdf#49247, tdf#101181: Fix effect bounds
This will avoid cutting rightmost and bottommost pixels from the effects, caused by casting of range dimensions to integers. Change-Id: Icad9c06c33bafae9531bc45559acecd3581fad89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95020 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit 541e5a9e84c42fbf20158b01a4feaa0f226e9ed0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95075
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx21
1 files changed, 13 insertions, 8 deletions
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 131e51f34913..32afe33e6147 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -993,8 +993,11 @@ void VclPixelProcessor2D::processGlowPrimitive2D(const primitive2d::GlowPrimitiv
// glow primitive.
mpOutputDevice->Erase();
process(rCandidate);
- Bitmap bitmap = mpOutputDevice->GetBitmap(Point(aRange.getMinX(), aRange.getMinY()),
- Size(aRange.getWidth(), aRange.getHeight()));
+ const tools::Rectangle aRect(static_cast<long>(std::floor(aRange.getMinX())),
+ static_cast<long>(std::floor(aRange.getMinY())),
+ static_cast<long>(std::ceil(aRange.getMaxX())),
+ static_cast<long>(std::ceil(aRange.getMaxY())));
+ Bitmap bitmap = mpOutputDevice->GetBitmap(aRect.TopLeft(), aRect.GetSize());
AlphaMask mask = ProcessAndBlurAlphaMask(bitmap, fBlurRadius, fBlurRadius, nTransparency);
@@ -1007,7 +1010,7 @@ void VclPixelProcessor2D::processGlowPrimitive2D(const primitive2d::GlowPrimitiv
// back to old OutDev
mpOutputDevice = pLastOutputDevice;
- mpOutputDevice->DrawBitmapEx(Point(aRange.getMinX(), aRange.getMinY()), result);
+ mpOutputDevice->DrawBitmapEx(aRect.TopLeft(), result);
}
else
SAL_WARN("drawinglayer", "Temporary buffered virtual device is not visible");
@@ -1036,8 +1039,11 @@ void VclPixelProcessor2D::processSoftEdgePrimitive2D(
rCandidate.setMaskGeneration();
process(rCandidate);
rCandidate.setMaskGeneration(false);
- Bitmap bitmap = mpOutputDevice->GetBitmap(Point(aRange.getMinX(), aRange.getMinY()),
- Size(aRange.getWidth(), aRange.getHeight()));
+ const tools::Rectangle aRect(static_cast<long>(std::floor(aRange.getMinX())),
+ static_cast<long>(std::floor(aRange.getMinY())),
+ static_cast<long>(std::ceil(aRange.getMaxX())),
+ static_cast<long>(std::ceil(aRange.getMaxY())));
+ Bitmap bitmap = mpOutputDevice->GetBitmap(aRect.TopLeft(), aRect.GetSize());
AlphaMask mask = ProcessAndBlurAlphaMask(bitmap, -fBlurRadius, fBlurRadius, 0);
@@ -1045,15 +1051,14 @@ void VclPixelProcessor2D::processSoftEdgePrimitive2D(
mpOutputDevice->Erase();
process(rCandidate);
- bitmap = mpOutputDevice->GetBitmap(Point(aRange.getMinX(), aRange.getMinY()),
- Size(aRange.getWidth(), aRange.getHeight()));
+ bitmap = mpOutputDevice->GetBitmap(aRect.TopLeft(), aRect.GetSize());
// alpha mask will be scaled up automatically to match bitmap
BitmapEx result(bitmap, mask);
// back to old OutDev
mpOutputDevice = pLastOutputDevice;
- mpOutputDevice->DrawBitmapEx(Point(aRange.getMinX(), aRange.getMinY()), result);
+ mpOutputDevice->DrawBitmapEx(aRect.TopLeft(), result);
}
else
SAL_WARN("drawinglayer", "Temporary buffered virtual device is not visible");