include/vcl/bitmap/BitmapAlphaClampFilter.hxx | 2 include/vcl/bitmap/BitmapArithmeticBlendFilter.hxx | 6 include/vcl/bitmap/BitmapBasicMorphologyFilter.hxx | 4 include/vcl/bitmap/BitmapColorQuantizationFilter.hxx | 2 include/vcl/bitmap/BitmapConvolutionMatrixFilter.hxx | 2 include/vcl/bitmap/BitmapDarkenBlendFilter.hxx | 6 include/vcl/bitmap/BitmapEmbossGreyFilter.hxx | 2 include/vcl/bitmap/BitmapFilter.hxx | 2 include/vcl/bitmap/BitmapFilterStackBlur.hxx | 4 include/vcl/bitmap/BitmapGaussianSeparableBlurFilter.hxx | 2 include/vcl/bitmap/BitmapMedianFilter.hxx | 2 include/vcl/bitmap/BitmapMonochromeFilter.hxx | 2 include/vcl/bitmap/BitmapMosaicFilter.hxx | 2 include/vcl/bitmap/BitmapPopArtFilter.hxx | 2 include/vcl/bitmap/BitmapSeparableUnsharpenFilter.hxx | 2 include/vcl/bitmap/BitmapSepiaFilter.hxx | 2 include/vcl/bitmap/BitmapShadowFilter.hxx | 2 include/vcl/bitmap/BitmapSimpleColorQuantizationFilter.hxx | 2 include/vcl/bitmap/BitmapSmoothenFilter.hxx | 2 include/vcl/bitmap/BitmapSobelGreyFilter.hxx | 2 include/vcl/bitmap/BitmapSolarizeFilter.hxx | 2 oox/source/drawingml/fillproperties.cxx | 6 sd/source/ui/dlg/vectdlg.cxx | 4 svgio/source/svgreader/svgfeblendnode.cxx | 4 svgio/source/svgreader/svgfecompositenode.cxx | 11 vcl/inc/bitmap/BitmapColorizeFilter.hxx | 2 vcl/inc/bitmap/BitmapDisabledImageFilter.hxx | 2 vcl/inc/bitmap/BitmapDuoToneFilter.hxx | 2 vcl/inc/bitmap/BitmapFastScaleFilter.hxx | 2 vcl/inc/bitmap/BitmapInterpolateScaleFilter.hxx | 2 vcl/inc/bitmap/BitmapLightenFilter.hxx | 2 vcl/inc/bitmap/BitmapMaskToAlphaFilter.hxx | 2 vcl/inc/bitmap/BitmapScaleConvolutionFilter.hxx | 2 vcl/inc/bitmap/BitmapScaleSuperFilter.hxx | 2 vcl/inc/skia/salbmp.hxx | 4 vcl/inc/svdata.hxx | 2 vcl/qa/cppunit/BitmapFilterTest.cxx | 208 ++++++------- vcl/qa/cppunit/BitmapProcessorTest.cxx | 15 vcl/qa/cppunit/png/PngFilterTest.cxx | 6 vcl/skia/salbmp.cxx | 64 ---- vcl/source/bitmap/BitmapAlphaClampFilter.cxx | 24 - vcl/source/bitmap/BitmapArithmeticBlendFilter.cxx | 39 +- vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx | 8 vcl/source/bitmap/BitmapColorQuantizationFilter.cxx | 12 vcl/source/bitmap/BitmapColorizeFilter.cxx | 8 vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx | 10 vcl/source/bitmap/BitmapDarkenBlendFilter.cxx | 27 - vcl/source/bitmap/BitmapDisabledImageFilter.cxx | 14 vcl/source/bitmap/BitmapDuoToneFilter.cxx | 6 vcl/source/bitmap/BitmapEmbossGreyFilter.cxx | 12 vcl/source/bitmap/BitmapFastScaleFilter.cxx | 16 - vcl/source/bitmap/BitmapFilterStackBlur.cxx | 9 vcl/source/bitmap/BitmapGaussianSeparableBlurFilter.cxx | 8 vcl/source/bitmap/BitmapInterpolateScaleFilter.cxx | 12 vcl/source/bitmap/BitmapLightenFilter.cxx | 12 vcl/source/bitmap/BitmapMaskToAlphaFilter.cxx | 9 vcl/source/bitmap/BitmapMedianFilter.cxx | 10 vcl/source/bitmap/BitmapMonochromeFilter.cxx | 22 - vcl/source/bitmap/BitmapMosaicFilter.cxx | 10 vcl/source/bitmap/BitmapPopArtFilter.cxx | 10 vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx | 8 vcl/source/bitmap/BitmapScaleSuperFilter.cxx | 15 vcl/source/bitmap/BitmapSeparableUnsharpenFilter.cxx | 10 vcl/source/bitmap/BitmapSepiaFilter.cxx | 10 vcl/source/bitmap/BitmapShadowFilter.cxx | 10 vcl/source/bitmap/BitmapSimpleColorQuantizationFilter.cxx | 12 vcl/source/bitmap/BitmapSmoothenFilter.cxx | 12 vcl/source/bitmap/BitmapSobelGreyFilter.cxx | 21 - vcl/source/bitmap/BitmapSolarizeFilter.cxx | 65 +--- vcl/source/bitmap/bitmap.cxx | 24 - vcl/source/bitmap/bitmapfilter.cxx | 24 - vcl/source/graphic/UnoGraphic.cxx | 6 vcl/source/image/Image.cxx | 7 vcl/unx/generic/dtrans/bmp.cxx | 18 - vcl/workben/vcldemo.cxx | 4 75 files changed, 379 insertions(+), 541 deletions(-)
New commits: commit e041602d59947fbf5690104d9c34c5f93a624951 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Sat Aug 2 17:21:10 2025 +0200 Commit: Noel Grandin <noelgran...@gmail.com> CommitDate: Mon Aug 4 12:30:31 2025 +0200 BitmapEx->Bitmap in BitmapFilter now that Bitmap can handle transparency. Which exposes a bug in skia, where an unfortunate optimisation breaks bitmaps with alpha data, because it overwrites said alpha data. So remove that skia optimisation. Change-Id: If821f6f04f464ee4ad42ba1c6571db6c69525ece Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188885 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/vcl/bitmap/BitmapAlphaClampFilter.hxx b/include/vcl/bitmap/BitmapAlphaClampFilter.hxx index 5eab99e5d1f2..4a036263e0d9 100644 --- a/include/vcl/bitmap/BitmapAlphaClampFilter.hxx +++ b/include/vcl/bitmap/BitmapAlphaClampFilter.hxx @@ -22,7 +22,7 @@ public: { } - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: sal_uInt8 mcThreshold; diff --git a/include/vcl/bitmap/BitmapArithmeticBlendFilter.hxx b/include/vcl/bitmap/BitmapArithmeticBlendFilter.hxx index 954e49f7ebb0..fbfb24d049d4 100644 --- a/include/vcl/bitmap/BitmapArithmeticBlendFilter.hxx +++ b/include/vcl/bitmap/BitmapArithmeticBlendFilter.hxx @@ -15,18 +15,18 @@ class VCL_DLLPUBLIC BitmapArithmeticBlendFilter final : public BitmapFilter { private: - BitmapEx maBitmapEx2; + Bitmap maBitmap2; double mnK1; double mnK2; double mnK3; double mnK4; public: - BitmapArithmeticBlendFilter(BitmapEx const& rBmpEx2, double nK1, double nK2, double nK3, + BitmapArithmeticBlendFilter(Bitmap const& rBmp2, double nK1, double nK2, double nK3, double nK4); ~BitmapArithmeticBlendFilter(); - BitmapEx execute(BitmapEx const& rBitmapEx) const; + virtual Bitmap execute(Bitmap const& rBitmap) const override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/bitmap/BitmapBasicMorphologyFilter.hxx b/include/vcl/bitmap/BitmapBasicMorphologyFilter.hxx index 5388d91729bd..657841ff1d28 100644 --- a/include/vcl/bitmap/BitmapBasicMorphologyFilter.hxx +++ b/include/vcl/bitmap/BitmapBasicMorphologyFilter.hxx @@ -26,11 +26,9 @@ public: BitmapBasicMorphologyFilter(BasicMorphologyOp op, sal_Int32 nRadius, sal_uInt8 nValueOutside); virtual ~BitmapBasicMorphologyFilter(); - virtual BitmapEx execute(BitmapEx const& rBitmap) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: - Bitmap filter(Bitmap const& rBitmap) const; - BasicMorphologyOp m_eOp; sal_Int32 m_nRadius; sal_uInt8 m_nValueOutside = 0; diff --git a/include/vcl/bitmap/BitmapColorQuantizationFilter.hxx b/include/vcl/bitmap/BitmapColorQuantizationFilter.hxx index 920d6fe6f72f..34eba7134019 100644 --- a/include/vcl/bitmap/BitmapColorQuantizationFilter.hxx +++ b/include/vcl/bitmap/BitmapColorQuantizationFilter.hxx @@ -25,7 +25,7 @@ public: { } - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: sal_uInt16 mnNewColorCount; diff --git a/include/vcl/bitmap/BitmapConvolutionMatrixFilter.hxx b/include/vcl/bitmap/BitmapConvolutionMatrixFilter.hxx index b4fca8764bbc..f21db7960d0a 100644 --- a/include/vcl/bitmap/BitmapConvolutionMatrixFilter.hxx +++ b/include/vcl/bitmap/BitmapConvolutionMatrixFilter.hxx @@ -22,7 +22,7 @@ public: { } - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: const sal_Int32 (&mrMatrix)[9]; diff --git a/include/vcl/bitmap/BitmapDarkenBlendFilter.hxx b/include/vcl/bitmap/BitmapDarkenBlendFilter.hxx index de8ff278e065..7c74add13b1c 100644 --- a/include/vcl/bitmap/BitmapDarkenBlendFilter.hxx +++ b/include/vcl/bitmap/BitmapDarkenBlendFilter.hxx @@ -15,12 +15,12 @@ class VCL_DLLPUBLIC BitmapDarkenBlendFilter final : public BitmapFilter { private: - BitmapEx maBlendBitmapBitmapEx; + Bitmap maBlendBitmapBitmap; public: - BitmapDarkenBlendFilter(BitmapEx const& rBitmapBlendEx); + BitmapDarkenBlendFilter(Bitmap const& rBitmapBlend); - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/bitmap/BitmapEmbossGreyFilter.hxx b/include/vcl/bitmap/BitmapEmbossGreyFilter.hxx index cde388a76fcb..102b11b6d03e 100644 --- a/include/vcl/bitmap/BitmapEmbossGreyFilter.hxx +++ b/include/vcl/bitmap/BitmapEmbossGreyFilter.hxx @@ -24,7 +24,7 @@ public: { } - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: Degree100 mnAzimuthAngle; diff --git a/include/vcl/bitmap/BitmapFilter.hxx b/include/vcl/bitmap/BitmapFilter.hxx index f846fdea7483..d8a41bd97342 100644 --- a/include/vcl/bitmap/BitmapFilter.hxx +++ b/include/vcl/bitmap/BitmapFilter.hxx @@ -70,7 +70,7 @@ public: BitmapFilter(); virtual ~BitmapFilter(); - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const = 0; + virtual Bitmap execute(Bitmap const& rBitmap) const = 0; static bool Filter(BitmapEx& rBmpEx, BitmapFilter const& rFilter); static bool Filter(Bitmap& rBmp, BitmapFilter const& rFilter); diff --git a/include/vcl/bitmap/BitmapFilterStackBlur.hxx b/include/vcl/bitmap/BitmapFilterStackBlur.hxx index ffd8f200b0a2..3120fdea0cd8 100644 --- a/include/vcl/bitmap/BitmapFilterStackBlur.hxx +++ b/include/vcl/bitmap/BitmapFilterStackBlur.hxx @@ -21,9 +21,7 @@ public: BitmapFilterStackBlur(sal_Int32 nRadius); virtual ~BitmapFilterStackBlur(); - virtual BitmapEx execute(BitmapEx const& rBitmap) const override; - - Bitmap filter(Bitmap const& rBitmap) const; + virtual Bitmap execute(Bitmap const& rBitmap) const override; }; #endif // INCLUDED_VCL_BITMAPFILTERSTACKBLUR_HXX diff --git a/include/vcl/bitmap/BitmapGaussianSeparableBlurFilter.hxx b/include/vcl/bitmap/BitmapGaussianSeparableBlurFilter.hxx index 11d3b331e1c3..f922f7dc4e92 100644 --- a/include/vcl/bitmap/BitmapGaussianSeparableBlurFilter.hxx +++ b/include/vcl/bitmap/BitmapGaussianSeparableBlurFilter.hxx @@ -31,7 +31,7 @@ public: Separable Blur implementation uses 2x separable 1D convolution to process the image. */ - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: double mfRadius; diff --git a/include/vcl/bitmap/BitmapMedianFilter.hxx b/include/vcl/bitmap/BitmapMedianFilter.hxx index aeb96ddc3d5e..80a0f7a3bbc3 100644 --- a/include/vcl/bitmap/BitmapMedianFilter.hxx +++ b/include/vcl/bitmap/BitmapMedianFilter.hxx @@ -17,7 +17,7 @@ class VCL_DLLPUBLIC BitmapMedianFilter final : public BitmapFilter public: BitmapMedianFilter() {} - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/bitmap/BitmapMonochromeFilter.hxx b/include/vcl/bitmap/BitmapMonochromeFilter.hxx index 058fbe9e7485..6dec64eae92a 100644 --- a/include/vcl/bitmap/BitmapMonochromeFilter.hxx +++ b/include/vcl/bitmap/BitmapMonochromeFilter.hxx @@ -31,7 +31,7 @@ public: { } - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: sal_uInt8 mcThreshold; diff --git a/include/vcl/bitmap/BitmapMosaicFilter.hxx b/include/vcl/bitmap/BitmapMosaicFilter.hxx index 8b8636a88ee6..681bb50659f4 100644 --- a/include/vcl/bitmap/BitmapMosaicFilter.hxx +++ b/include/vcl/bitmap/BitmapMosaicFilter.hxx @@ -25,7 +25,7 @@ public: { } - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: sal_Int32 mnTileWidth; diff --git a/include/vcl/bitmap/BitmapPopArtFilter.hxx b/include/vcl/bitmap/BitmapPopArtFilter.hxx index cd7f7ca30044..ebf9f7c2dbb8 100644 --- a/include/vcl/bitmap/BitmapPopArtFilter.hxx +++ b/include/vcl/bitmap/BitmapPopArtFilter.hxx @@ -17,7 +17,7 @@ class VCL_DLLPUBLIC BitmapPopArtFilter final : public BitmapFilter public: BitmapPopArtFilter() {} - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: struct PopArtEntry diff --git a/include/vcl/bitmap/BitmapSeparableUnsharpenFilter.hxx b/include/vcl/bitmap/BitmapSeparableUnsharpenFilter.hxx index a143ad233295..933b461174ea 100644 --- a/include/vcl/bitmap/BitmapSeparableUnsharpenFilter.hxx +++ b/include/vcl/bitmap/BitmapSeparableUnsharpenFilter.hxx @@ -23,7 +23,7 @@ public: { } - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: double mfRadius; diff --git a/include/vcl/bitmap/BitmapSepiaFilter.hxx b/include/vcl/bitmap/BitmapSepiaFilter.hxx index 73b40c2e576c..2aae97d47f1a 100644 --- a/include/vcl/bitmap/BitmapSepiaFilter.hxx +++ b/include/vcl/bitmap/BitmapSepiaFilter.hxx @@ -24,7 +24,7 @@ public: mnSepiaPercent = 100; } - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: sal_uInt16 mnSepiaPercent; diff --git a/include/vcl/bitmap/BitmapShadowFilter.hxx b/include/vcl/bitmap/BitmapShadowFilter.hxx index 51cc91ed3e8c..be96a5d5bd99 100644 --- a/include/vcl/bitmap/BitmapShadowFilter.hxx +++ b/include/vcl/bitmap/BitmapShadowFilter.hxx @@ -22,7 +22,7 @@ public: { } - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: Color maShadowColor; diff --git a/include/vcl/bitmap/BitmapSimpleColorQuantizationFilter.hxx b/include/vcl/bitmap/BitmapSimpleColorQuantizationFilter.hxx index 86cf3b5fbef0..66a258482bc4 100644 --- a/include/vcl/bitmap/BitmapSimpleColorQuantizationFilter.hxx +++ b/include/vcl/bitmap/BitmapSimpleColorQuantizationFilter.hxx @@ -25,7 +25,7 @@ public: { } - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: sal_uInt16 mnNewColorCount; diff --git a/include/vcl/bitmap/BitmapSmoothenFilter.hxx b/include/vcl/bitmap/BitmapSmoothenFilter.hxx index a7a17a546c54..13d4b2cf907a 100644 --- a/include/vcl/bitmap/BitmapSmoothenFilter.hxx +++ b/include/vcl/bitmap/BitmapSmoothenFilter.hxx @@ -20,7 +20,7 @@ public: { } - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: double mfRadius; diff --git a/include/vcl/bitmap/BitmapSobelGreyFilter.hxx b/include/vcl/bitmap/BitmapSobelGreyFilter.hxx index 31e03563033e..2757aedb440c 100644 --- a/include/vcl/bitmap/BitmapSobelGreyFilter.hxx +++ b/include/vcl/bitmap/BitmapSobelGreyFilter.hxx @@ -17,7 +17,7 @@ class VCL_DLLPUBLIC BitmapSobelGreyFilter final : public BitmapFilter public: BitmapSobelGreyFilter() {} - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/bitmap/BitmapSolarizeFilter.hxx b/include/vcl/bitmap/BitmapSolarizeFilter.hxx index adfc18e80275..21fd2a68b844 100644 --- a/include/vcl/bitmap/BitmapSolarizeFilter.hxx +++ b/include/vcl/bitmap/BitmapSolarizeFilter.hxx @@ -20,7 +20,7 @@ public: { } - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: sal_uInt8 mcSolarGreyThreshold; diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index fc734b743a46..8168a0791d81 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -210,10 +210,10 @@ Reference<XGraphic> lclApplyBlackWhiteEffect(const BlipFillProperties& aBlipProp BitmapEx aBitmapEx(aGraphic.GetBitmapEx()); const AlphaMask& aMask(aBitmapEx.GetAlphaMask()); - BitmapEx aTmpBmpEx(aBitmapEx.GetBitmap()); - BitmapFilter::Filter(aTmpBmpEx, BitmapMonochromeFilter{ nThreshold }); + Bitmap aTmpBmp(aBitmapEx.GetBitmap()); + BitmapFilter::Filter(aTmpBmp, BitmapMonochromeFilter{ nThreshold }); - aReturnGraphic = ::Graphic(BitmapEx(aTmpBmpEx.GetBitmap(), aMask)); + aReturnGraphic = ::Graphic(BitmapEx(aTmpBmp, aMask)); aReturnGraphic.setOriginURL(aGraphic.getOriginURL()); return aReturnGraphic.GetXGraphic(); } diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx index 3d378b7c8384..f91a6b5e7d03 100644 --- a/sd/source/ui/dlg/vectdlg.cxx +++ b/sd/source/ui/dlg/vectdlg.cxx @@ -120,9 +120,7 @@ Bitmap SdVectorizeDlg::GetPreparedBitmap( Bitmap const & rBmp, Fraction& rScale else rScale = Fraction( 1, 1 ); - BitmapEx aNewBmpEx(aNew); - BitmapFilter::Filter(aNewBmpEx, BitmapSimpleColorQuantizationFilter(m_xNmLayers->get_value())); - aNew = aNewBmpEx.GetBitmap(); + BitmapFilter::Filter(aNew, BitmapSimpleColorQuantizationFilter(m_xNmLayers->get_value())); return aNew; } diff --git a/svgio/source/svgreader/svgfeblendnode.cxx b/svgio/source/svgreader/svgfeblendnode.cxx index b5380b0a6fe4..d3fd2738f703 100644 --- a/svgio/source/svgreader/svgfeblendnode.cxx +++ b/svgio/source/svgreader/svgfeblendnode.cxx @@ -169,8 +169,8 @@ void SvgFeBlendNode::apply(drawinglayer::primitive2d::Primitive2DContainer& rTar } case Mode::Darken: { - BitmapDarkenBlendFilter aDarkenBlendFilter(aBmpEx2); - aResBmpEx = aDarkenBlendFilter.execute(aBmpEx); + BitmapDarkenBlendFilter aDarkenBlendFilter((Bitmap(aBmpEx2))); + aResBmpEx = aDarkenBlendFilter.execute(Bitmap(aBmpEx)); break; } case Mode::Lighten: diff --git a/svgio/source/svgreader/svgfecompositenode.cxx b/svgio/source/svgreader/svgfecompositenode.cxx index 9ca221e3f16e..d52312c1277c 100644 --- a/svgio/source/svgreader/svgfecompositenode.cxx +++ b/svgio/source/svgreader/svgfecompositenode.cxx @@ -255,14 +255,15 @@ void SvgFeCompositeNode::apply(drawinglayer::primitive2d::Primitive2DContainer& aBaseRange.getHeight(), aBaseRange.getWidth() * aBaseRange.getHeight()); } - BitmapArithmeticBlendFilter aArithmeticFilter(aBmpEx2, maK1.getNumber(), maK2.getNumber(), - maK3.getNumber(), maK4.getNumber()); - BitmapEx aResBmpEx = aArithmeticFilter.execute(aBmpEx); + BitmapArithmeticBlendFilter aArithmeticFilter(Bitmap(aBmpEx2), maK1.getNumber(), + maK2.getNumber(), maK3.getNumber(), + maK4.getNumber()); + Bitmap aResBmp = aArithmeticFilter.execute(Bitmap(aBmpEx)); const drawinglayer::primitive2d::Primitive2DReference xRef( new drawinglayer::primitive2d::BitmapPrimitive2D( - aResBmpEx, basegfx::utils::createScaleTranslateB2DHomMatrix( - aBaseRange.getRange(), aBaseRange.getMinimum()))); + BitmapEx(aResBmp), basegfx::utils::createScaleTranslateB2DHomMatrix( + aBaseRange.getRange(), aBaseRange.getMinimum()))); rTarget = drawinglayer::primitive2d::Primitive2DContainer{ xRef }; } } diff --git a/vcl/inc/bitmap/BitmapColorizeFilter.hxx b/vcl/inc/bitmap/BitmapColorizeFilter.hxx index 4dd7d3c0dcc7..08b1026f0cb3 100644 --- a/vcl/inc/bitmap/BitmapColorizeFilter.hxx +++ b/vcl/inc/bitmap/BitmapColorizeFilter.hxx @@ -22,7 +22,7 @@ public: { } - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: Color maColor; diff --git a/vcl/inc/bitmap/BitmapDisabledImageFilter.hxx b/vcl/inc/bitmap/BitmapDisabledImageFilter.hxx index 144c36f6e45c..ed843249dc3f 100644 --- a/vcl/inc/bitmap/BitmapDisabledImageFilter.hxx +++ b/vcl/inc/bitmap/BitmapDisabledImageFilter.hxx @@ -17,7 +17,7 @@ class VCL_DLLPUBLIC BitmapDisabledImageFilter final : public BitmapFilter public: BitmapDisabledImageFilter() {} - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/bitmap/BitmapDuoToneFilter.hxx b/vcl/inc/bitmap/BitmapDuoToneFilter.hxx index 4a8c5d1c5d91..b8cbff7b1684 100644 --- a/vcl/inc/bitmap/BitmapDuoToneFilter.hxx +++ b/vcl/inc/bitmap/BitmapDuoToneFilter.hxx @@ -21,7 +21,7 @@ public: { } - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: Color mnColorOne; diff --git a/vcl/inc/bitmap/BitmapFastScaleFilter.hxx b/vcl/inc/bitmap/BitmapFastScaleFilter.hxx index d4c9183046d1..4cdb2b32ce7c 100644 --- a/vcl/inc/bitmap/BitmapFastScaleFilter.hxx +++ b/vcl/inc/bitmap/BitmapFastScaleFilter.hxx @@ -21,7 +21,7 @@ public: { } - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: double mfScaleX; diff --git a/vcl/inc/bitmap/BitmapInterpolateScaleFilter.hxx b/vcl/inc/bitmap/BitmapInterpolateScaleFilter.hxx index cf63e5c2a719..591e0b9eaa80 100644 --- a/vcl/inc/bitmap/BitmapInterpolateScaleFilter.hxx +++ b/vcl/inc/bitmap/BitmapInterpolateScaleFilter.hxx @@ -21,7 +21,7 @@ public: { } - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: double mfScaleX; diff --git a/vcl/inc/bitmap/BitmapLightenFilter.hxx b/vcl/inc/bitmap/BitmapLightenFilter.hxx index c0be3356fe3f..225b94c7d10b 100644 --- a/vcl/inc/bitmap/BitmapLightenFilter.hxx +++ b/vcl/inc/bitmap/BitmapLightenFilter.hxx @@ -15,7 +15,7 @@ class BitmapLightenFilter final : public BitmapFilter { public: - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/bitmap/BitmapMaskToAlphaFilter.hxx b/vcl/inc/bitmap/BitmapMaskToAlphaFilter.hxx index 378898191eea..541dd068d27d 100644 --- a/vcl/inc/bitmap/BitmapMaskToAlphaFilter.hxx +++ b/vcl/inc/bitmap/BitmapMaskToAlphaFilter.hxx @@ -15,7 +15,7 @@ class BitmapMaskToAlphaFilter final : public BitmapFilter { public: - virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/bitmap/BitmapScaleConvolutionFilter.hxx b/vcl/inc/bitmap/BitmapScaleConvolutionFilter.hxx index 2370ff2246cd..da8ec32413a1 100644 --- a/vcl/inc/bitmap/BitmapScaleConvolutionFilter.hxx +++ b/vcl/inc/bitmap/BitmapScaleConvolutionFilter.hxx @@ -36,7 +36,7 @@ protected: { } - virtual BitmapEx execute(BitmapEx const& rBitmap) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: std::unique_ptr<Kernel> mxKernel; diff --git a/vcl/inc/bitmap/BitmapScaleSuperFilter.hxx b/vcl/inc/bitmap/BitmapScaleSuperFilter.hxx index d6c7a2097f04..dcfff9012807 100644 --- a/vcl/inc/bitmap/BitmapScaleSuperFilter.hxx +++ b/vcl/inc/bitmap/BitmapScaleSuperFilter.hxx @@ -27,7 +27,7 @@ public: BitmapScaleSuperFilter(const double& rScaleX, const double& rScaleY); virtual ~BitmapScaleSuperFilter() override; - virtual BitmapEx execute(BitmapEx const& rBitmap) const override; + virtual Bitmap execute(Bitmap const& rBitmap) const override; private: double mrScaleX; diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx index 449516759d6d..f7a566317f45 100644 --- a/vcl/inc/skia/salbmp.hxx +++ b/vcl/inc/skia/salbmp.hxx @@ -143,10 +143,6 @@ private: void EraseInternal(const Color& color); // Sets pixels to the erase color. void PerformErase(); - // Try to find out if the content is completely black. Used for optimizations, - // not guaranteed to always return true for such bitmaps. - bool IsAllBlack() const; - void ReleaseBuffer(BitmapBuffer* pBuffer, BitmapAccessMode nMode, bool dontChangeToErase); SkBitmap GetAsSkBitmap() const; bool ConserveMemory() const; void verify() const diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 89c8c98ef500..8aa92c15f760 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -216,7 +216,7 @@ template <> struct hash<ScaleCacheKey> } // end std namespace -typedef o3tl::lru_map<ScaleCacheKey, BitmapEx> lru_scale_cache; +typedef o3tl::lru_map<ScaleCacheKey, Bitmap> lru_scale_cache; struct ImplSVGDIData { diff --git a/vcl/qa/cppunit/BitmapFilterTest.cxx b/vcl/qa/cppunit/BitmapFilterTest.cxx index eace3bbde1bc..385a01315917 100644 --- a/vcl/qa/cppunit/BitmapFilterTest.cxx +++ b/vcl/qa/cppunit/BitmapFilterTest.cxx @@ -147,7 +147,7 @@ void BitmapFilterTest::testBlurCorrectness() // Perform blur BitmapFilterStackBlur aBlurFilter(2); - aBitmap24Bit = aBlurFilter.filter(aBitmap24Bit); + aBitmap24Bit = aBlurFilter.execute(aBitmap24Bit); // Check the result @@ -229,7 +229,7 @@ void BitmapFilterTest::testPerformance() for (int i = 0; i < nIterations; i++) { BitmapFilterStackBlur aBlurFilter(250); - aResult = aBlurFilter.filter(aBigBitmap); + aResult = aBlurFilter.execute(aBigBitmap); } auto end = std::chrono::high_resolution_clock::now(); auto elapsed = (end - start) / nIterations; @@ -443,31 +443,27 @@ void BitmapFilterTest::testDarkenBlendFilter() aWriteAccess->Erase(COL_AUTO); } - BitmapEx aRedBitmapEx(aRedBitmap); - BitmapEx aGreenBitmapEx(aGreenBitmap); - BitmapEx aTransparentBitmapEx(aTransparentBitmap); - // same color { - BitmapDarkenBlendFilter aArithmeticFilter(aRedBitmapEx); - BitmapEx aResBitmapEx = aArithmeticFilter.execute(aRedBitmapEx); - CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmapEx.GetPixelColor(2, 2)); + BitmapDarkenBlendFilter aArithmeticFilter(aRedBitmap); + Bitmap aResBitmap = aArithmeticFilter.execute(aRedBitmap); + CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmap.GetPixelColor(2, 2)); } // different color { - BitmapDarkenBlendFilter aArithmeticFilter(aGreenBitmapEx); - BitmapEx aResBitmapEx = aArithmeticFilter.execute(aRedBitmapEx); + BitmapDarkenBlendFilter aArithmeticFilter(aGreenBitmap); + Bitmap aResBitmap = aArithmeticFilter.execute(aRedBitmap); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xFF, 0x00, 0x00, 0x00), - aResBitmapEx.GetPixelColor(2, 2)); + aResBitmap.GetPixelColor(2, 2)); } // transparent { - BitmapDarkenBlendFilter aArithmeticFilter(aTransparentBitmapEx); - BitmapEx aResBitmapEx = aArithmeticFilter.execute(aRedBitmapEx); + BitmapDarkenBlendFilter aArithmeticFilter(aTransparentBitmap); + Bitmap aResBitmap = aArithmeticFilter.execute(aRedBitmap); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xFF, 0xFF, 0x00, 0x00), - aResBitmapEx.GetPixelColor(2, 2)); + aResBitmap.GetPixelColor(2, 2)); } } @@ -602,215 +598,207 @@ void BitmapFilterTest::testArithmeticBlendFilter() aWriteAccess->Erase(COL_AUTO); } - BitmapEx aRedBitmapEx(aRedBitmap); - BitmapEx aGreenBitmapEx(aGreenBitmap); - BitmapEx aTransparentBitmapEx(aTransparentBitmap); - // same color { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, BitmapArithmeticBlendFilter(aRedBitmapEx, 0, 0, 0, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, BitmapArithmeticBlendFilter(aRedBitmap, 0, 0, 0, 0)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0x00, 0x00, 0x00, 0x00), - aResBitmapEx.GetPixelColor(0, 0)); + aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, BitmapArithmeticBlendFilter(aRedBitmapEx, 1, 0, 0, 0)); - CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmapEx.GetPixelColor(0, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, BitmapArithmeticBlendFilter(aRedBitmap, 1, 0, 0, 0)); + CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, BitmapArithmeticBlendFilter(aRedBitmapEx, 0, 1, 0, 0)); - CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmapEx.GetPixelColor(0, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, BitmapArithmeticBlendFilter(aRedBitmap, 0, 1, 0, 0)); + CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, BitmapArithmeticBlendFilter(aRedBitmapEx, 0, 0, 1, 0)); - CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmapEx.GetPixelColor(0, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, BitmapArithmeticBlendFilter(aRedBitmap, 0, 0, 1, 0)); + CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, BitmapArithmeticBlendFilter(aRedBitmapEx, 0, 0, 0, 1)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, BitmapArithmeticBlendFilter(aRedBitmap, 0, 0, 0, 1)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xFF, 0xFF, 0xFF, 0xFF), - aResBitmapEx.GetPixelColor(0, 0)); + aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, BitmapArithmeticBlendFilter(aRedBitmapEx, 0.5, 0, 0, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, BitmapArithmeticBlendFilter(aRedBitmap, 0.5, 0, 0, 0)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0x7F, 0xFF, 0x00, 0x00), - aResBitmapEx.GetPixelColor(0, 0)); + aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, BitmapArithmeticBlendFilter(aRedBitmapEx, 0, 0.5, 0, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, BitmapArithmeticBlendFilter(aRedBitmap, 0, 0.5, 0, 0)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0x7F, 0xFF, 0x00, 0x00), - aResBitmapEx.GetPixelColor(0, 0)); + aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, BitmapArithmeticBlendFilter(aRedBitmapEx, 0, 0, 0.5, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, BitmapArithmeticBlendFilter(aRedBitmap, 0, 0, 0.5, 0)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0x7F, 0xFF, 0x00, 0x00), - aResBitmapEx.GetPixelColor(0, 0)); + aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, BitmapArithmeticBlendFilter(aRedBitmapEx, 0, 0, 0, 0.5)); + BitmapEx aResBitmapEx(aRedBitmap); + BitmapFilter::Filter(aResBitmapEx, BitmapArithmeticBlendFilter(aRedBitmap, 0, 0, 0, 0.5)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0x7F, 0xFF, 0xFF, 0xFF), aResBitmapEx.GetPixelColor(0, 0)); } // Different colors { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, BitmapArithmeticBlendFilter(aGreenBitmapEx, 0, 0, 0, 0)); + BitmapEx aResBitmapEx(aRedBitmap); + BitmapFilter::Filter(aResBitmapEx, BitmapArithmeticBlendFilter(aGreenBitmap, 0, 0, 0, 0)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0x00, 0x00, 0x00, 0x00), aResBitmapEx.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, BitmapArithmeticBlendFilter(aGreenBitmapEx, 1, 0, 0, 0)); + BitmapEx aResBitmapEx(aRedBitmap); + BitmapFilter::Filter(aResBitmapEx, BitmapArithmeticBlendFilter(aGreenBitmap, 1, 0, 0, 0)); CPPUNIT_ASSERT_EQUAL(COL_BLACK, aResBitmapEx.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, BitmapArithmeticBlendFilter(aGreenBitmapEx, 0, 1, 0, 0)); - CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmapEx.GetPixelColor(0, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, BitmapArithmeticBlendFilter(aGreenBitmap, 0, 1, 0, 0)); + CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, BitmapArithmeticBlendFilter(aGreenBitmapEx, 0, 0, 1, 0)); - CPPUNIT_ASSERT_EQUAL(COL_GREEN, aResBitmapEx.GetPixelColor(0, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, BitmapArithmeticBlendFilter(aGreenBitmap, 0, 0, 1, 0)); + CPPUNIT_ASSERT_EQUAL(COL_GREEN, aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, BitmapArithmeticBlendFilter(aGreenBitmapEx, 0, 0, 0, 1)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, BitmapArithmeticBlendFilter(aGreenBitmap, 0, 0, 0, 1)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xFF, 0xFF, 0xFF, 0xFF), - aResBitmapEx.GetPixelColor(0, 0)); + aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, - BitmapArithmeticBlendFilter(aGreenBitmapEx, 0.5, 0, 0, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, BitmapArithmeticBlendFilter(aGreenBitmap, 0.5, 0, 0, 0)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0x7F, 0x00, 0x00, 0x00), - aResBitmapEx.GetPixelColor(0, 0)); + aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, - BitmapArithmeticBlendFilter(aGreenBitmapEx, 0, 0.5, 0, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, BitmapArithmeticBlendFilter(aGreenBitmap, 0, 0.5, 0, 0)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0x7F, 0xFF, 0x00, 0x00), - aResBitmapEx.GetPixelColor(0, 0)); + aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, - BitmapArithmeticBlendFilter(aGreenBitmapEx, 0, 0, 0.5, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, BitmapArithmeticBlendFilter(aGreenBitmap, 0, 0, 0.5, 0)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0x7F, 0x00, 0x81, 0x00), - aResBitmapEx.GetPixelColor(0, 0)); + aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, - BitmapArithmeticBlendFilter(aGreenBitmapEx, 0, 0, 0, 0.5)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, BitmapArithmeticBlendFilter(aGreenBitmap, 0, 0, 0, 0.5)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0x7F, 0xFF, 0xFF, 0xFF), - aResBitmapEx.GetPixelColor(0, 0)); + aResBitmap.GetPixelColor(0, 0)); } // transparent { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, - BitmapArithmeticBlendFilter(aTransparentBitmapEx, 0, 0, 0, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, + BitmapArithmeticBlendFilter(aTransparentBitmap, 0, 0, 0, 0)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0x00, 0x00, 0x00, 0x00), - aResBitmapEx.GetPixelColor(0, 0)); + aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, - BitmapArithmeticBlendFilter(aTransparentBitmapEx, 1, 0, 0, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, + BitmapArithmeticBlendFilter(aTransparentBitmap, 1, 0, 0, 0)); - CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmapEx.GetPixelColor(0, 0)); + CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, - BitmapArithmeticBlendFilter(aTransparentBitmapEx, 0, 1, 0, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, + BitmapArithmeticBlendFilter(aTransparentBitmap, 0, 1, 0, 0)); - CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmapEx.GetPixelColor(0, 0)); + CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, - BitmapArithmeticBlendFilter(aTransparentBitmapEx, 0, 0, 1, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, + BitmapArithmeticBlendFilter(aTransparentBitmap, 0, 0, 1, 0)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xFF, 0xFF, 0xFF, 0xFF), - aResBitmapEx.GetPixelColor(0, 0)); + aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, - BitmapArithmeticBlendFilter(aTransparentBitmapEx, 0, 0, 0, 1)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, + BitmapArithmeticBlendFilter(aTransparentBitmap, 0, 0, 0, 1)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xFF, 0xFF, 0xFF, 0xFF), - aResBitmapEx.GetPixelColor(0, 0)); + aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, - BitmapArithmeticBlendFilter(aTransparentBitmapEx, 0.5, 0, 0, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, + BitmapArithmeticBlendFilter(aTransparentBitmap, 0.5, 0, 0, 0)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0x7F, 0xFF, 0x00, 0x00), - aResBitmapEx.GetPixelColor(0, 0)); + aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, - BitmapArithmeticBlendFilter(aTransparentBitmapEx, 0, 0.5, 0, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, + BitmapArithmeticBlendFilter(aTransparentBitmap, 0, 0.5, 0, 0)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0x7F, 0xFF, 0x00, 0x00), - aResBitmapEx.GetPixelColor(0, 0)); + aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, - BitmapArithmeticBlendFilter(aTransparentBitmapEx, 0, 0, 0.5, 0)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, + BitmapArithmeticBlendFilter(aTransparentBitmap, 0, 0, 0.5, 0)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0x7F, 0xFF, 0xFF, 0xFF), - aResBitmapEx.GetPixelColor(0, 0)); + aResBitmap.GetPixelColor(0, 0)); } { - BitmapEx aResBitmapEx(aRedBitmapEx); - BitmapFilter::Filter(aResBitmapEx, - BitmapArithmeticBlendFilter(aTransparentBitmapEx, 0, 0, 0, 0.5)); + Bitmap aResBitmap(aRedBitmap); + BitmapFilter::Filter(aResBitmap, + BitmapArithmeticBlendFilter(aTransparentBitmap, 0, 0, 0, 0.5)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0x7F, 0xFF, 0xFF, 0xFF), - aResBitmapEx.GetPixelColor(0, 0)); + aResBitmap.GetPixelColor(0, 0)); } } diff --git a/vcl/qa/cppunit/BitmapProcessorTest.cxx b/vcl/qa/cppunit/BitmapProcessorTest.cxx index 874419092d30..efc3f8aa71b5 100644 --- a/vcl/qa/cppunit/BitmapProcessorTest.cxx +++ b/vcl/qa/cppunit/BitmapProcessorTest.cxx @@ -37,9 +37,8 @@ void BitmapProcessorTest::testDisabledImage() BitmapScopedWriteAccess pWriteAccess(aBitmap); pWriteAccess->Erase(Color(ColorTransparency, 0x00, 0x00, 0xFF, 0x00)); } - BitmapEx aBitmapEx(aBitmap); BitmapDisabledImageFilter aDisabledImageFilter; - BitmapEx aDisabledBitmapEx(aDisabledImageFilter.execute(aBitmapEx)); + BitmapEx aDisabledBitmapEx(aDisabledImageFilter.execute(aBitmap)); Bitmap aDisabledBitmap(aDisabledBitmapEx.GetBitmap()); { BitmapScopedReadAccess pReadAccess(aDisabledBitmap); @@ -62,19 +61,11 @@ void BitmapProcessorTest::testDisabledImage() BitmapEx aBitmapEx(aBitmap, aMask); BitmapDisabledImageFilter aDisabledImageFilter; - BitmapEx aDisabledBitmapEx(aDisabledImageFilter.execute(aBitmapEx)); - - Bitmap aDisabledBitmap(aDisabledBitmapEx.GetBitmap()); + Bitmap aDisabledBitmap(aDisabledImageFilter.execute(Bitmap(aBitmapEx))); { BitmapScopedReadAccess pReadAccess(aDisabledBitmap); Color aColor(pReadAccess->GetPixel(0, 0)); - CPPUNIT_ASSERT_EQUAL(Color(0x00C5C5C5), aColor); - } - AlphaMask aDisabledAlphaMask(aDisabledBitmapEx.GetAlphaMask()); - { - BitmapScopedReadAccess pReadAccess(aDisabledAlphaMask); - Color aColor(pReadAccess->GetPixel(0, 0)); - CPPUNIT_ASSERT_EQUAL(Color(0x0000AA), aColor); + CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xAA, 0xC5, 0xC5, 0xC5), aColor); } } } diff --git a/vcl/qa/cppunit/png/PngFilterTest.cxx b/vcl/qa/cppunit/png/PngFilterTest.cxx index 2f2cf258089b..231eb0b96987 100644 --- a/vcl/qa/cppunit/png/PngFilterTest.cxx +++ b/vcl/qa/cppunit/png/PngFilterTest.cxx @@ -2035,10 +2035,10 @@ void PngFilterTest::testTdf153180MonochromeFilterPngExport() BitmapEx aBitmapEx(aGraphicOriginal.GetBitmapEx()); AlphaMask aAlphaMask(aBitmapEx.GetAlphaMask()); - BitmapEx aTmpBmpEx(aBitmapEx.GetBitmap()); - BitmapFilter::Filter(aTmpBmpEx, BitmapMonochromeFilter{ sal_uInt8{ 127 } }); + Bitmap aTmpBmp(aBitmapEx.GetBitmap()); + BitmapFilter::Filter(aTmpBmp, BitmapMonochromeFilter{ sal_uInt8{ 127 } }); - Graphic aGraphicAfterFilter{ BitmapEx(aTmpBmpEx.GetBitmap(), aAlphaMask) }; + Graphic aGraphicAfterFilter{ BitmapEx(aTmpBmp, aAlphaMask) }; CPPUNIT_ASSERT(aGraphicAfterFilter.IsAlpha()); // export the resulting graphic diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx index c12d08bb9aac..1fe62570feff 100644 --- a/vcl/skia/salbmp.cxx +++ b/vcl/skia/salbmp.cxx @@ -326,12 +326,6 @@ BitmapBuffer* SkiaSalBitmap::AcquireBuffer(BitmapAccessMode nMode) } void SkiaSalBitmap::ReleaseBuffer(BitmapBuffer* pBuffer, BitmapAccessMode nMode) -{ - ReleaseBuffer(pBuffer, nMode, false); -} - -void SkiaSalBitmap::ReleaseBuffer(BitmapBuffer* pBuffer, BitmapAccessMode nMode, - bool dontChangeToErase) { if (nMode == BitmapAccessMode::Write) { @@ -355,62 +349,6 @@ void SkiaSalBitmap::ReleaseBuffer(BitmapBuffer* pBuffer, BitmapAccessMode nMode, assert(pBuffer->mpBits == mBuffer.get() || nMode == BitmapAccessMode::Info); verify(); delete pBuffer; - if (nMode == BitmapAccessMode::Write && !dontChangeToErase) - { - // This saves memory and is also used by IsFullyOpaqueAsAlpha() to avoid unnecessary - // alpha blending. - if (IsAllBlack()) - { - SAL_INFO("vcl.skia.trace", "releasebuffer(" << this << "): erasing to black"); - EraseInternal(COL_BLACK); - } - } -} - -static bool isAllZero(const sal_uInt8* data, size_t size) -{ // For performance, check in larger data chunks. -#ifdef UINT64_MAX - const int64_t* d = reinterpret_cast<const int64_t*>(data); -#else - const int32_t* d = reinterpret_cast<const int32_t*>(data); -#endif - constexpr size_t step = sizeof(*d) * 8; - for (size_t i = 0; i < size / step; ++i) - { // Unrolled loop. - if (d[0] != 0) - return false; - if (d[1] != 0) - return false; - if (d[2] != 0) - return false; - if (d[3] != 0) - return false; - if (d[4] != 0) - return false; - if (d[5] != 0) - return false; - if (d[6] != 0) - return false; - if (d[7] != 0) - return false; - d += 8; - } - for (size_t i = size / step * step; i < size; ++i) - if (data[i] != 0) - return false; - return true; -} - -bool SkiaSalBitmap::IsAllBlack() const -{ - if (mBitCount % 8 != 0 || (!!mPalette && mPalette[0] != COL_BLACK)) - return false; // Don't bother. - if (mSize.Width() * mBitCount / 8 == mScanlineSize) - return isAllZero(mBuffer.get(), mScanlineSize * mSize.Height()); - for (tools::Long y = 0; y < mSize.Height(); ++y) - if (!isAllZero(mBuffer.get() + mScanlineSize * y, mSize.Width() * mBitCount / 8)) - return false; - return true; } bool SkiaSalBitmap::GetSystemData(BitmapSystemData&) @@ -1151,7 +1089,7 @@ void SkiaSalBitmap::PerformErase() memcpy(scanline + y * bitmapBuffer->mnScanlineSize, scanline, bitmapBuffer->mnScanlineSize); } - ReleaseBuffer(bitmapBuffer, BitmapAccessMode::Write, true); + ReleaseBuffer(bitmapBuffer, BitmapAccessMode::Write); } void SkiaSalBitmap::EnsureBitmapData() diff --git a/vcl/source/bitmap/BitmapAlphaClampFilter.cxx b/vcl/source/bitmap/BitmapAlphaClampFilter.cxx index a12ee67cc145..68061d4e37d6 100644 --- a/vcl/source/bitmap/BitmapAlphaClampFilter.cxx +++ b/vcl/source/bitmap/BitmapAlphaClampFilter.cxx @@ -11,33 +11,33 @@ #include <vcl/bitmap/BitmapAlphaClampFilter.hxx> #include <vcl/BitmapWriteAccess.hxx> -BitmapEx BitmapAlphaClampFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapAlphaClampFilter::execute(Bitmap const& rBitmap) const { - if (!rBitmapEx.IsAlpha()) - return rBitmapEx; + if (!rBitmap.HasAlpha()) + return rBitmap; - AlphaMask aBitmapAlpha(rBitmapEx.GetAlphaMask()); + Bitmap aNewBitmap(rBitmap); { - BitmapScopedWriteAccess pWriteAlpha(aBitmapAlpha); - const Size aSize(rBitmapEx.GetSizePixel()); + BitmapScopedWriteAccess pWriteAcc(aNewBitmap); + const Size aSize(aNewBitmap.GetSizePixel()); for (sal_Int32 nY = 0; nY < sal_Int32(aSize.Height()); ++nY) { - Scanline pScanAlpha = pWriteAlpha->GetScanline(nY); + Scanline pScan = pWriteAcc->GetScanline(nY); for (sal_Int32 nX = 0; nX < sal_Int32(aSize.Width()); ++nX) { - BitmapColor aBitmapAlphaValue(pWriteAlpha->GetPixelFromData(pScanAlpha, nX)); - if ((255 - aBitmapAlphaValue.GetIndex()) > mcThreshold) + BitmapColor aBitmapValue(pWriteAcc->GetPixelFromData(pScan, nX)); + if ((255 - aBitmapValue.GetAlpha()) > mcThreshold) { - aBitmapAlphaValue.SetIndex(0); - pWriteAlpha->SetPixelOnData(pScanAlpha, nX, aBitmapAlphaValue); + aBitmapValue.SetAlpha(0); + pWriteAcc->SetPixelOnData(pScan, nX, aBitmapValue); } } } } - return BitmapEx(rBitmapEx.GetBitmap(), aBitmapAlpha); + return aNewBitmap; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapArithmeticBlendFilter.cxx b/vcl/source/bitmap/BitmapArithmeticBlendFilter.cxx index c63d7d23d8cc..53612b097d0d 100644 --- a/vcl/source/bitmap/BitmapArithmeticBlendFilter.cxx +++ b/vcl/source/bitmap/BitmapArithmeticBlendFilter.cxx @@ -14,9 +14,9 @@ #include <vcl/BitmapWriteAccess.hxx> #include <vcl/BitmapTools.hxx> -BitmapArithmeticBlendFilter::BitmapArithmeticBlendFilter(BitmapEx const& rBitmapEx2, double nK1, +BitmapArithmeticBlendFilter::BitmapArithmeticBlendFilter(Bitmap const& rBitmap2, double nK1, double nK2, double nK3, double nK4) - : maBitmapEx2(rBitmapEx2) + : maBitmap2(rBitmap2) , mnK1(nK1) , mnK2(nK2) , mnK3(nK3) @@ -36,31 +36,34 @@ static sal_uInt8 lcl_calculate(const sal_uInt8 cColor, const sal_uInt8 cColor2, return std::clamp(result, 0.0, 1.0) * 255.0; } -BitmapEx BitmapArithmeticBlendFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapArithmeticBlendFilter::execute(Bitmap const& rBitmap) const { - if (rBitmapEx.IsEmpty() || maBitmapEx2.IsEmpty()) - return BitmapEx(); + if (rBitmap.IsEmpty() || maBitmap2.IsEmpty()) + return Bitmap(); - const Size aSize = rBitmapEx.GetBitmap().GetSizePixel(); - const Size aSize2 = maBitmapEx2.GetBitmap().GetSizePixel(); + const Size aSize = rBitmap.GetSizePixel(); + const Size aSize2 = maBitmap2.GetSizePixel(); const sal_Int32 nHeight = std::min(aSize.getHeight(), aSize2.getHeight()); const sal_Int32 nWidth = std::min(aSize.getWidth(), aSize2.getWidth()); - Bitmap aDstBitmap(Size(nWidth, nHeight), vcl::PixelFormat::N24_BPP); - Bitmap aDstAlpha(AlphaMask(Size(nWidth, nHeight)).GetBitmap()); + Bitmap aDstBitmap(Size(nWidth, nHeight), vcl::PixelFormat::N32_BPP); BitmapScopedWriteAccess pWriteAccess(aDstBitmap); - BitmapScopedWriteAccess pAlphaWriteAccess(aDstAlpha); + BitmapScopedReadAccess pReadAccess1(rBitmap); + BitmapScopedReadAccess pReadAccess2(maBitmap2); for (tools::Long y = 0; y < nHeight; ++y) { - Scanline pScanline = pWriteAccess->GetScanline(y); - Scanline pScanAlpha = pAlphaWriteAccess->GetScanline(y); + Scanline pWriteScanline = pWriteAccess->GetScanline(y); + Scanline pReadScanline1 = pReadAccess1->GetScanline(y); + Scanline pReadScanline2 = pReadAccess2->GetScanline(y); for (tools::Long x = 0; x < nWidth; ++x) { - const BitmapColor i1 = vcl::bitmap::premultiply(rBitmapEx.GetPixelColor(x, y)); - const BitmapColor i2 = vcl::bitmap::premultiply(maBitmapEx2.GetPixelColor(x, y)); + const BitmapColor i1 + = vcl::bitmap::premultiply(pReadAccess1->GetPixelFromData(pReadScanline1, x)); + const BitmapColor i2 + = vcl::bitmap::premultiply(pReadAccess2->GetPixelFromData(pReadScanline2, x)); const sal_uInt8 r(lcl_calculate(i1.GetRed(), i2.GetRed(), mnK1, mnK2, mnK3, mnK4)); const sal_uInt8 g(lcl_calculate(i1.GetGreen(), i2.GetGreen(), mnK1, mnK2, mnK3, mnK4)); @@ -68,15 +71,15 @@ BitmapEx BitmapArithmeticBlendFilter::execute(BitmapEx const& rBitmapEx) const const sal_uInt8 a(lcl_calculate(i1.GetAlpha(), i2.GetAlpha(), mnK1, mnK2, mnK3, mnK4)); pWriteAccess->SetPixelOnData( - pScanline, x, vcl::bitmap::unpremultiply(BitmapColor(ColorAlpha, r, g, b, a))); - pAlphaWriteAccess->SetPixelOnData(pScanAlpha, x, BitmapColor(a)); + pWriteScanline, x, vcl::bitmap::unpremultiply(BitmapColor(ColorAlpha, r, g, b, a))); } } pWriteAccess.reset(); - pAlphaWriteAccess.reset(); + pReadAccess1.reset(); + pReadAccess2.reset(); - return BitmapEx(aDstBitmap, AlphaMask(aDstAlpha)); + return aDstBitmap; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx b/vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx index 866583d07a1e..7da9e9cf3fb8 100644 --- a/vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx +++ b/vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx @@ -330,13 +330,7 @@ BitmapBasicMorphologyFilter::BitmapBasicMorphologyFilter(BasicMorphologyOp op, s BitmapBasicMorphologyFilter::~BitmapBasicMorphologyFilter() = default; -BitmapEx BitmapBasicMorphologyFilter::execute(BitmapEx const& rBitmapEx) const -{ - Bitmap result = filter(rBitmapEx.GetBitmap()); - return BitmapEx(result, rBitmapEx.GetAlphaMask()); -} - -Bitmap BitmapBasicMorphologyFilter::filter(Bitmap const& rBitmap) const +Bitmap BitmapBasicMorphologyFilter::execute(Bitmap const& rBitmap) const { Bitmap bitmapCopy(rBitmap); ScanlineFormat nScanlineFormat; diff --git a/vcl/source/bitmap/BitmapColorQuantizationFilter.cxx b/vcl/source/bitmap/BitmapColorQuantizationFilter.cxx index 500d3d22569b..9edd64821695 100644 --- a/vcl/source/bitmap/BitmapColorQuantizationFilter.cxx +++ b/vcl/source/bitmap/BitmapColorQuantizationFilter.cxx @@ -16,16 +16,16 @@ #include <algorithm> #include <cstdlib> -BitmapEx BitmapColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) const +Bitmap BitmapColorQuantizationFilter::execute(Bitmap const& rBitmap) const { - Bitmap aBitmap = aBitmapEx.GetBitmap(); + Bitmap aBitmap = rBitmap; if (vcl::numberOfColors(aBitmap.getPixelFormat()) <= sal_Int64(mnNewColorCount)) - return BitmapEx(aBitmap); + return aBitmap; BitmapScopedReadAccess pRAcc(aBitmap); if (!pRAcc) - return BitmapEx(); + return Bitmap(); const sal_uInt32 nValidBits = 4; const sal_uInt32 nColorsPerComponent = 1 << nValidBits; @@ -124,7 +124,7 @@ BitmapEx BitmapColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) const Bitmap aNewBmp(aBitmap.GetSizePixel(), vcl::PixelFormat::N8_BPP, &aNewPal); BitmapScopedWriteAccess pWAcc(aNewBmp); if (!pWAcc) - return BitmapEx(); + return Bitmap(); BitmapColor aDstCol(sal_uInt8(0)); std::unique_ptr<sal_uInt8[]> pIndexMap(new sal_uInt8[nTotalColors]); @@ -195,7 +195,7 @@ BitmapEx BitmapColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) const aBitmap.SetPrefMapMode(aMap); aBitmap.SetPrefSize(aSize); - return BitmapEx(aBitmap); + return aBitmap; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapColorizeFilter.cxx b/vcl/source/bitmap/BitmapColorizeFilter.cxx index 0b9a2028d91d..4ae6417d6281 100644 --- a/vcl/source/bitmap/BitmapColorizeFilter.cxx +++ b/vcl/source/bitmap/BitmapColorizeFilter.cxx @@ -14,13 +14,13 @@ #include <vcl/BitmapWriteAccess.hxx> #include <bitmap/BitmapColorizeFilter.hxx> -BitmapEx BitmapColorizeFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapColorizeFilter::execute(Bitmap const& rBitmap) const { - Bitmap aBitmap = rBitmapEx.GetBitmap(); + Bitmap aBitmap = rBitmap; BitmapScopedWriteAccess pWriteAccess(aBitmap); if (!pWriteAccess) - return rBitmapEx; + return rBitmap; std::vector<sal_uInt8> aMapR(256); std::vector<sal_uInt8> aMapG(256); @@ -90,7 +90,7 @@ BitmapEx BitmapColorizeFilter::execute(BitmapEx const& rBitmapEx) const } } - return rBitmapEx; + return aBitmap; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx b/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx index 6d49449cad7c..37d97157405c 100644 --- a/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx +++ b/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx @@ -16,18 +16,18 @@ #include <array> -BitmapEx BitmapConvolutionMatrixFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapConvolutionMatrixFilter::execute(Bitmap const& rBitmap) const { - Bitmap aBitmap(rBitmapEx.GetBitmap()); + Bitmap aBitmap(rBitmap); BitmapScopedReadAccess pReadAcc(aBitmap); if (!pReadAcc) - return BitmapEx(); + return Bitmap(); Bitmap aNewBmp(aBitmap.GetSizePixel(), vcl::PixelFormat::N24_BPP); BitmapScopedWriteAccess pWriteAcc(aNewBmp); if (!pWriteAcc) - return BitmapEx(); + return Bitmap(); std::array<std::array<sal_Int32, 256>, 9> aCoeff; @@ -189,7 +189,7 @@ BitmapEx BitmapConvolutionMatrixFilter::execute(BitmapEx const& rBitmapEx) const aBitmap.SetPrefMapMode(aMap); aBitmap.SetPrefSize(aPrefSize); - return BitmapEx(aBitmap); + return aBitmap; } const sal_Int32 g_SharpenMatrix[] = { -1, -1, -1, -1, 16, -1, -1, -1, -1 }; diff --git a/vcl/source/bitmap/BitmapDarkenBlendFilter.cxx b/vcl/source/bitmap/BitmapDarkenBlendFilter.cxx index 7e25528b5f6c..df58a3f8bc5f 100644 --- a/vcl/source/bitmap/BitmapDarkenBlendFilter.cxx +++ b/vcl/source/bitmap/BitmapDarkenBlendFilter.cxx @@ -14,8 +14,8 @@ #include <vcl/BitmapWriteAccess.hxx> #include <vcl/BitmapTools.hxx> -BitmapDarkenBlendFilter::BitmapDarkenBlendFilter(BitmapEx const& rBitmapBlendEx) - : maBlendBitmapBitmapEx(rBitmapBlendEx) +BitmapDarkenBlendFilter::BitmapDarkenBlendFilter(Bitmap const& rBitmapBlend) + : maBlendBitmapBitmap(rBitmapBlend) { } @@ -30,31 +30,28 @@ static sal_uInt8 lcl_calculate(const sal_uInt8 aColor, const sal_uInt8 aAlpha, return result * 255.0; } -BitmapEx BitmapDarkenBlendFilter::execute(BitmapEx const& rBitmapBlendEx) const +Bitmap BitmapDarkenBlendFilter::execute(Bitmap const& rBitmapBlend) const { - if (rBitmapBlendEx.IsEmpty() || maBlendBitmapBitmapEx.IsEmpty()) - return BitmapEx(); + if (rBitmapBlend.IsEmpty() || maBlendBitmapBitmap.IsEmpty()) + return Bitmap(); - const Size aSize = rBitmapBlendEx.GetBitmap().GetSizePixel(); - const Size aSize2 = maBlendBitmapBitmapEx.GetBitmap().GetSizePixel(); + const Size aSize = rBitmapBlend.GetSizePixel(); + const Size aSize2 = maBlendBitmapBitmap.GetSizePixel(); const sal_Int32 nHeight = std::min(aSize.getHeight(), aSize2.getHeight()); const sal_Int32 nWidth = std::min(aSize.getWidth(), aSize2.getWidth()); - Bitmap aDstBitmap(Size(nWidth, nHeight), vcl::PixelFormat::N24_BPP); - Bitmap aDstAlpha(AlphaMask(Size(nWidth, nHeight)).GetBitmap()); + Bitmap aDstBitmap(Size(nWidth, nHeight), vcl::PixelFormat::N32_BPP); BitmapScopedWriteAccess pWriteAccess(aDstBitmap); - BitmapScopedWriteAccess pAlphaWriteAccess(aDstAlpha); for (tools::Long y(0); y < nHeight; ++y) { Scanline pScanline = pWriteAccess->GetScanline(y); - Scanline pScanAlpha = pAlphaWriteAccess->GetScanline(y); for (tools::Long x(0); x < nWidth; ++x) { - const BitmapColor i1 = vcl::bitmap::premultiply(rBitmapBlendEx.GetPixelColor(x, y)); + const BitmapColor i1 = vcl::bitmap::premultiply(rBitmapBlend.GetPixelColor(x, y)); const BitmapColor i2 - = vcl::bitmap::premultiply(maBlendBitmapBitmapEx.GetPixelColor(x, y)); + = vcl::bitmap::premultiply(maBlendBitmapBitmap.GetPixelColor(x, y)); const sal_uInt8 r( lcl_calculate(i1.GetRed(), i1.GetAlpha(), i2.GetRed(), i2.GetAlpha())); const sal_uInt8 g( @@ -66,14 +63,12 @@ BitmapEx BitmapDarkenBlendFilter::execute(BitmapEx const& rBitmapBlendEx) const pWriteAccess->SetPixelOnData( pScanline, x, vcl::bitmap::unpremultiply(BitmapColor(ColorAlpha, r, g, b, a))); - pAlphaWriteAccess->SetPixelOnData(pScanAlpha, x, BitmapColor(a)); } } pWriteAccess.reset(); - pAlphaWriteAccess.reset(); - return BitmapEx(aDstBitmap, AlphaMask(aDstAlpha)); + return aDstBitmap; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapDisabledImageFilter.cxx b/vcl/source/bitmap/BitmapDisabledImageFilter.cxx index 829ddb7c01fa..e402f27fcea3 100644 --- a/vcl/source/bitmap/BitmapDisabledImageFilter.cxx +++ b/vcl/source/bitmap/BitmapDisabledImageFilter.cxx @@ -11,13 +11,13 @@ #include <vcl/BitmapWriteAccess.hxx> #include <bitmap/BitmapDisabledImageFilter.hxx> -BitmapEx BitmapDisabledImageFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapDisabledImageFilter::execute(Bitmap const& rBitmap) const { - const Size aSize(rBitmapEx.GetSizePixel()); + const Size aSize(rBitmap.GetSizePixel()); // keep disable image at same depth as original where possible, otherwise // use 8 bit - auto ePixelFormat = rBitmapEx.getPixelFormat(); + auto ePixelFormat = rBitmap.getPixelFormat(); if (sal_uInt16(ePixelFormat) < 8) ePixelFormat = vcl::PixelFormat::N8_BPP; @@ -26,8 +26,7 @@ BitmapEx BitmapDisabledImageFilter::execute(BitmapEx const& rBitmapEx) const Bitmap aGrey(aSize, ePixelFormat, pPal); BitmapScopedWriteAccess pGrey(aGrey); - const Bitmap& aReadBitmap(rBitmapEx.GetBitmap()); - BitmapScopedReadAccess pRead(aReadBitmap); + BitmapScopedReadAccess pRead(rBitmap); if (pRead && pGrey) { for (sal_Int32 nY = 0; nY < sal_Int32(aSize.Height()); ++nY) @@ -46,10 +45,7 @@ BitmapEx BitmapDisabledImageFilter::execute(BitmapEx const& rBitmapEx) const } } - if (rBitmapEx.IsAlpha()) - return BitmapEx(aGrey, rBitmapEx.GetAlphaMask()); - - return BitmapEx(aGrey); + return aGrey; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapDuoToneFilter.cxx b/vcl/source/bitmap/BitmapDuoToneFilter.cxx index 7e7a5c0bb82f..30d7f9310076 100644 --- a/vcl/source/bitmap/BitmapDuoToneFilter.cxx +++ b/vcl/source/bitmap/BitmapDuoToneFilter.cxx @@ -20,9 +20,9 @@ static sal_uInt8 lcl_getDuotoneColorComponent(sal_uInt8 base, sal_uInt16 color1, return static_cast<sal_uInt8>(color1 + color2); } -BitmapEx BitmapDuoToneFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapDuoToneFilter::execute(Bitmap const& rBitmap) const { - Bitmap aBitmap(rBitmapEx.GetBitmap()); + Bitmap aBitmap(rBitmap); const sal_Int32 nWidth = aBitmap.GetSizePixel().Width(); const sal_Int32 nHeight = aBitmap.GetSizePixel().Height(); @@ -52,7 +52,7 @@ BitmapEx BitmapDuoToneFilter::execute(BitmapEx const& rBitmapEx) const pReadAcc.reset(); aBitmap.ReassignWithSize(aResultBitmap); - return BitmapEx(aBitmap); + return aBitmap; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx index cb5c81438c9f..9c7be0ee843c 100644 --- a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx +++ b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx @@ -17,21 +17,21 @@ #include <algorithm> -BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapEmbossGreyFilter::execute(Bitmap const& rBitmap) const { - Bitmap aBitmap(rBitmapEx.GetBitmap()); + Bitmap aBitmap(rBitmap); if (!aBitmap.ImplMakeGreyscales()) - return BitmapEx(); + return Bitmap(); BitmapScopedReadAccess pReadAcc(aBitmap); if (!pReadAcc) - return BitmapEx(); + return Bitmap(); Bitmap aNewBmp(aBitmap.GetSizePixel(), vcl::PixelFormat::N8_BPP, &pReadAcc->GetPalette()); BitmapScopedWriteAccess pWriteAcc(aNewBmp); if (!pWriteAcc) - return BitmapEx(); + return Bitmap(); const sal_Int32 nWidth = pWriteAcc->Width(); const sal_Int32 nHeight = pWriteAcc->Height(); @@ -130,7 +130,7 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& rBitmapEx) const aBitmap.SetPrefMapMode(aMap); aBitmap.SetPrefSize(aPrefSize); - return BitmapEx(aBitmap); + return aBitmap; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapFastScaleFilter.cxx b/vcl/source/bitmap/BitmapFastScaleFilter.cxx index 456c3d7bcc8a..7060a0a633e5 100644 --- a/vcl/source/bitmap/BitmapFastScaleFilter.cxx +++ b/vcl/source/bitmap/BitmapFastScaleFilter.cxx @@ -25,11 +25,11 @@ #include <bitmap/BitmapFastScaleFilter.hxx> -BitmapEx BitmapFastScaleFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapFastScaleFilter::execute(Bitmap const& rBitmap) const { SAL_INFO("vcl.gdi", "BitmapFastScaleFilter::execute()"); - Bitmap aBitmap(rBitmapEx.GetBitmap()); + Bitmap aBitmap(rBitmap); const Size aSizePix(aBitmap.GetSizePixel()); const sal_Int32 nNewWidth = basegfx::fround(aSizePix.Width() * mfScaleX); @@ -112,18 +112,10 @@ BitmapEx BitmapFastScaleFilter::execute(BitmapEx const& rBitmapEx) const } } - AlphaMask aMask(rBitmapEx.GetAlphaMask()); - - if (bRet && !aMask.IsEmpty()) - bRet = aMask.Scale(Size(nNewWidth, nNewHeight), BmpScaleFlag::Fast); - - SAL_WARN_IF(!aMask.IsEmpty() && aBitmap.GetSizePixel() != aMask.GetSizePixel(), "vcl", - "BitmapEx::Scale(): size mismatch for bitmap and alpha mask."); - if (bRet) - return BitmapEx(aBitmap, aMask); + return aBitmap; - return BitmapEx(); + return Bitmap(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapFilterStackBlur.cxx b/vcl/source/bitmap/BitmapFilterStackBlur.cxx index fad54b518e82..0f8c2b602bbd 100644 --- a/vcl/source/bitmap/BitmapFilterStackBlur.cxx +++ b/vcl/source/bitmap/BitmapFilterStackBlur.cxx @@ -601,14 +601,7 @@ BitmapFilterStackBlur::BitmapFilterStackBlur(sal_Int32 nRadius) BitmapFilterStackBlur::~BitmapFilterStackBlur() {} -BitmapEx BitmapFilterStackBlur::execute(BitmapEx const& rBitmapEx) const -{ - const Bitmap& aBitmap = rBitmapEx.GetBitmap(); - Bitmap result = filter(aBitmap); - return BitmapEx(result, rBitmapEx.GetAlphaMask()); -} - -Bitmap BitmapFilterStackBlur::filter(Bitmap const& rBitmap) const +Bitmap BitmapFilterStackBlur::execute(Bitmap const& rBitmap) const { Bitmap bitmapCopy(rBitmap); ScanlineFormat nScanlineFormat; diff --git a/vcl/source/bitmap/BitmapGaussianSeparableBlurFilter.cxx b/vcl/source/bitmap/BitmapGaussianSeparableBlurFilter.cxx index 8489162ab8ca..934ed51405d1 100644 --- a/vcl/source/bitmap/BitmapGaussianSeparableBlurFilter.cxx +++ b/vcl/source/bitmap/BitmapGaussianSeparableBlurFilter.cxx @@ -13,9 +13,9 @@ #include <vcl/bitmap/BitmapGaussianSeparableBlurFilter.hxx> #include <vcl/BitmapWriteAccess.hxx> -BitmapEx BitmapGaussianSeparableBlurFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapGaussianSeparableBlurFilter::execute(Bitmap const& rBitmap) const { - Bitmap aBitmap(rBitmapEx.GetBitmap()); + Bitmap aBitmap(rBitmap); const sal_Int32 nWidth = aBitmap.GetSizePixel().Width(); const sal_Int32 nHeight = aBitmap.GetSizePixel().Height(); @@ -73,9 +73,9 @@ BitmapEx BitmapGaussianSeparableBlurFilter::execute(BitmapEx const& rBitmapEx) c } if (bResult) - return BitmapEx(aBitmap); + return aBitmap; - return BitmapEx(); + return Bitmap(); } bool BitmapGaussianSeparableBlurFilter::convolutionPass(const Bitmap& rBitmap, Bitmap& aNewBitmap, diff --git a/vcl/source/bitmap/BitmapInterpolateScaleFilter.cxx b/vcl/source/bitmap/BitmapInterpolateScaleFilter.cxx index 8b9baa5b6af4..e8774f352135 100644 --- a/vcl/source/bitmap/BitmapInterpolateScaleFilter.cxx +++ b/vcl/source/bitmap/BitmapInterpolateScaleFilter.cxx @@ -26,9 +26,9 @@ #include <bitmap/BitmapFastScaleFilter.hxx> #include <bitmap/BitmapInterpolateScaleFilter.hxx> -BitmapEx BitmapInterpolateScaleFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapInterpolateScaleFilter::execute(Bitmap const& rBitmap) const { - Bitmap aBitmap(rBitmapEx.GetBitmap()); + Bitmap aBitmap(rBitmap); const Size aSizePix(aBitmap.GetSizePixel()); const sal_Int32 nNewWidth = basegfx::fround(aSizePix.Width() * mfScaleX); @@ -231,15 +231,13 @@ BitmapEx BitmapInterpolateScaleFilter::execute(BitmapEx const& rBitmapEx) const if (!bRet) { // fallback to fast scale filter - BitmapEx aBmpEx(aBitmap); - bRet = BitmapFilter::Filter(aBmpEx, BitmapFastScaleFilter(mfScaleX, mfScaleY)); - aBitmap = aBmpEx.GetBitmap(); + bRet = BitmapFilter::Filter(aBitmap, BitmapFastScaleFilter(mfScaleX, mfScaleY)); } if (bRet) - return BitmapEx(aBitmap); + return aBitmap; - return BitmapEx(); + return Bitmap(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapLightenFilter.cxx b/vcl/source/bitmap/BitmapLightenFilter.cxx index 19db81dab40d..d9a852fcaa26 100644 --- a/vcl/source/bitmap/BitmapLightenFilter.cxx +++ b/vcl/source/bitmap/BitmapLightenFilter.cxx @@ -13,14 +13,14 @@ #include <vcl/BitmapWriteAccess.hxx> #include <bitmap/BitmapLightenFilter.hxx> -BitmapEx BitmapLightenFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapLightenFilter::execute(Bitmap const& rBitmap) const { - const Size aSize(rBitmapEx.GetSizePixel()); + const Size aSize(rBitmap.GetSizePixel()); - const Bitmap& aBitmap(rBitmapEx.GetBitmap()); - Bitmap aDarkBitmap(aSize, vcl::PixelFormat::N24_BPP); + Bitmap aDarkBitmap(aSize, + rBitmap.HasAlpha() ? vcl::PixelFormat::N32_BPP : vcl::PixelFormat::N24_BPP); - BitmapScopedReadAccess pRead(aBitmap); + BitmapScopedReadAccess pRead(rBitmap); BitmapScopedWriteAccess pWrite(aDarkBitmap); if (pRead && pWrite) @@ -61,7 +61,7 @@ BitmapEx BitmapLightenFilter::execute(BitmapEx const& rBitmapEx) const pWrite.reset(); pRead.reset(); - return BitmapEx(aDarkBitmap, rBitmapEx.GetAlphaMask()); + return aDarkBitmap; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapMaskToAlphaFilter.cxx b/vcl/source/bitmap/BitmapMaskToAlphaFilter.cxx index 648394e178f3..065c8a311dad 100644 --- a/vcl/source/bitmap/BitmapMaskToAlphaFilter.cxx +++ b/vcl/source/bitmap/BitmapMaskToAlphaFilter.cxx @@ -16,14 +16,13 @@ /** * Convert a 1-bit mask to an alpha bitmap */ -BitmapEx BitmapMaskToAlphaFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapMaskToAlphaFilter::execute(Bitmap const& rBitmap) const { - const Size aSize(rBitmapEx.GetSizePixel()); + const Size aSize(rBitmap.GetSizePixel()); - const Bitmap& aBitmap(rBitmapEx.GetBitmap()); Bitmap aOutBitmap(aSize, vcl::PixelFormat::N8_BPP, &Bitmap::GetGreyPalette(256)); - BitmapScopedReadAccess pRead(aBitmap); + BitmapScopedReadAccess pRead(rBitmap); BitmapScopedWriteAccess pWrite(aOutBitmap); if (pRead && pWrite) @@ -52,7 +51,7 @@ BitmapEx BitmapMaskToAlphaFilter::execute(BitmapEx const& rBitmapEx) const pWrite.reset(); pRead.reset(); - return BitmapEx(aOutBitmap); + return aOutBitmap; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapMedianFilter.cxx b/vcl/source/bitmap/BitmapMedianFilter.cxx index bee7e47cda90..b4664239b7a8 100644 --- a/vcl/source/bitmap/BitmapMedianFilter.cxx +++ b/vcl/source/bitmap/BitmapMedianFilter.cxx @@ -46,18 +46,18 @@ MN3(a, b, c); \ MX3(d, e, f); -BitmapEx BitmapMedianFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapMedianFilter::execute(Bitmap const& rBitmap) const { - Bitmap aBitmap(rBitmapEx.GetBitmap()); + Bitmap aBitmap(rBitmap); BitmapScopedReadAccess pReadAcc(aBitmap); if (!pReadAcc) - return BitmapEx(); + return Bitmap(); Bitmap aNewBmp(aBitmap.GetSizePixel(), vcl::PixelFormat::N24_BPP); BitmapScopedWriteAccess pWriteAcc(aNewBmp); if (!pWriteAcc) - return BitmapEx(); + return Bitmap(); const sal_Int32 nWidth = pWriteAcc->Width(), nWidth2 = nWidth + 2; const sal_Int32 nHeight = pWriteAcc->Height(), nHeight2 = nHeight + 2; @@ -196,7 +196,7 @@ BitmapEx BitmapMedianFilter::execute(BitmapEx const& rBitmapEx) const aBitmap.SetPrefMapMode(aMap); aBitmap.SetPrefSize(aPrefSize); - return BitmapEx(aBitmap); + return aBitmap; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapMonochromeFilter.cxx b/vcl/source/bitmap/BitmapMonochromeFilter.cxx index c8205c2d2384..bd4148d37ccc 100644 --- a/vcl/source/bitmap/BitmapMonochromeFilter.cxx +++ b/vcl/source/bitmap/BitmapMonochromeFilter.cxx @@ -11,17 +11,16 @@ #include <vcl/bitmap/BitmapMonochromeFilter.hxx> #include <vcl/BitmapWriteAccess.hxx> -BitmapEx BitmapMonochromeFilter::execute(BitmapEx const& aBitmapEx) const +Bitmap BitmapMonochromeFilter::execute(Bitmap const& rBitmap) const { - Bitmap aBitmap = aBitmapEx.GetBitmap(); - BitmapScopedReadAccess pReadAcc(aBitmap); + BitmapScopedReadAccess pReadAcc(rBitmap); if (!pReadAcc) - return BitmapEx(); + return Bitmap(); - Bitmap aNewBmp(aBitmap.GetSizePixel(), vcl::PixelFormat::N8_BPP, &Bitmap::GetGreyPalette(256)); + Bitmap aNewBmp(rBitmap.GetSizePixel(), vcl::PixelFormat::N8_BPP, &Bitmap::GetGreyPalette(256)); BitmapScopedWriteAccess pWriteAcc(aNewBmp); if (!pWriteAcc) - return BitmapEx(); + return Bitmap(); const BitmapColor aBlack(pWriteAcc->GetBestMatchingColor(COL_BLACK)); const BitmapColor aWhite(pWriteAcc->GetBestMatchingColor(COL_WHITE)); @@ -71,15 +70,10 @@ BitmapEx BitmapMonochromeFilter::execute(BitmapEx const& aBitmapEx) const pWriteAcc.reset(); pReadAcc.reset(); - const MapMode aMap(aBitmap.GetPrefMapMode()); - const Size aSize(aBitmap.GetPrefSize()); + aNewBmp.SetPrefMapMode(rBitmap.GetPrefMapMode()); + aNewBmp.SetPrefSize(rBitmap.GetPrefSize()); - aBitmap = std::move(aNewBmp); - - aBitmap.SetPrefMapMode(aMap); - aBitmap.SetPrefSize(aSize); - - return BitmapEx(aBitmap); + return aNewBmp; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapMosaicFilter.cxx b/vcl/source/bitmap/BitmapMosaicFilter.cxx index 273c4040cc15..85ad67cde839 100644 --- a/vcl/source/bitmap/BitmapMosaicFilter.cxx +++ b/vcl/source/bitmap/BitmapMosaicFilter.cxx @@ -11,12 +11,12 @@ #include <vcl/bitmap/BitmapMosaicFilter.hxx> #include <vcl/BitmapWriteAccess.hxx> -BitmapEx BitmapMosaicFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapMosaicFilter::execute(Bitmap const& rBitmap) const { if (!(mnTileWidth > 1 || mnTileHeight > 1)) - return BitmapEx(); + return Bitmap(); - Bitmap aBitmap(rBitmapEx.GetBitmap()); + Bitmap aBitmap(rBitmap); std::optional<Bitmap> pNewBmp; BitmapScopedReadAccess pReadAcc; @@ -173,9 +173,9 @@ BitmapEx BitmapMosaicFilter::execute(BitmapEx const& rBitmapEx) const } if (bRet) - return BitmapEx(aBitmap); + return aBitmap; - return BitmapEx(); + return Bitmap(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapPopArtFilter.cxx b/vcl/source/bitmap/BitmapPopArtFilter.cxx index 375539f3168d..816220c5510e 100644 --- a/vcl/source/bitmap/BitmapPopArtFilter.cxx +++ b/vcl/source/bitmap/BitmapPopArtFilter.cxx @@ -13,20 +13,20 @@ #include <vcl/bitmap/BitmapPopArtFilter.hxx> #include <vcl/BitmapWriteAccess.hxx> -BitmapEx BitmapPopArtFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapPopArtFilter::execute(Bitmap const& rBitmap) const { - Bitmap aBitmap(rBitmapEx.GetBitmap()); + Bitmap aBitmap(rBitmap); bool bConvert = isPalettePixelFormat(aBitmap.getPixelFormat()) || aBitmap.Convert(BmpConversion::N8BitColors); if (!bConvert) - return BitmapEx(); + return Bitmap(); BitmapScopedWriteAccess pWriteAcc(aBitmap); if (!pWriteAcc) - return BitmapEx(); + return Bitmap(); const sal_Int32 nWidth = pWriteAcc->Width(); const sal_Int32 nHeight = pWriteAcc->Height(); @@ -82,7 +82,7 @@ BitmapEx BitmapPopArtFilter::execute(BitmapEx const& rBitmapEx) const // cleanup pWriteAcc.reset(); - return BitmapEx(aBitmap); + return aBitmap; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx b/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx index 02dbc6daa6cc..bea9095a46e0 100644 --- a/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx +++ b/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx @@ -338,17 +338,17 @@ bool ImplScaleConvolution(Bitmap& rBitmap, const double& rScaleX, const double& } // end anonymous namespace -BitmapEx BitmapScaleConvolutionFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapScaleConvolutionFilter::execute(Bitmap const& rBitmap) const { bool bRetval = false; - Bitmap aBitmap(rBitmapEx.GetBitmap()); + Bitmap aBitmap(rBitmap); bRetval = ImplScaleConvolution(aBitmap, mrScaleX, mrScaleY, *mxKernel); if (bRetval) - return BitmapEx(aBitmap); + return aBitmap; - return BitmapEx(); + return Bitmap(); } } diff --git a/vcl/source/bitmap/BitmapScaleSuperFilter.cxx b/vcl/source/bitmap/BitmapScaleSuperFilter.cxx index 3b4c92df31ec..c0625775dda6 100644 --- a/vcl/source/bitmap/BitmapScaleSuperFilter.cxx +++ b/vcl/source/bitmap/BitmapScaleSuperFilter.cxx @@ -857,9 +857,9 @@ BitmapScaleSuperFilter::BitmapScaleSuperFilter(const double& rScaleX, const doub BitmapScaleSuperFilter::~BitmapScaleSuperFilter() {} -BitmapEx BitmapScaleSuperFilter::execute(BitmapEx const& rBitmap) const +Bitmap BitmapScaleSuperFilter::execute(Bitmap const& rBitmap) const { - Bitmap aBitmap(rBitmap.GetBitmap()); + Bitmap aBitmap(rBitmap); bool bRet = false; const Size aSizePix(rBitmap.GetSizePixel()); @@ -876,7 +876,7 @@ BitmapEx BitmapScaleSuperFilter::execute(BitmapEx const& rBitmap) const constexpr double fScaleThresh = 0.6; if (nDstW <= 1 || nDstH <= 1) - return BitmapEx(); + return Bitmap(); // check cache for a previously scaled version of this ScaleCacheKey aKey(aBitmap.ImplGetSalBitmap().get(), @@ -909,7 +909,7 @@ BitmapEx BitmapScaleSuperFilter::execute(BitmapEx const& rBitmap) const if (!aOutSize.Width() || !aOutSize.Height()) { SAL_WARN("vcl.gdi", "bmp creation failed"); - return BitmapEx(); + return Bitmap(); } BitmapScopedWriteAccess pWriteAccess(aOutBmp); @@ -1038,12 +1038,11 @@ BitmapEx BitmapScaleSuperFilter::execute(BitmapEx const& rBitmap) const { tools::Rectangle aRect(Point(0, 0), Point(nDstW, nDstH)); aBitmap.Crop(aRect); - BitmapEx aRet(aBitmap); - rCache.insert(std::make_pair(aKey, aRet)); - return aRet; + rCache.insert(std::make_pair(aKey, aBitmap)); + return aBitmap; } - return BitmapEx(); + return Bitmap(); } diff --git a/vcl/source/bitmap/BitmapSeparableUnsharpenFilter.cxx b/vcl/source/bitmap/BitmapSeparableUnsharpenFilter.cxx index 91a3b5483a7f..e3bb94f242b0 100644 --- a/vcl/source/bitmap/BitmapSeparableUnsharpenFilter.cxx +++ b/vcl/source/bitmap/BitmapSeparableUnsharpenFilter.cxx @@ -14,18 +14,16 @@ #include <vcl/bitmap/BitmapSeparableUnsharpenFilter.hxx> #include <vcl/BitmapWriteAccess.hxx> -BitmapEx BitmapSeparableUnsharpenFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapSeparableUnsharpenFilter::execute(Bitmap const& rBitmap) const { - Bitmap aBitmap(rBitmapEx.GetBitmap()); + Bitmap aBitmap(rBitmap); const sal_Int32 nWidth = aBitmap.GetSizePixel().Width(); const sal_Int32 nHeight = aBitmap.GetSizePixel().Height(); Bitmap aBlur(aBitmap); - BitmapEx aBlurEx(aBlur); - BitmapFilter::Filter(aBlurEx, BitmapGaussianSeparableBlurFilter(-mfRadius)); - aBlur = aBlurEx.GetBitmap(); + BitmapFilter::Filter(aBlur, BitmapGaussianSeparableBlurFilter(-mfRadius)); // Amount of unsharpening effect on image - currently set to a fixed value double aAmount = 2.0; @@ -67,7 +65,7 @@ BitmapEx BitmapSeparableUnsharpenFilter::execute(BitmapEx const& rBitmapEx) cons pReadAccBlur.reset(); aBitmap.ReassignWithSize(aResultBitmap); - return BitmapEx(aBitmap); + return aBitmap; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapSepiaFilter.cxx b/vcl/source/bitmap/BitmapSepiaFilter.cxx index 877647b21f9d..97cd2d6a776a 100644 --- a/vcl/source/bitmap/BitmapSepiaFilter.cxx +++ b/vcl/source/bitmap/BitmapSepiaFilter.cxx @@ -15,12 +15,12 @@ #include <algorithm> -BitmapEx BitmapSepiaFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapSepiaFilter::execute(Bitmap const& rBitmap) const { - Bitmap aBitmap(rBitmapEx.GetBitmap()); + Bitmap aBitmap(rBitmap); BitmapScopedReadAccess pReadAcc(aBitmap); if (!pReadAcc) - return BitmapEx(); + return Bitmap(); const sal_Int32 nSepia = 10000 - 100 * std::clamp(mnSepiaPercent, sal_uInt16(0), sal_uInt16(100)); @@ -39,7 +39,7 @@ BitmapEx BitmapSepiaFilter::execute(BitmapEx const& rBitmapEx) const Bitmap aNewBmp(aBitmap.GetSizePixel(), vcl::PixelFormat::N8_BPP, &aSepiaPal); BitmapScopedWriteAccess pWriteAcc(aNewBmp); if (!pWriteAcc) - return BitmapEx(); + return Bitmap(); BitmapColor aCol(sal_uInt8(0)); const sal_Int32 nWidth = pWriteAcc->Width(); @@ -90,7 +90,7 @@ BitmapEx BitmapSepiaFilter::execute(BitmapEx const& rBitmapEx) const aBitmap.SetPrefMapMode(aMap); aBitmap.SetPrefSize(aPrefSize); - return BitmapEx(aBitmap); + return aBitmap; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapShadowFilter.cxx b/vcl/source/bitmap/BitmapShadowFilter.cxx index ce0e5c1ed0bd..501340b3bd50 100644 --- a/vcl/source/bitmap/BitmapShadowFilter.cxx +++ b/vcl/source/bitmap/BitmapShadowFilter.cxx @@ -12,13 +12,13 @@ #include <vcl/BitmapColor.hxx> #include <vcl/BitmapWriteAccess.hxx> -BitmapEx BitmapShadowFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapShadowFilter::execute(Bitmap const& rBitmap) const { - const BitmapEx& aBitmapEx(rBitmapEx); - BitmapScopedWriteAccess pWriteAccess(const_cast<Bitmap&>(aBitmapEx.GetBitmap())); + Bitmap aBitmap(rBitmap); + BitmapScopedWriteAccess pWriteAccess(aBitmap); if (!pWriteAccess) - return rBitmapEx; + return Bitmap(); for (sal_Int32 y(0), nHeight(pWriteAccess->Height()); y < nHeight; y++) { @@ -40,7 +40,7 @@ BitmapEx BitmapShadowFilter::execute(BitmapEx const& rBitmapEx) const } } - return aBitmapEx; + return aBitmap; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapSimpleColorQuantizationFilter.cxx b/vcl/source/bitmap/BitmapSimpleColorQuantizationFilter.cxx index d885d66beab3..68b835c2d585 100644 --- a/vcl/source/bitmap/BitmapSimpleColorQuantizationFilter.cxx +++ b/vcl/source/bitmap/BitmapSimpleColorQuantizationFilter.cxx @@ -12,17 +12,17 @@ #include <vcl/BitmapWriteAccess.hxx> #include <bitmap/Octree.hxx> -BitmapEx BitmapSimpleColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) const +Bitmap BitmapSimpleColorQuantizationFilter::execute(Bitmap const& rBitmap) const { - Bitmap aBitmap = aBitmapEx.GetBitmap(); + Bitmap aBitmap = rBitmap; if (vcl::numberOfColors(aBitmap.getPixelFormat()) <= sal_Int64(mnNewColorCount)) - return BitmapEx(aBitmap); + return aBitmap; Bitmap aNewBmp; BitmapScopedReadAccess pRAcc(aBitmap); if (!pRAcc) - return BitmapEx(); + return Bitmap(); const sal_uInt16 nColorCount = std::min(mnNewColorCount, sal_uInt16(256)); auto ePixelFormat = vcl::PixelFormat::N8_BPP; @@ -33,7 +33,7 @@ BitmapEx BitmapSimpleColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) aNewBmp = Bitmap(aBitmap.GetSizePixel(), ePixelFormat, &rPal); BitmapScopedWriteAccess pWAcc(aNewBmp); if (!pWAcc) - return BitmapEx(); + return Bitmap(); const sal_Int32 nWidth = pRAcc->Width(); const sal_Int32 nHeight = pRAcc->Height(); @@ -80,7 +80,7 @@ BitmapEx BitmapSimpleColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) aBitmap.SetPrefMapMode(aMap); aBitmap.SetPrefSize(aSize); - return BitmapEx(aBitmap); + return aBitmap; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapSmoothenFilter.cxx b/vcl/source/bitmap/BitmapSmoothenFilter.cxx index 3fa43e67fb11..0582f94ccbc2 100644 --- a/vcl/source/bitmap/BitmapSmoothenFilter.cxx +++ b/vcl/source/bitmap/BitmapSmoothenFilter.cxx @@ -12,20 +12,20 @@ #include <vcl/bitmap/BitmapSeparableUnsharpenFilter.hxx> #include <vcl/bitmap/BitmapSmoothenFilter.hxx> -BitmapEx BitmapSmoothenFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapSmoothenFilter::execute(Bitmap const& rBitmap) const { - BitmapEx aBitmapEx(rBitmapEx); + Bitmap aBitmap(rBitmap); bool bRet = false; if (mfRadius > 0.0) // Blur for positive values of mnRadius - bRet = BitmapFilter::Filter(aBitmapEx, BitmapGaussianSeparableBlurFilter(mfRadius)); + bRet = BitmapFilter::Filter(aBitmap, BitmapGaussianSeparableBlurFilter(mfRadius)); else if (mfRadius < 0.0) // Unsharpen mask for negative values of mnRadius - bRet = BitmapFilter::Filter(aBitmapEx, BitmapSeparableUnsharpenFilter(mfRadius)); + bRet = BitmapFilter::Filter(aBitmap, BitmapSeparableUnsharpenFilter(mfRadius)); if (bRet) - return aBitmapEx; + return aBitmap; - return BitmapEx(); + return Bitmap(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapSobelGreyFilter.cxx b/vcl/source/bitmap/BitmapSobelGreyFilter.cxx index 6c798a595422..3b12e44c1873 100644 --- a/vcl/source/bitmap/BitmapSobelGreyFilter.cxx +++ b/vcl/source/bitmap/BitmapSobelGreyFilter.cxx @@ -15,21 +15,21 @@ #include <algorithm> -BitmapEx BitmapSobelGreyFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapSobelGreyFilter::execute(Bitmap const& rBitmap) const { - Bitmap aBitmap(rBitmapEx.GetBitmap()); + Bitmap aBitmap(rBitmap); if (!aBitmap.ImplMakeGreyscales()) - return BitmapEx(); + return Bitmap(); BitmapScopedReadAccess pReadAcc(aBitmap); if (!pReadAcc) - return BitmapEx(); + return Bitmap(); Bitmap aNewBmp(aBitmap.GetSizePixel(), vcl::PixelFormat::N8_BPP, &pReadAcc->GetPalette()); BitmapScopedWriteAccess pWriteAcc(aNewBmp); if (!pWriteAcc) - return BitmapEx(); + return Bitmap(); BitmapColor aGrey(sal_uInt8(0)); const sal_Int32 nWidth = pWriteAcc->Width(); @@ -138,15 +138,10 @@ BitmapEx BitmapSobelGreyFilter::execute(BitmapEx const& rBitmapEx) const pWriteAcc.reset(); pReadAcc.reset(); - const MapMode aMap(aBitmap.GetPrefMapMode()); - const Size aPrefSize(aBitmap.GetPrefSize()); + aNewBmp.SetPrefMapMode(aBitmap.GetPrefMapMode()); + aNewBmp.SetPrefSize(aBitmap.GetPrefSize()); - aBitmap = std::move(aNewBmp); - - aBitmap.SetPrefMapMode(aMap); - aBitmap.SetPrefSize(aPrefSize); - - return BitmapEx(aBitmap); + return aNewBmp; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/BitmapSolarizeFilter.cxx b/vcl/source/bitmap/BitmapSolarizeFilter.cxx index 2e35fb94d2ff..a9bd3e709911 100644 --- a/vcl/source/bitmap/BitmapSolarizeFilter.cxx +++ b/vcl/source/bitmap/BitmapSolarizeFilter.cxx @@ -11,58 +11,53 @@ #include <vcl/bitmap/BitmapSolarizeFilter.hxx> #include <vcl/BitmapWriteAccess.hxx> -BitmapEx BitmapSolarizeFilter::execute(BitmapEx const& rBitmapEx) const +Bitmap BitmapSolarizeFilter::execute(Bitmap const& rBitmap) const { - Bitmap aBitmap(rBitmapEx.GetBitmap()); - bool bRet = false; + Bitmap aBitmap(rBitmap); BitmapScopedWriteAccess pWriteAcc(aBitmap); - if (pWriteAcc) + if (!pWriteAcc) + return Bitmap(); + + if (pWriteAcc->HasPalette()) { - if (pWriteAcc->HasPalette()) - { - const BitmapPalette& rPal = pWriteAcc->GetPalette(); + const BitmapPalette& rPal = pWriteAcc->GetPalette(); - for (sal_uInt16 i = 0, nCount = rPal.GetEntryCount(); i < nCount; i++) + for (sal_uInt16 i = 0, nCount = rPal.GetEntryCount(); i < nCount; i++) + { + if (rPal[i].GetLuminance() >= mcSolarGreyThreshold) { - if (rPal[i].GetLuminance() >= mcSolarGreyThreshold) - { - BitmapColor aCol(rPal[i]); - aCol.Invert(); - pWriteAcc->SetPaletteColor(i, aCol); - } + BitmapColor aCol(rPal[i]); + aCol.Invert(); + pWriteAcc->SetPaletteColor(i, aCol); } } - else - { - BitmapColor aCol; - const sal_Int32 nWidth = pWriteAcc->Width(); - const sal_Int32 nHeight = pWriteAcc->Height(); + } + else + { + BitmapColor aCol; + const sal_Int32 nWidth = pWriteAcc->Width(); + const sal_Int32 nHeight = pWriteAcc->Height(); - for (sal_Int32 nY = 0; nY < nHeight; nY++) + for (sal_Int32 nY = 0; nY < nHeight; nY++) + { + Scanline pScanline = pWriteAcc->GetScanline(nY); + for (sal_Int32 nX = 0; nX < nWidth; nX++) { - Scanline pScanline = pWriteAcc->GetScanline(nY); - for (sal_Int32 nX = 0; nX < nWidth; nX++) - { - aCol = pWriteAcc->GetPixelFromData(pScanline, nX); + aCol = pWriteAcc->GetPixelFromData(pScanline, nX); - if (aCol.GetLuminance() >= mcSolarGreyThreshold) - { - aCol.Invert(); - pWriteAcc->SetPixelOnData(pScanline, nX, aCol); - } + if (aCol.GetLuminance() >= mcSolarGreyThreshold) + { + aCol.Invert(); + pWriteAcc->SetPixelOnData(pScanline, nX, aCol); } } } - - pWriteAcc.reset(); - bRet = true; } - if (bRet) - return BitmapEx(aBitmap); + pWriteAcc.reset(); - return BitmapEx(); + return aBitmap; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx index f2a02010300c..2dc4ff0b66e4 100644 --- a/vcl/source/bitmap/bitmap.cxx +++ b/vcl/source/bitmap/bitmap.cxx @@ -870,11 +870,7 @@ bool Bitmap::Convert( BmpConversion eConversion ) switch( eConversion ) { case BmpConversion::N1BitThreshold: - { - BitmapEx aBmpEx(*this); - bRet = BitmapFilter::Filter(aBmpEx, BitmapMonochromeFilter(128)); - *this = aBmpEx.GetBitmap(); - } + bRet = BitmapFilter::Filter(*this, BitmapMonochromeFilter(128)); break; case BmpConversion::N8BitGreys: @@ -1372,44 +1368,40 @@ bool Bitmap::Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag n } } - BitmapEx aBmpEx(*this); bool bRetval(false); switch(nScaleFlag) { case BmpScaleFlag::Default: if (GetSizePixel().Width() < 2 || GetSizePixel().Height() < 2) - bRetval = BitmapFilter::Filter(aBmpEx, BitmapFastScaleFilter(rScaleX, rScaleY)); + bRetval = BitmapFilter::Filter(*this, BitmapFastScaleFilter(rScaleX, rScaleY)); else - bRetval = BitmapFilter::Filter(aBmpEx, BitmapScaleSuperFilter(rScaleX, rScaleY)); + bRetval = BitmapFilter::Filter(*this, BitmapScaleSuperFilter(rScaleX, rScaleY)); break; case BmpScaleFlag::Fast: case BmpScaleFlag::NearestNeighbor: - bRetval = BitmapFilter::Filter(aBmpEx, BitmapFastScaleFilter(rScaleX, rScaleY)); + bRetval = BitmapFilter::Filter(*this, BitmapFastScaleFilter(rScaleX, rScaleY)); break; case BmpScaleFlag::Interpolate: - bRetval = BitmapFilter::Filter(aBmpEx, BitmapInterpolateScaleFilter(rScaleX, rScaleY)); + bRetval = BitmapFilter::Filter(*this, BitmapInterpolateScaleFilter(rScaleX, rScaleY)); break; case BmpScaleFlag::BestQuality: case BmpScaleFlag::Lanczos: - bRetval = BitmapFilter::Filter(aBmpEx, vcl::BitmapScaleLanczos3Filter(rScaleX, rScaleY)); + bRetval = BitmapFilter::Filter(*this, vcl::BitmapScaleLanczos3Filter(rScaleX, rScaleY)); break; case BmpScaleFlag::BiCubic: - bRetval = BitmapFilter::Filter(aBmpEx, vcl::BitmapScaleBicubicFilter(rScaleX, rScaleY)); + bRetval = BitmapFilter::Filter(*this, vcl::BitmapScaleBicubicFilter(rScaleX, rScaleY)); break; case BmpScaleFlag::BiLinear: - bRetval = BitmapFilter::Filter(aBmpEx, vcl::BitmapScaleBilinearFilter(rScaleX, rScaleY)); + bRetval = BitmapFilter::Filter(*this, vcl::BitmapScaleBilinearFilter(rScaleX, rScaleY)); break; } - if (bRetval) - *this = aBmpEx.GetBitmap(); - OSL_ENSURE(!bRetval || eStartPixelFormat == getPixelFormat(), "Bitmap::Scale has changed the ColorDepth, this should *not* happen (!)"); return bRetval; } diff --git a/vcl/source/bitmap/bitmapfilter.cxx b/vcl/source/bitmap/bitmapfilter.cxx index f5f59cc4c114..30704191b9e7 100644 --- a/vcl/source/bitmap/bitmapfilter.cxx +++ b/vcl/source/bitmap/bitmapfilter.cxx @@ -19,27 +19,27 @@ BitmapFilter::~BitmapFilter() {} bool BitmapFilter::Filter(BitmapEx& rBmpEx, BitmapFilter const& rFilter) { - BitmapEx aTmpBmpEx(rFilter.execute(rBmpEx)); + Bitmap aBitmap(rBmpEx); + bool bRet = Filter(aBitmap, rFilter); + if (bRet) + rBmpEx = BitmapEx(aBitmap); + return bRet; +} + +bool BitmapFilter::Filter(Bitmap& rBmp, BitmapFilter const& rFilter) +{ + Bitmap aTmpBmp(rFilter.execute(rBmp)); - if (aTmpBmpEx.IsEmpty()) + if (aTmpBmp.IsEmpty()) { SAL_WARN("vcl.gdi", "Bitmap filter failed " << typeid(rFilter).name()); return false; } - rBmpEx = aTmpBmpEx; + rBmp = aTmpBmp; return true; } -bool BitmapFilter::Filter(Bitmap& rBmp, BitmapFilter const& rFilter) -{ - BitmapEx aBitmapEx(rBmp); - bool bRet = Filter(aBitmapEx, rFilter); - if (bRet) - rBmp = Bitmap(aBitmapEx); - return bRet; -} - bool BitmapFilter::Filter(Animation& rAnimation, BitmapFilter const& rFilter) { SAL_WARN_IF(rAnimation.IsInAnimation(), "vcl", "Animation modified while it is animated"); diff --git a/vcl/source/graphic/UnoGraphic.cxx b/vcl/source/graphic/UnoGraphic.cxx index 1e5c2f0f01e4..e6fafee8b979 100644 --- a/vcl/source/graphic/UnoGraphic.cxx +++ b/vcl/source/graphic/UnoGraphic.cxx @@ -225,13 +225,13 @@ uno::Reference< graphic::XGraphic > SAL_CALL Graphic::applyDuotone( BitmapEx aBitmapEx( aGraphic.GetBitmapEx() ); const AlphaMask& aMask( aBitmapEx.GetAlphaMask() ); - BitmapEx aTmpBmpEx(aBitmapEx.GetBitmap()); - BitmapFilter::Filter(aTmpBmpEx, + Bitmap aTmpBmp(aBitmapEx.GetBitmap()); + BitmapFilter::Filter(aTmpBmp, BitmapDuoToneFilter( Color(ColorTransparency, nColorOne), Color(ColorTransparency, nColorTwo))); - aReturnGraphic = ::Graphic( BitmapEx( aTmpBmpEx.GetBitmap(), aMask ) ); + aReturnGraphic = ::Graphic( BitmapEx( aTmpBmp, aMask ) ); aReturnGraphic.setOriginURL(aGraphic.getOriginURL()); return aReturnGraphic.GetXGraphic(); } diff --git a/vcl/source/image/Image.cxx b/vcl/source/image/Image.cxx index 98091e7c9c9d..9c93feab2139 100644 --- a/vcl/source/image/Image.cxx +++ b/vcl/source/image/Image.cxx @@ -141,8 +141,6 @@ void Image::Draw(OutputDevice* pOutDev, const Point& rPos, DrawImageFlags nStyle (nStyle & (DrawImageFlags::ColorTransform | DrawImageFlags::Highlight | DrawImageFlags::Deactive | DrawImageFlags::SemiTransparent))) { - BitmapEx aTempBitmapEx(aRenderBmp); - if (nStyle & (DrawImageFlags::Highlight | DrawImageFlags::Deactive)) { const StyleSettings& rSettings = pOutDev->GetSettings().GetStyleSettings(); @@ -152,11 +150,12 @@ void Image::Draw(OutputDevice* pOutDev, const Point& rPos, DrawImageFlags nStyle else aColor = rSettings.GetDeactiveColor(); - BitmapFilter::Filter(aTempBitmapEx, BitmapColorizeFilter(aColor)); + BitmapFilter::Filter(aRenderBmp, BitmapColorizeFilter(aColor)); } if (nStyle & DrawImageFlags::SemiTransparent) { + BitmapEx aTempBitmapEx(aRenderBmp); if (aTempBitmapEx.IsAlpha()) { Bitmap aAlphaBmp(aTempBitmapEx.GetAlphaMask().GetBitmap()); @@ -168,8 +167,8 @@ void Image::Draw(OutputDevice* pOutDev, const Point& rPos, DrawImageFlags nStyle sal_uInt8 cErase = 128; aTempBitmapEx = BitmapEx(aTempBitmapEx.GetBitmap(), AlphaMask(aTempBitmapEx.GetSizePixel(), &cErase)); } + aRenderBmp = Bitmap(aTempBitmapEx); } - aRenderBmp = Bitmap(aTempBitmapEx); } pOutDev->DrawBitmapEx(rPos, aOutSize, aRenderBmp); diff --git a/vcl/unx/generic/dtrans/bmp.cxx b/vcl/unx/generic/dtrans/bmp.cxx index 256967668004..683aa857f643 100644 --- a/vcl/unx/generic/dtrans/bmp.cxx +++ b/vcl/unx/generic/dtrans/bmp.cxx @@ -757,21 +757,11 @@ css::uno::Sequence<sal_Int8> x11::convertBitmapDepth( bm.Convert(BmpConversion::N1BitThreshold); break; case 4: - { - BitmapEx aBmpEx(bm); - BitmapFilter::Filter(aBmpEx, BitmapSimpleColorQuantizationFilter(1<<4)); - bm = aBmpEx.GetBitmap(); - } - break; - + BitmapFilter::Filter(bm, BitmapSimpleColorQuantizationFilter(1<<4)); + break; case 8: - { - BitmapEx aBmpEx(bm); - BitmapFilter::Filter(aBmpEx, BitmapSimpleColorQuantizationFilter(1<<8)); - bm = aBmpEx.GetBitmap(); - } - break; - + BitmapFilter::Filter(bm, BitmapSimpleColorQuantizationFilter(1<<8)); + break; case 24: bm.Convert(BmpConversion::N24Bit); break; diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 6ea0b82d0744..4087ff800de6 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -135,9 +135,7 @@ public: maIntroBW = maIntro.GetBitmap(); - BitmapEx aTmpBmpEx(maIntroBW); - BitmapFilter::Filter(aTmpBmpEx, BitmapEmbossGreyFilter(0_deg100, 0_deg100)); - maIntroBW = aTmpBmpEx.GetBitmap(); + BitmapFilter::Filter(maIntroBW, BitmapEmbossGreyFilter(0_deg100, 0_deg100)); InitRenderers(); mnSegmentsY = rtl::math::round(std::sqrt(maRenderers.size()), 0,