diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-05-28 12:48:28 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-05-29 10:30:21 +0200 |
commit | d0aff1174189983a1a090f61a504d6a3c7fca095 (patch) | |
tree | 2d1918b3a6189cc35a4f65d7bc972d8e591280cf /drawinglayer | |
parent | 58e74f32a8f0b003226b8897d51bfd5516a966bb (diff) |
tdf#49247, tdf#101181: don't rely on automatic scaling of alpha mask
Scale it back explicitly in ProcessAndBlurAlphaMask
Change-Id: I8e8a58c117d8b59db40b416edadc559b47dc300a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95021
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 2cfe93da835eb500c9a170d22fce19fbd1de9473)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95076
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 32afe33e6147..9e44ef292d34 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -917,18 +917,17 @@ void VclPixelProcessor2D::processMetaFilePrimitive2D(const primitive2d::BasePrim namespace { -/* Returns 8-bit alpha mask created from passed mask. The result may be scaled down; it's - expected that it will be automatically scaled up back when applied to the bitmap. +/* Returns 8-bit alpha mask created from passed mask. Negative fErodeDilateRadius values mean erode, positive - dilate. nTransparency defines minimal transparency level. */ -AlphaMask ProcessAndBlurAlphaMask(const Bitmap& rBWMask, double fErodeDilateRadius, +AlphaMask ProcessAndBlurAlphaMask(const Bitmap& rMask, double fErodeDilateRadius, double fBlurRadius, sal_uInt8 nTransparency) { // Only completely white pixels on the initial mask must be considered for transparency. Any // other color must be treated as black. This creates 1-bit B&W bitmap. - BitmapEx mask(rBWMask.CreateMask(COL_WHITE)); + BitmapEx mask(rMask.CreateMask(COL_WHITE)); // Scaling down increases performance without noticeable quality loss. Additionally, // current blur implementation can only handle blur radius between 2 and 254. @@ -963,6 +962,8 @@ AlphaMask ProcessAndBlurAlphaMask(const Bitmap& rBWMask, double fErodeDilateRadi // calculate blurry effect BitmapFilter::Filter(mask, BitmapFilterStackBlur(fBlurRadius)); + mask.Scale(rMask.GetSizePixel()); + return AlphaMask(mask.GetBitmap()); } } @@ -1005,7 +1006,6 @@ void VclPixelProcessor2D::processGlowPrimitive2D(const primitive2d::GlowPrimitiv const basegfx::BColor aGlowColor( maBColorModifierStack.getModifiedColor(rCandidate.getGlowColor().getBColor())); bitmap.Erase(Color(aGlowColor)); - // alpha mask will be scaled up automatically to match bitmap BitmapEx result(bitmap, mask); // back to old OutDev @@ -1053,7 +1053,6 @@ void VclPixelProcessor2D::processSoftEdgePrimitive2D( process(rCandidate); 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 |