accessibility/inc/pch/precompiled_acc.hxx | 1 basctl/inc/pch/precompiled_basctl.hxx | 1 canvas/qa/cppunit/canvastest.cxx | 4 canvas/source/directx/dx_vcltools.cxx | 8 canvas/source/vcl/canvashelper.cxx | 2 chart2/inc/pch/precompiled_chartcontroller.hxx | 1 comphelper/inc/pch/precompiled_comphelper.hxx | 1 cppcanvas/inc/pch/precompiled_cppcanvas.hxx | 1 cppcanvas/qa/extras/emfplus/emfplus.cxx | 2 cui/inc/pch/precompiled_cui.hxx | 1 dbaccess/inc/pch/precompiled_dba.hxx | 1 desktop/inc/pch/precompiled_sofficeapp.hxx | 1 desktop/source/lib/init.cxx | 4 drawinglayer/inc/texture/texture3d.hxx | 5 drawinglayer/qa/unit/vclmetafileprocessor2d.cxx | 2 drawinglayer/qa/unit/vclpixelprocessor2d.cxx | 2 drawinglayer/source/processor2d/cairopixelprocessor2d.cxx | 6 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx | 8 drawinglayer/source/texture/texture3d.cxx | 4 editeng/inc/pch/precompiled_editeng.hxx | 1 emfio/source/reader/wmfreader.cxx | 2 filter/source/msfilter/msdffimp.cxx | 2 filter/source/msfilter/svdfppt.cxx | 2 forms/source/component/imgprod.cxx | 11 - framework/inc/pch/precompiled_fwk.hxx | 1 include/vcl/BitmapInfoAccess.hxx | 52 +++++ include/vcl/BitmapReadAccess.hxx | 51 +++++ include/vcl/BitmapWriteAccess.hxx | 54 +++++- include/vcl/alpha.hxx | 9 - include/vcl/bitmap.hxx | 11 - include/vcl/scopedbitmapaccess.hxx | 123 -------------- reportdesign/inc/pch/precompiled_rpt.hxx | 1 reportdesign/inc/pch/precompiled_rptui.hxx | 1 sc/inc/pch/precompiled_sc.hxx | 1 sc/source/filter/excel/xeescher.cxx | 2 sd/inc/pch/precompiled_sdui.hxx | 1 sd/qa/unit/PNGExportTests.cxx | 30 +-- sd/qa/unit/import-tests2.cxx | 2 sd/qa/unit/tiledrendering/tiledrendering.cxx | 2 sd/source/ui/dlg/vectdlg.cxx | 2 slideshow/inc/pch/precompiled_slideshow.hxx | 1 solenv/clang-format/excludelist | 1 svtools/inc/pch/precompiled_svt.hxx | 1 svx/inc/pch/precompiled_svxcore.hxx | 1 svx/qa/unit/customshapes.cxx | 8 svx/source/svdraw/svdetc.cxx | 2 sw/inc/pch/precompiled_msword.hxx | 1 sw/inc/pch/precompiled_swui.hxx | 1 sw/inc/pch/precompiled_vbaswobj.hxx | 1 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 2 sw/qa/extras/tiledrendering/tiledrendering.cxx | 16 - vbahelper/inc/pch/precompiled_msforms.hxx | 1 vcl/backendtest/outputdevice/bitmap.cxx | 6 vcl/backendtest/outputdevice/common.cxx | 2 vcl/inc/canvasbitmap.hxx | 13 - vcl/inc/pch/precompiled_vcl.hxx | 2 vcl/qa/cppunit/BackendTest.cxx | 6 vcl/qa/cppunit/BitmapExTest.cxx | 28 +-- vcl/qa/cppunit/BitmapFilterTest.cxx | 4 vcl/qa/cppunit/BitmapProcessorTest.cxx | 10 - vcl/qa/cppunit/BitmapScaleTest.cxx | 4 vcl/qa/cppunit/BitmapTest.cxx | 18 +- vcl/qa/cppunit/GraphicTest.cxx | 2 vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx | 2 vcl/qa/cppunit/canvasbitmaptest.cxx | 20 -- vcl/qa/cppunit/cjktext.cxx | 4 vcl/qa/cppunit/drawmode.cxx | 6 vcl/qa/cppunit/gen/gen.cxx | 4 vcl/qa/cppunit/gradient.cxx | 2 vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx | 10 - vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx | 12 - vcl/qa/cppunit/jpeg/JpegReaderTest.cxx | 4 vcl/qa/cppunit/jpeg/JpegWriterTest.cxx | 4 vcl/qa/cppunit/outdev.cxx | 16 - vcl/qa/cppunit/png/PngFilterTest.cxx | 16 - vcl/qa/cppunit/skia/skia.cxx | 14 - vcl/qa/cppunit/svm/svmtest.cxx | 4 vcl/qa/cppunit/text.cxx | 6 vcl/source/bitmap/BitmapAlphaClampFilter.cxx | 5 vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx | 39 ++-- vcl/source/bitmap/BitmapColorQuantizationFilter.cxx | 5 vcl/source/bitmap/BitmapColorizeFilter.cxx | 2 vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx | 5 vcl/source/bitmap/BitmapDisabledImageFilter.cxx | 4 vcl/source/bitmap/BitmapDuoToneFilter.cxx | 5 vcl/source/bitmap/BitmapEmbossGreyFilter.cxx | 5 vcl/source/bitmap/BitmapEx.cxx | 28 +-- vcl/source/bitmap/BitmapFastScaleFilter.cxx | 4 vcl/source/bitmap/BitmapFilterStackBlur.cxx | 12 - vcl/source/bitmap/BitmapGaussianSeparableBlurFilter.cxx | 7 vcl/source/bitmap/BitmapInfoAccess.cxx | 11 - vcl/source/bitmap/BitmapInterpolateScaleFilter.cxx | 8 vcl/source/bitmap/BitmapLightenFilter.cxx | 4 vcl/source/bitmap/BitmapMaskToAlphaFilter.cxx | 4 vcl/source/bitmap/BitmapMedianFilter.cxx | 5 vcl/source/bitmap/BitmapMonochromeFilter.cxx | 5 vcl/source/bitmap/BitmapMosaicFilter.cxx | 20 +- vcl/source/bitmap/BitmapPopArtFilter.cxx | 3 vcl/source/bitmap/BitmapReadAccess.cxx | 7 vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx | 6 vcl/source/bitmap/BitmapScaleSuperFilter.cxx | 4 vcl/source/bitmap/BitmapSeparableUnsharpenFilter.cxx | 7 vcl/source/bitmap/BitmapSepiaFilter.cxx | 5 vcl/source/bitmap/BitmapShadowFilter.cxx | 3 vcl/source/bitmap/BitmapSimpleColorQuantizationFilter.cxx | 5 vcl/source/bitmap/BitmapSobelGreyFilter.cxx | 5 vcl/source/bitmap/BitmapSolarizeFilter.cxx | 3 vcl/source/bitmap/BitmapSymmetryCheck.cxx | 2 vcl/source/bitmap/BitmapTools.cxx | 68 +++---- vcl/source/bitmap/BitmapWriteAccess.cxx | 7 vcl/source/bitmap/alpha.cxx | 12 - vcl/source/bitmap/bitmap.cxx | 69 +------ vcl/source/bitmap/bitmappaint.cxx | 26 +- vcl/source/bitmap/bmpfast.cxx | 2 vcl/source/bitmap/dibtools.cxx | 10 - vcl/source/bitmap/impvect.cxx | 2 vcl/source/filter/egif/egif.cxx | 10 - vcl/source/filter/eps/eps.cxx | 8 vcl/source/filter/etiff/etiff.cxx | 7 vcl/source/filter/graphicfilter.cxx | 4 vcl/source/filter/igif/gifread.cxx | 10 - vcl/source/filter/ipdf/pdfread.cxx | 4 vcl/source/filter/itiff/itiff.cxx | 4 vcl/source/filter/ixbm/xbmread.cxx | 4 vcl/source/filter/ixpm/xpmread.cxx | 6 vcl/source/filter/jpeg/JpegReader.cxx | 2 vcl/source/filter/jpeg/JpegReader.hxx | 2 vcl/source/filter/jpeg/JpegWriter.cxx | 2 vcl/source/filter/jpeg/JpegWriter.hxx | 2 vcl/source/filter/jpeg/jpeg.h | 2 vcl/source/filter/jpeg/jpeg.hxx | 3 vcl/source/filter/png/PngImageReader.cxx | 14 - vcl/source/filter/png/PngImageWriter.cxx | 10 - vcl/source/filter/png/png.hxx | 5 vcl/source/filter/webp/reader.cxx | 6 vcl/source/filter/webp/writer.cxx | 4 vcl/source/gdi/mtfxmldump.cxx | 2 vcl/source/gdi/pdfwriter_impl.cxx | 6 vcl/source/helper/canvasbitmap.cxx | 30 +-- vcl/source/helper/canvastools.cxx | 7 vcl/source/opengl/OpenGLHelper.cxx | 4 vcl/source/outdev/bitmap.cxx | 10 - vcl/source/outdev/transparent.cxx | 5 vcl/source/pdf/PDFiumLibrary.cxx | 2 vcl/unx/generic/window/salframe.cxx | 6 vcl/workben/svptest.cxx | 5 vcl/workben/vcldemo.cxx | 9 - xmloff/inc/pch/precompiled_xo.hxx | 1 xmlsecurity/inc/pch/precompiled_xmlsecurity.hxx | 1 149 files changed, 587 insertions(+), 705 deletions(-)
New commits: commit a214ac677481883d31800bc2b67fd3a9c504319d Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Mon Dec 4 11:17:23 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Dec 7 09:32:14 2023 +0100 simplify and modernise ScopedBitmapAccess (*) Make all of it use a "Scoped" paradigm (*) pass by value, no need to allocate on heap (*) make all of the construction go via the *Access constructors, instead of it being some via the constructors and some via the Acquire*Access methods. (*) take the Bitmap& by const& in the constructor, so we can avoid doing const_cast in random places. Change-Id: Ie03a9145c0965980ee8df9a89b8714a425e18f74 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160293 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/accessibility/inc/pch/precompiled_acc.hxx b/accessibility/inc/pch/precompiled_acc.hxx index 5045b2bf4fab..c9589365ab4b 100644 --- a/accessibility/inc/pch/precompiled_acc.hxx +++ b/accessibility/inc/pch/precompiled_acc.hxx @@ -133,7 +133,6 @@ #include <vcl/rendercontext/SystemTextColorFlags.hxx> #include <vcl/salgtype.hxx> #include <vcl/salnativewidgets.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/syswin.hxx> diff --git a/basctl/inc/pch/precompiled_basctl.hxx b/basctl/inc/pch/precompiled_basctl.hxx index d41ed13289ae..1794f96f90e9 100644 --- a/basctl/inc/pch/precompiled_basctl.hxx +++ b/basctl/inc/pch/precompiled_basctl.hxx @@ -154,7 +154,6 @@ #include <vcl/rendercontext/SystemTextColorFlags.hxx> #include <vcl/salgtype.hxx> #include <vcl/salnativewidgets.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/syswin.hxx> diff --git a/canvas/qa/cppunit/canvastest.cxx b/canvas/qa/cppunit/canvastest.cxx index d4cba860db43..922888b4894a 100644 --- a/canvas/qa/cppunit/canvastest.cxx +++ b/canvas/qa/cppunit/canvastest.cxx @@ -95,7 +95,7 @@ public: mRenderState); exportDevice("test-draw-line.png", mVclDevice); Bitmap bitmap = mVclDevice->GetBitmap(Point(), mVclDevice->GetOutputSizePixel()); - Bitmap::ScopedReadAccess access(bitmap); + BitmapScopedReadAccess access(bitmap); // Canvas uses AA, which blurs the line, and it cannot be turned off, // so do not check the end points. CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_WHITE), access->GetPixel(0, 0)); @@ -130,7 +130,7 @@ public: exportDevice("test-tdf134053.png", mVclDevice); Bitmap bitmap = mVclDevice->GetBitmap(Point(), mVclDevice->GetOutputSizePixel()); - Bitmap::ScopedReadAccess access(bitmap); + BitmapScopedReadAccess access(bitmap); struct Check { tools::Long start; diff --git a/canvas/source/directx/dx_vcltools.cxx b/canvas/source/directx/dx_vcltools.cxx index fb5e5c5e93db..31b05be58e9c 100644 --- a/canvas/source/directx/dx_vcltools.cxx +++ b/canvas/source/directx/dx_vcltools.cxx @@ -100,7 +100,7 @@ namespace dxcanvas::tools { // first of all, ensure that Bitmap contains a DIB, by // acquiring a read access - BitmapReadAccess* pReadAcc = rBmp.AcquireReadAccess(); + BitmapScopedReadAccess pReadAcc(rBmp); // TODO(P2): Acquiring a read access can actually // force a read from VRAM, thus, avoiding this @@ -116,8 +116,6 @@ namespace dxcanvas::tools return drawDIBits( rGraphics, aBmpSysData.pDIB ); } - - Bitmap::ReleaseAccess( pReadAcc ); } } else @@ -156,7 +154,7 @@ namespace dxcanvas::tools Bitmap aBitmap( rBmpEx.GetBitmap() ); - Bitmap::ScopedReadAccess pReadAccess( aBitmap ); + BitmapScopedReadAccess pReadAccess( aBitmap ); const sal_Int32 nWidth( aBmpSize.Width() ); const sal_Int32 nHeight( aBmpSize.Height() ); @@ -167,7 +165,7 @@ namespace dxcanvas::tools Bitmap aAlpha( rBmpEx.GetAlphaMask().GetBitmap() ); - Bitmap::ScopedReadAccess pAlphaReadAccess( aAlpha ); + BitmapScopedReadAccess pAlphaReadAccess( aAlpha ); // By convention, the access buffer always has // one of the following formats: diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index 0e4dfdbf633f..1e47b02c84fc 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -971,7 +971,7 @@ namespace vclcanvas Bitmap aBitmap( rOutDev.GetBitmapEx(aRect.TopLeft(), aRect.GetSize()).GetBitmap() ); - Bitmap::ScopedReadAccess pReadAccess( aBitmap ); + BitmapScopedReadAccess pReadAccess( aBitmap ); ENSURE_OR_THROW( pReadAccess.get() != nullptr, "Could not acquire read access to OutDev bitmap" ); diff --git a/chart2/inc/pch/precompiled_chartcontroller.hxx b/chart2/inc/pch/precompiled_chartcontroller.hxx index 960c99bd1f8d..77745b05373c 100644 --- a/chart2/inc/pch/precompiled_chartcontroller.hxx +++ b/chart2/inc/pch/precompiled_chartcontroller.hxx @@ -145,7 +145,6 @@ #include <vcl/rendercontext/State.hxx> #include <vcl/rendercontext/SystemTextColorFlags.hxx> #include <vcl/salnativewidgets.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/syswin.hxx> diff --git a/comphelper/inc/pch/precompiled_comphelper.hxx b/comphelper/inc/pch/precompiled_comphelper.hxx index caa5b43017f6..897773b473f5 100644 --- a/comphelper/inc/pch/precompiled_comphelper.hxx +++ b/comphelper/inc/pch/precompiled_comphelper.hxx @@ -112,7 +112,6 @@ #include <vcl/gfxlink.hxx> #include <vcl/mapmod.hxx> #include <vcl/region.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/task.hxx> #include <vcl/timer.hxx> #include <vcl/vectorgraphicdata.hxx> diff --git a/cppcanvas/inc/pch/precompiled_cppcanvas.hxx b/cppcanvas/inc/pch/precompiled_cppcanvas.hxx index 44c0bb3db4c4..408286c2ac96 100644 --- a/cppcanvas/inc/pch/precompiled_cppcanvas.hxx +++ b/cppcanvas/inc/pch/precompiled_cppcanvas.hxx @@ -77,7 +77,6 @@ #include <vcl/dllapi.h> #include <vcl/mapmod.hxx> #include <vcl/region.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/vclenum.hxx> #endif // PCH_LEVEL >= 2 #if PCH_LEVEL >= 3 diff --git a/cppcanvas/qa/extras/emfplus/emfplus.cxx b/cppcanvas/qa/extras/emfplus/emfplus.cxx index e19508b202d7..21cb7c219e19 100644 --- a/cppcanvas/qa/extras/emfplus/emfplus.cxx +++ b/cppcanvas/qa/extras/emfplus/emfplus.cxx @@ -51,7 +51,7 @@ public: CPPUNIT_TEST_FIXTURE(Test, testFdo77229) { Bitmap aBitmap = load("fdo77229.emf"); - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); // The green star was missing. Color aColor(pAccess->GetPixel(284, 280)); CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), aColor.GetRed()); diff --git a/cui/inc/pch/precompiled_cui.hxx b/cui/inc/pch/precompiled_cui.hxx index 067318ee9790..3655744b08fa 100644 --- a/cui/inc/pch/precompiled_cui.hxx +++ b/cui/inc/pch/precompiled_cui.hxx @@ -145,7 +145,6 @@ #include <vcl/rendercontext/State.hxx> #include <vcl/rendercontext/SystemTextColorFlags.hxx> #include <vcl/salnativewidgets.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/syswin.hxx> diff --git a/dbaccess/inc/pch/precompiled_dba.hxx b/dbaccess/inc/pch/precompiled_dba.hxx index acb731881764..b281a8b51193 100644 --- a/dbaccess/inc/pch/precompiled_dba.hxx +++ b/dbaccess/inc/pch/precompiled_dba.hxx @@ -99,7 +99,6 @@ #include <vcl/dllapi.h> #include <vcl/mapmod.hxx> #include <vcl/region.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/vclenum.hxx> #include <vcl/vclptr.hxx> #endif // PCH_LEVEL >= 2 diff --git a/desktop/inc/pch/precompiled_sofficeapp.hxx b/desktop/inc/pch/precompiled_sofficeapp.hxx index f39dc60aff16..3635613937e9 100644 --- a/desktop/inc/pch/precompiled_sofficeapp.hxx +++ b/desktop/inc/pch/precompiled_sofficeapp.hxx @@ -107,7 +107,6 @@ #include <vcl/font.hxx> #include <vcl/mapmod.hxx> #include <vcl/region.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/vclenum.hxx> #include <vcl/vclptr.hxx> #endif // PCH_LEVEL >= 2 diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index fa1c55c09e05..e5aaa66ddb35 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -4221,8 +4221,8 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis, BitmapEx aBmpEx = pDevice->GetBitmapEx({ 0, 0 }, { nCanvasWidth, nCanvasHeight }); Bitmap aBmp = aBmpEx.GetBitmap(); AlphaMask aAlpha = aBmpEx.GetAlphaMask(); - Bitmap::ScopedReadAccess sraBmp(aBmp); - AlphaMask::ScopedReadAccess sraAlpha(aAlpha); + BitmapScopedReadAccess sraBmp(aBmp); + BitmapScopedReadAccess sraAlpha(aAlpha); assert(sraBmp->Height() == nCanvasHeight); assert(sraBmp->Width() == nCanvasWidth); diff --git a/drawinglayer/inc/texture/texture3d.hxx b/drawinglayer/inc/texture/texture3d.hxx index 88d13ed03b7c..07f4b181b2ad 100644 --- a/drawinglayer/inc/texture/texture3d.hxx +++ b/drawinglayer/inc/texture/texture3d.hxx @@ -21,6 +21,7 @@ #include <texture/texture.hxx> #include <vcl/bitmapex.hxx> +#include <vcl/BitmapReadAccess.hxx> namespace drawinglayer::primitive3d { class HatchTexturePrimitive3D; @@ -53,9 +54,9 @@ namespace drawinglayer::texture protected: BitmapEx maBitmapEx; Bitmap maBitmap; // Bitmap held within maBitmapEx, to exist during mpReadBitmap scope - Bitmap::ScopedReadAccess mpReadBitmap; + BitmapScopedReadAccess mpReadBitmap; Bitmap maTransparence; - Bitmap::ScopedReadAccess mpReadTransparence; + BitmapScopedReadAccess mpReadTransparence; basegfx::B2DPoint maTopLeft; basegfx::B2DVector maSize; double mfMulX; diff --git a/drawinglayer/qa/unit/vclmetafileprocessor2d.cxx b/drawinglayer/qa/unit/vclmetafileprocessor2d.cxx index 478645cbf5b1..f34ef8a1bb6f 100644 --- a/drawinglayer/qa/unit/vclmetafileprocessor2d.cxx +++ b/drawinglayer/qa/unit/vclmetafileprocessor2d.cxx @@ -133,7 +133,7 @@ public: CPPUNIT_ASSERT(renderer->draw()); exportDevice("test-tdf136957", mVclDevice); Bitmap bitmap = mVclDevice->GetBitmap(Point(), Size(1920, 1080)); - Bitmap::ScopedReadAccess access(bitmap); + BitmapScopedReadAccess access(bitmap); // There should be a dotted line, without the fix it wouldn't be there, so check // there's a sufficient amount of non-white pixels and that's the line. int nonWhiteCount = 0; diff --git a/drawinglayer/qa/unit/vclpixelprocessor2d.cxx b/drawinglayer/qa/unit/vclpixelprocessor2d.cxx index 4362d3e55f19..c132d0927408 100644 --- a/drawinglayer/qa/unit/vclpixelprocessor2d.cxx +++ b/drawinglayer/qa/unit/vclpixelprocessor2d.cxx @@ -117,7 +117,7 @@ public: exportDevice("test-tdf139000.png", device); Bitmap bitmap = device->GetBitmap(Point(), device->GetOutputSizePixel()); - Bitmap::ScopedReadAccess access(bitmap); + BitmapScopedReadAccess access(bitmap); // The upper half should keep its red background color. CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_RED), access->GetColor(Point(0, 99))); // First line of the gradient should not be the start color, but something halfway. diff --git a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx index 53261229a0d7..89cb21ddcb74 100644 --- a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx @@ -174,8 +174,8 @@ std::vector<sal_uInt8> createBitmapData(const BitmapEx& rBitmapEx) if (bAlpha) { Bitmap aSrcAlpha(rBitmapEx.GetAlphaMask().GetBitmap()); - Bitmap::ScopedReadAccess pReadAccess(const_cast<Bitmap&>(rBitmapEx.GetBitmap())); - Bitmap::ScopedReadAccess pAlphaReadAccess(aSrcAlpha.AcquireReadAccess(), aSrcAlpha); + BitmapScopedReadAccess pReadAccess(rBitmapEx.GetBitmap()); + BitmapScopedReadAccess pAlphaReadAccess(aSrcAlpha); const tools::Long nHeight(pReadAccess->Height()); const tools::Long nWidth(pReadAccess->Width()); @@ -198,7 +198,7 @@ std::vector<sal_uInt8> createBitmapData(const BitmapEx& rBitmapEx) } else { - Bitmap::ScopedReadAccess pReadAccess(const_cast<Bitmap&>(rBitmapEx.GetBitmap())); + BitmapScopedReadAccess pReadAccess(rBitmapEx.GetBitmap()); const tools::Long nHeight(pReadAccess->Height()); const tools::Long nWidth(pReadAccess->Width()); diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx index 7671e0c29a05..6bfc95878332 100644 --- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx @@ -399,8 +399,8 @@ sal::systools::COMReference<ID2D1Bitmap> createB2DBitmap(const BitmapEx& rBitmap if (bAlpha) { Bitmap aSrcAlpha(rBitmapEx.GetAlphaMask().GetBitmap()); - Bitmap::ScopedReadAccess pReadAccess(const_cast<Bitmap&>(rBitmapEx.GetBitmap())); - Bitmap::ScopedReadAccess pAlphaReadAccess(aSrcAlpha.AcquireReadAccess(), aSrcAlpha); + BitmapScopedReadAccess pReadAccess(rBitmapEx.GetBitmap()); + BitmapScopedReadAccess pAlphaReadAccess(aSrcAlpha); const tools::Long nHeight(pReadAccess->Height()); const tools::Long nWidth(pReadAccess->Width()); @@ -421,7 +421,7 @@ sal::systools::COMReference<ID2D1Bitmap> createB2DBitmap(const BitmapEx& rBitmap } else { - Bitmap::ScopedReadAccess pReadAccess(const_cast<Bitmap&>(rBitmapEx.GetBitmap())); + BitmapScopedReadAccess pReadAccess(const_cast<Bitmap&>(rBitmapEx.GetBitmap())); const tools::Long nHeight(pReadAccess->Height()); const tools::Long nWidth(pReadAccess->Width()); @@ -1076,7 +1076,7 @@ sal::systools::COMReference<ID2D1Bitmap> D2DPixelProcessor2D::implCreateAlpha_B2 std::unique_ptr<sal_uInt8[]> aData(new sal_uInt8[nPixelCount]); sal_uInt8* pTarget = aData.get(); Bitmap aSrcAlpha(aAlpha.GetBitmap()); - Bitmap::ScopedReadAccess pReadAccess(aSrcAlpha.AcquireReadAccess(), aSrcAlpha); + BitmapScopedReadAccess pReadAccess(aSrcAlpha); const tools::Long nHeight(pReadAccess->Height()); const tools::Long nWidth(pReadAccess->Width()); diff --git a/drawinglayer/source/texture/texture3d.cxx b/drawinglayer/source/texture/texture3d.cxx index 85870f70cc85..3ee751cbbda4 100644 --- a/drawinglayer/source/texture/texture3d.cxx +++ b/drawinglayer/source/texture/texture3d.cxx @@ -76,11 +76,11 @@ namespace drawinglayer::texture if(mbIsAlpha) { maTransparence = rBitmapEx.GetAlphaMask().GetBitmap(); - mpReadTransparence = Bitmap::ScopedReadAccess(maTransparence); + mpReadTransparence = maTransparence; } if (!maBitmap.IsEmpty()) - mpReadBitmap = Bitmap::ScopedReadAccess(maBitmap); + mpReadBitmap = maBitmap; SAL_WARN_IF(!mpReadBitmap, "drawinglayer", "GeoTexSvxBitmapEx: Got no read access to Bitmap"); if (mpReadBitmap) { diff --git a/editeng/inc/pch/precompiled_editeng.hxx b/editeng/inc/pch/precompiled_editeng.hxx index 5a89fbe7cace..32fecd6c60e2 100644 --- a/editeng/inc/pch/precompiled_editeng.hxx +++ b/editeng/inc/pch/precompiled_editeng.hxx @@ -114,7 +114,6 @@ #include <vcl/mapmod.hxx> #include <vcl/outdev.hxx> #include <vcl/region.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/task.hxx> diff --git a/emfio/source/reader/wmfreader.cxx b/emfio/source/reader/wmfreader.cxx index 1b5739b3b190..4c74229fc8c8 100644 --- a/emfio/source/reader/wmfreader.cxx +++ b/emfio/source/reader/wmfreader.cxx @@ -1003,7 +1003,7 @@ namespace emfio SAL_WARN( "emfio", "\tTODO Read DIB failed. Interrupting processing whole image. Please report bug report." ); if ( !aBmp.IsEmpty() ) { - Bitmap::ScopedReadAccess pBmp(aBmp); + BitmapScopedReadAccess pBmp(aBmp); for ( tools::Long y = 0; y < pBmp->Height(); y++ ) { for ( tools::Long x = 0; x < pBmp->Width(); x++ ) diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 3fd6e84db310..0c9875cf43af 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -1430,7 +1430,7 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co // Create a bitmap for the pattern with expected colors vcl::bitmap::RawBitmap aResult(Size(8, 8), 24); { - Bitmap::ScopedReadAccess pRead(aBmp); + BitmapScopedReadAccess pRead(aBmp); for (tools::Long y = 0; y < aResult.Height(); ++y) { diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index a9b73ddf9b65..0a93095d4ddf 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -5654,7 +5654,7 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, T if ( aSize.Height() > 64 ) aSize.setHeight( 64 ); - Bitmap::ScopedReadAccess pAcc(aBmp); + BitmapScopedReadAccess pAcc(aBmp); if( pAcc ) { sal_uLong nRt = 0, nGn = 0, nBl = 0; diff --git a/forms/source/component/imgprod.cxx b/forms/source/component/imgprod.cxx index 3f2e6bfdee5b..002ef0cc56e8 100644 --- a/forms/source/component/imgprod.cxx +++ b/forms/source/component/imgprod.cxx @@ -361,13 +361,15 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic ) { BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); Bitmap aBmp( aBmpEx.GetBitmap() ); - BitmapReadAccess* pBmpAcc = aBmp.AcquireReadAccess(); + BitmapScopedReadAccess pBmpAcc(aBmp); if( !pBmpAcc ) return; AlphaMask aMask( aBmpEx.GetAlphaMask() ); - BitmapReadAccess* pMskAcc = !aMask.IsEmpty() ? aMask.AcquireReadAccess() : nullptr; + BitmapScopedReadAccess pMskAcc; + if (!aMask.IsEmpty()) + pMskAcc = aMask; const tools::Long nWidth = pBmpAcc->Width(); const tools::Long nHeight = pBmpAcc->Height(); const tools::Long nStartX = 0; @@ -381,7 +383,7 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic ) { aMask = AlphaMask(aBmp.GetSizePixel()); aMask.Erase( 0 ); - pMskAcc = aMask.AcquireReadAccess(); + pMskAcc = aMask; } // create temporary list to hold interfaces @@ -464,9 +466,6 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic ) for (auto const& elem : aTmp) elem->setPixelsByLongs( nStartX, nStartY, nPartWidth, nPartHeight, aData, 0UL, nPartWidth ); } - - Bitmap::ReleaseAccess( pBmpAcc ); - Bitmap::ReleaseAccess( pMskAcc ); } diff --git a/framework/inc/pch/precompiled_fwk.hxx b/framework/inc/pch/precompiled_fwk.hxx index 36f1c78981af..286a89247753 100644 --- a/framework/inc/pch/precompiled_fwk.hxx +++ b/framework/inc/pch/precompiled_fwk.hxx @@ -109,7 +109,6 @@ #include <vcl/mapmod.hxx> #include <vcl/region.hxx> #include <vcl/rendercontext/RasterOp.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/task.hxx> diff --git a/include/vcl/BitmapInfoAccess.hxx b/include/vcl/BitmapInfoAccess.hxx index 6e255c97e7ec..7ded0c9a95da 100644 --- a/include/vcl/BitmapInfoAccess.hxx +++ b/include/vcl/BitmapInfoAccess.hxx @@ -16,9 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#ifndef INCLUDED_VCL_BITMAPINFOACCESS_HXX -#define INCLUDED_VCL_BITMAPINFOACCESS_HXX +#pragma once #include <vcl/dllapi.h> #include <vcl/bitmap.hxx> @@ -38,10 +36,13 @@ class VCL_DLLPUBLIC BitmapInfoAccess friend class BitmapReadAccess; public: - BitmapInfoAccess(Bitmap& rBitmap, BitmapAccessMode nMode = BitmapAccessMode::Info); + BitmapInfoAccess(const Bitmap& rBitmap, BitmapAccessMode nMode = BitmapAccessMode::Info); + BitmapInfoAccess(const AlphaMask& rBitmap, BitmapAccessMode nMode = BitmapAccessMode::Info); + virtual ~BitmapInfoAccess(); bool operator!() const { return mpBuffer == nullptr; } + explicit operator bool() const { return mpBuffer != nullptr; } tools::Long Width() const { return mpBuffer ? mpBuffer->mnWidth : 0L; } @@ -152,6 +153,47 @@ protected: BitmapAccessMode mnAccessMode; }; -#endif // INCLUDED_VCL_BITMAPINFOACCESS_HXX +class BitmapScopedInfoAccess +{ +public: + BitmapScopedInfoAccess(const Bitmap& rBitmap) + : moAccess(rBitmap) + { + } + BitmapScopedInfoAccess(const AlphaMask& rBitmap) + : moAccess(rBitmap) + { + } + BitmapScopedInfoAccess() {} + + BitmapScopedInfoAccess& operator=(const Bitmap& rBitmap) + { + moAccess.emplace(rBitmap); + return *this; + } + + BitmapScopedInfoAccess& operator=(const AlphaMask& rBitmap) + { + moAccess.emplace(rBitmap); + return *this; + } + + bool operator!() const { return !moAccess.has_value() || !*moAccess; } + explicit operator bool() const { return moAccess && bool(*moAccess); } + + void reset() { moAccess.reset(); } + + BitmapInfoAccess* get() { return moAccess ? &*moAccess : nullptr; } + const BitmapInfoAccess* get() const { return moAccess ? &*moAccess : nullptr; } + + BitmapInfoAccess* operator->() { return &*moAccess; } + const BitmapInfoAccess* operator->() const { return &*moAccess; } + + BitmapInfoAccess& operator*() { return *moAccess; } + const BitmapInfoAccess& operator*() const { return *moAccess; } + +private: + std::optional<BitmapInfoAccess> moAccess; +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/BitmapReadAccess.hxx b/include/vcl/BitmapReadAccess.hxx index 0d12bcae9dd6..5a99adb56bba 100644 --- a/include/vcl/BitmapReadAccess.hxx +++ b/include/vcl/BitmapReadAccess.hxx @@ -16,9 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#ifndef INCLUDED_VCL_BITMAPREADACCESS_HXX -#define INCLUDED_VCL_BITMAPREADACCESS_HXX +#pragma once #include <vcl/dllapi.h> #include <vcl/bitmap.hxx> @@ -33,7 +31,9 @@ class SAL_DLLPUBLIC_RTTI BitmapReadAccess : public BitmapInfoAccess friend class BitmapWriteAccess; public: - VCL_DLLPUBLIC BitmapReadAccess(Bitmap& rBitmap, + VCL_DLLPUBLIC BitmapReadAccess(const Bitmap& rBitmap, + BitmapAccessMode nMode = BitmapAccessMode::Read); + VCL_DLLPUBLIC BitmapReadAccess(const AlphaMask& rBitmap, BitmapAccessMode nMode = BitmapAccessMode::Read); VCL_DLLPUBLIC virtual ~BitmapReadAccess() override; @@ -189,6 +189,47 @@ public: static FncSetPixel SetPixelFunction(ScanlineFormat nFormat); }; -#endif // INCLUDED_VCL_BITMAPREADACCESS_HXX +class BitmapScopedReadAccess +{ +public: + BitmapScopedReadAccess(const Bitmap& rBitmap) + : moAccess(rBitmap) + { + } + BitmapScopedReadAccess(const AlphaMask& rBitmap) + : moAccess(rBitmap) + { + } + BitmapScopedReadAccess() {} + + BitmapScopedReadAccess& operator=(const Bitmap& rBitmap) + { + moAccess.emplace(rBitmap); + return *this; + } + + BitmapScopedReadAccess& operator=(const AlphaMask& rBitmap) + { + moAccess.emplace(rBitmap); + return *this; + } + + bool operator!() const { return !moAccess.has_value() || !*moAccess; } + explicit operator bool() const { return moAccess && bool(*moAccess); } + + void reset() { moAccess.reset(); } + + BitmapReadAccess* get() { return moAccess ? &*moAccess : nullptr; } + const BitmapReadAccess* get() const { return moAccess ? &*moAccess : nullptr; } + + BitmapReadAccess* operator->() { return &*moAccess; } + const BitmapReadAccess* operator->() const { return &*moAccess; } + + BitmapReadAccess& operator*() { return *moAccess; } + const BitmapReadAccess& operator*() const { return *moAccess; } + +private: + std::optional<BitmapReadAccess> moAccess; +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/bitmap/BitmapWriteAccess.hxx b/include/vcl/BitmapWriteAccess.hxx similarity index 67% rename from vcl/inc/bitmap/BitmapWriteAccess.hxx rename to include/vcl/BitmapWriteAccess.hxx index bc903769d679..9027210adb50 100644 --- a/vcl/inc/bitmap/BitmapWriteAccess.hxx +++ b/include/vcl/BitmapWriteAccess.hxx @@ -7,25 +7,18 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ - -#ifndef INCLUDED_VCL_INC_BITMAP_BITMAPWRITEACCESS_HXX -#define INCLUDED_VCL_INC_BITMAP_BITMAPWRITEACCESS_HXX +#pragma once #include <vcl/alpha.hxx> #include <vcl/bitmap.hxx> #include <vcl/BitmapReadAccess.hxx> #include <optional> -typedef vcl::ScopedBitmapAccess<BitmapWriteAccess, Bitmap, &Bitmap::AcquireWriteAccess> - BitmapScopedWriteAccess; - -typedef vcl::ScopedBitmapAccess<BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireAlphaWriteAccess> - AlphaScopedWriteAccess; - class VCL_DLLPUBLIC BitmapWriteAccess final : public BitmapReadAccess { public: BitmapWriteAccess(Bitmap& rBitmap); + BitmapWriteAccess(AlphaMask& rBitmap); virtual ~BitmapWriteAccess() override; void CopyScanline(tools::Long nY, const BitmapReadAccess& rReadAcc); @@ -89,6 +82,47 @@ private: BitmapWriteAccess& operator=(const BitmapWriteAccess&) = delete; }; -#endif +class BitmapScopedWriteAccess +{ +public: + BitmapScopedWriteAccess(Bitmap& rBitmap) + : moAccess(rBitmap) + { + } + BitmapScopedWriteAccess(AlphaMask& rBitmap) + : moAccess(rBitmap) + { + } + BitmapScopedWriteAccess() {} + + BitmapScopedWriteAccess& operator=(Bitmap& rBitmap) + { + moAccess.emplace(rBitmap); + return *this; + } + + BitmapScopedWriteAccess& operator=(AlphaMask& rBitmap) + { + moAccess.emplace(rBitmap); + return *this; + } + + bool operator!() const { return !moAccess.has_value() || !*moAccess; } + explicit operator bool() const { return moAccess && bool(*moAccess); } + + void reset() { moAccess.reset(); } + + BitmapWriteAccess* get() { return moAccess ? &*moAccess : nullptr; } + const BitmapWriteAccess* get() const { return moAccess ? &*moAccess : nullptr; } + + BitmapWriteAccess* operator->() { return &*moAccess; } + const BitmapWriteAccess* operator->() const { return &*moAccess; } + + BitmapWriteAccess& operator*() { return *moAccess; } + const BitmapWriteAccess& operator*() const { return *moAccess; } + +private: + std::optional<BitmapWriteAccess> moAccess; +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/alpha.hxx b/include/vcl/alpha.hxx index 65ad50cfb4ea..fb5be9c16388 100644 --- a/include/vcl/alpha.hxx +++ b/include/vcl/alpha.hxx @@ -62,13 +62,6 @@ public: // check if alpha is used, returns true if at least one pixel has transparence bool hasAlpha() const; - BitmapReadAccess* AcquireAlphaReadAccess() { return maBitmap.AcquireReadAccess(); } - BitmapWriteAccess* AcquireAlphaWriteAccess() { return maBitmap.AcquireWriteAccess(); } - static void ReleaseAccess( BitmapInfoAccess* pBitmapAccess ) { Bitmap::ReleaseAccess(pBitmapAccess); } - - typedef vcl::ScopedBitmapAccess<BitmapReadAccess, AlphaMask, &AlphaMask::AcquireAlphaReadAccess> ScopedReadAccess; - typedef vcl::ScopedBitmapAccess<BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireAlphaWriteAccess> ScopedWriteAccess; - bool IsEmpty() const { return maBitmap.IsEmpty(); } void SetEmpty() { maBitmap.SetEmpty(); } @@ -83,8 +76,6 @@ public: void SetPrefMapMode( const MapMode& rMapMode ) { maBitmap.SetPrefMapMode(rMapMode); } - BitmapReadAccess* AcquireReadAccess() { return maBitmap.AcquireReadAccess(); } - BitmapChecksum GetChecksum() const { return maBitmap.GetChecksum(); } bool Invert(); diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index 514eefea8f1b..8ce5d9cf74fa 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -26,7 +26,6 @@ #include <vcl/dllapi.h> #include <vcl/mapmod.hxx> #include <vcl/region.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/bitmap/BitmapTypes.hxx> #include <o3tl/typed_flags_set.hxx> @@ -605,16 +604,6 @@ public: SAL_DLLPRIVATE bool ImplMakeGreyscales(); -public: - - BitmapInfoAccess* AcquireInfoAccess(); - BitmapReadAccess* AcquireReadAccess(); - BitmapWriteAccess* AcquireWriteAccess(); - static void ReleaseAccess( BitmapInfoAccess* pAccess ); - - typedef vcl::ScopedBitmapAccess<BitmapReadAccess, Bitmap, &Bitmap::AcquireReadAccess> ScopedReadAccess; - typedef vcl::ScopedBitmapAccess<BitmapInfoAccess, Bitmap, &Bitmap::AcquireInfoAccess> ScopedInfoAccess; - private: SAL_DLLPRIVATE bool ImplConvertUp(vcl::PixelFormat ePixelFormat, Color const* pExtColor = nullptr); SAL_DLLPRIVATE bool ImplConvertDown8BPP(Color const* pExtColor = nullptr); diff --git a/include/vcl/scopedbitmapaccess.hxx b/include/vcl/scopedbitmapaccess.hxx deleted file mode 100644 index b06618091529..000000000000 --- a/include/vcl/scopedbitmapaccess.hxx +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_VCL_SCOPEDBITMAPACCESS_HXX -#define INCLUDED_VCL_SCOPEDBITMAPACCESS_HXX - -#include <sal/types.h> - -namespace vcl -{ - -/** This template handles BitmapAccess the RAII way. - - Please don't use directly, but through the ready-made typedefs - ScopedReadAccess and ScopedWriteAccess in classes Bitmap and - AlphaMask. - - Use as follows: - Bitmap aBitmap; - Bitmap::ScopedReadAccess pReadAccess( aBitmap ); - pReadAccess->SetPixel()... - - Bitmap aBitmap2; - BitmapScopedWriteAccess pWriteAccess( bCond ? aBitmap2.AcquireWriteAccess() : 0, aBitmap2 ); - if ( pWriteAccess )... - - @attention for practical reasons, ScopedBitmapAccess stores a - reference to the provided bitmap, thus, make sure that the bitmap - specified at construction time lives at least as long as the - ScopedBitmapAccess. - */ -template < class Access, class Bitmap, Access* (Bitmap::* Acquire)() > class ScopedBitmapAccess -{ -public: - explicit ScopedBitmapAccess( Bitmap& rBitmap ) : - mpAccess( nullptr ), - mpBitmap( &rBitmap ) - { - mpAccess = (mpBitmap->*Acquire)(); - } - - ScopedBitmapAccess( Access* pAccess, Bitmap& rBitmap ) : - mpAccess( pAccess ), - mpBitmap( &rBitmap ) - { - } - - ScopedBitmapAccess( ) : - mpAccess( nullptr ), - mpBitmap( nullptr ) - { - } - - // Move semantics - ScopedBitmapAccess &operator=(ScopedBitmapAccess&&other) - { - mpAccess=other.mpAccess; - mpBitmap=other.mpBitmap; - other.mpAccess = nullptr; - other.mpBitmap = nullptr; - return *this; - } - - // Disable copy from lvalue. - ScopedBitmapAccess(const ScopedBitmapAccess&) = delete; - ScopedBitmapAccess &operator=(const ScopedBitmapAccess&) = delete; - - ~ScopedBitmapAccess() COVERITY_NOEXCEPT_FALSE - { - if (mpAccess) - mpBitmap->ReleaseAccess( mpAccess ); - } - - void reset() - { - if (mpAccess) - { - mpBitmap->ReleaseAccess( mpAccess ); - mpAccess = nullptr; - } - } - - bool operator!() const { return !mpAccess; } - explicit operator bool() const - { - return mpAccess; - } - - Access* get() { return mpAccess; } - const Access* get() const { return mpAccess; } - - Access* operator->() { return mpAccess; } - const Access* operator->() const { return mpAccess; } - - Access& operator*() { return *mpAccess; } - const Access& operator*() const { return *mpAccess; } - -private: - Access* mpAccess; - Bitmap* mpBitmap; -}; - -} - -#endif // INCLUDED_VCL_SCOPEDBITMAPACCESS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/inc/pch/precompiled_rpt.hxx b/reportdesign/inc/pch/precompiled_rpt.hxx index f680e55fff5a..6e52bedf1e00 100644 --- a/reportdesign/inc/pch/precompiled_rpt.hxx +++ b/reportdesign/inc/pch/precompiled_rpt.hxx @@ -131,7 +131,6 @@ #include <vcl/rendercontext/State.hxx> #include <vcl/rendercontext/SystemTextColorFlags.hxx> #include <vcl/salnativewidgets.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/task.hxx> #include <vcl/timer.hxx> diff --git a/reportdesign/inc/pch/precompiled_rptui.hxx b/reportdesign/inc/pch/precompiled_rptui.hxx index cae7143cb082..9dc3e3fd6fe2 100644 --- a/reportdesign/inc/pch/precompiled_rptui.hxx +++ b/reportdesign/inc/pch/precompiled_rptui.hxx @@ -149,7 +149,6 @@ #include <vcl/rendercontext/State.hxx> #include <vcl/rendercontext/SystemTextColorFlags.hxx> #include <vcl/salnativewidgets.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/task.hxx> diff --git a/sc/inc/pch/precompiled_sc.hxx b/sc/inc/pch/precompiled_sc.hxx index df9c3c3322aa..0bd47079ec85 100644 --- a/sc/inc/pch/precompiled_sc.hxx +++ b/sc/inc/pch/precompiled_sc.hxx @@ -143,7 +143,6 @@ #include <vcl/mapmod.hxx> #include <vcl/outdev.hxx> #include <vcl/region.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/syswin.hxx> diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index c85089fc0736..8827b78afe64 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -396,7 +396,7 @@ void XclExpImgData::Save( XclExpStream& rStrm ) if (aBmp.getPixelFormat() != vcl::PixelFormat::N24_BPP) aBmp.Convert( BmpConversion::N24Bit ); - Bitmap::ScopedReadAccess pAccess(aBmp); + BitmapScopedReadAccess pAccess(aBmp); if( !pAccess ) return; diff --git a/sd/inc/pch/precompiled_sdui.hxx b/sd/inc/pch/precompiled_sdui.hxx index b74e188d61d5..00b2c8389df4 100644 --- a/sd/inc/pch/precompiled_sdui.hxx +++ b/sd/inc/pch/precompiled_sdui.hxx @@ -158,7 +158,6 @@ #include <vcl/rendercontext/SystemTextColorFlags.hxx> #include <vcl/salgtype.hxx> #include <vcl/salnativewidgets.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/scrollable.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> diff --git a/sd/qa/unit/PNGExportTests.cxx b/sd/qa/unit/PNGExportTests.cxx index da435ae971f1..645cf136b07f 100644 --- a/sd/qa/unit/PNGExportTests.cxx +++ b/sd/qa/unit/PNGExportTests.cxx @@ -75,7 +75,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf105998) // use assertColorsAreSimilar since the color might differ a little bit on mac Bitmap aBMP = aBMPEx.GetBitmap(); { - Bitmap::ScopedReadAccess pReadAccess(aBMP); + BitmapScopedReadAccess pReadAccess(aBMP); for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) { const Color aColorTop = pReadAccess->GetColor(0, nX); @@ -135,7 +135,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf126319) // Check all borders are red or similar. Ignore the corners Bitmap aBMP = aBMPEx.GetBitmap(); { - Bitmap::ScopedReadAccess pReadAccess(aBMP); + BitmapScopedReadAccess pReadAccess(aBMP); for (tools::Long nX = 2; nX < aSize.Width() - 2; ++nX) { const Color aColorTop = pReadAccess->GetColor(0, nX); @@ -195,7 +195,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf136632) vcl::PngImageReader aPNGReader(aFileStream); BitmapEx aBMPEx = aPNGReader.read(); AlphaMask aAlpha = aBMPEx.GetAlphaMask(); - AlphaMask::ScopedReadAccess pReadAccess(aAlpha); + BitmapScopedReadAccess pReadAccess(aAlpha); // Without the fix in place, this test would have failed here CPPUNIT_ASSERT(!pReadAccess); @@ -234,7 +234,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157652) Size aSize = aBMPEx.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); Bitmap aBMP = aBMPEx.GetBitmap(); - Bitmap::ScopedReadAccess pReadAccess(aBMP); + BitmapScopedReadAccess pReadAccess(aBMP); for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) { for (tools::Long nY = 1; nY < aSize.Height() - 1; ++nY) @@ -282,7 +282,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf156808) Size aSize = aBMPEx.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); Bitmap aBMP = aBMPEx.GetBitmap(); - Bitmap::ScopedReadAccess pReadAccess(aBMP); + BitmapScopedReadAccess pReadAccess(aBMP); int nBlackCount = 0; for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) { @@ -334,7 +334,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157795) Size aSize = aBMPEx.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); Bitmap aBMP = aBMPEx.GetBitmap(); - Bitmap::ScopedReadAccess pReadAccess(aBMP); + BitmapScopedReadAccess pReadAccess(aBMP); for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) { for (tools::Long nY = 1; nY < aSize.Height() - 1; ++nY) @@ -383,7 +383,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf105362) Size aSize = aBMPEx.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); Bitmap aBMP = aBMPEx.GetBitmap(); - Bitmap::ScopedReadAccess pReadAccess(aBMP); + BitmapScopedReadAccess pReadAccess(aBMP); for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) { for (tools::Long nY = 1; nY < aSize.Height() - 1; ++nY) @@ -431,7 +431,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157636) Size aSize = aBMPEx.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); Bitmap aBMP = aBMPEx.GetBitmap(); - Bitmap::ScopedReadAccess pReadAccess(aBMP); + BitmapScopedReadAccess pReadAccess(aBMP); int nBlackCount = 0; for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) { @@ -482,7 +482,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157793) Size aSize = aBMPEx.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); Bitmap aBMP = aBMPEx.GetBitmap(); - Bitmap::ScopedReadAccess pReadAccess(aBMP); + BitmapScopedReadAccess pReadAccess(aBMP); int nLightGrayCount = 0; for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) { @@ -533,7 +533,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157635) Size aSize = aBMPEx.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); Bitmap aBMP = aBMPEx.GetBitmap(); - Bitmap::ScopedReadAccess pReadAccess(aBMP); + BitmapScopedReadAccess pReadAccess(aBMP); int nBlackCount = 0; for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) { @@ -585,7 +585,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf113163) CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); Bitmap aBMP = aBMPEx.GetBitmap(); { - Bitmap::ScopedReadAccess pReadAccess(aBMP); + BitmapScopedReadAccess pReadAccess(aBMP); for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) { for (tools::Long nY = 1; nY < aSize.Height() - 1; ++nY) @@ -635,7 +635,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf147119) CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); AlphaMask aAlpha = aBMPEx.GetAlphaMask(); { - AlphaMask::ScopedReadAccess pReadAccess(aAlpha); + BitmapScopedReadAccess pReadAccess(aAlpha); for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) { for (tools::Long nY = 1; nY < aSize.Height() - 1; ++nY) @@ -684,7 +684,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf113197) CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); Bitmap aBMP = aBMPEx.GetBitmap(); { - Bitmap::ScopedReadAccess pReadAccess(aBMP); + BitmapScopedReadAccess pReadAccess(aBMP); for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) { // Check the bottom half of the document is white @@ -734,7 +734,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf93124) CPPUNIT_ASSERT_EQUAL(Size(320, 180), aBMPEx.GetSizePixel()); Bitmap aBMP = aBMPEx.GetBitmap(); { - Bitmap::ScopedReadAccess pReadAccess(aBMP); + BitmapScopedReadAccess pReadAccess(aBMP); int nNonWhiteCount = 0; // The word "Top" should be in rectangle 34,4 - 76,30. If text alignment is wrong, the rectangle will be white. for (tools::Long nY = 4; nY < (4 + 26); ++nY) @@ -789,7 +789,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf99729) vcl::PngImageReader aPNGReader(aFileStream); BitmapEx aBMPEx = aPNGReader.read(); Bitmap aBMP = aBMPEx.GetBitmap(); - Bitmap::ScopedReadAccess pRead(aBMP); + BitmapScopedReadAccess pRead(aBMP); for (tools::Long nX = 154; nX < (154 + 12); ++nX) { for (tools::Long nY = 16; nY < (16 + 96); ++nY) diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index da6572b8af5a..6b4e07cad33c 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -647,7 +647,7 @@ bool checkPatternValues(std::vector<sal_uInt8>& rExpected, Bitmap& rBitmap) const Color aFGColor(0xFF0000); const Color aBGColor(0xFFFFFF); - Bitmap::ScopedReadAccess pAccess(rBitmap); + BitmapScopedReadAccess pAccess(rBitmap); for (tools::Long y = 0; y < pAccess->Height(); ++y) { Scanline pScanline = pAccess->GetScanline(y); diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index dd0182ef8ea2..23d96e7595bd 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -2431,7 +2431,7 @@ static void assertTilePixelColor(SdXImpressDocument* pXImpressDocument, int nPix pXImpressDocument->paintTile(*pDevice, nCanvasSize, nCanvasSize, 0, 0, 15360, 7680); pDevice->EnableMapMode(false); Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, nTileSize)); - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); Color aActualColor(pAccess->GetPixel(nPixelX, nPixelY)); CPPUNIT_ASSERT_EQUAL(aColor, aActualColor); } diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx index 2db041e7e7e3..de555ceedb05 100644 --- a/sd/source/ui/dlg/vectdlg.cxx +++ b/sd/source/ui/dlg/vectdlg.cxx @@ -143,7 +143,7 @@ void SdVectorizeDlg::Calculate( Bitmap const & rBmp, GDIMetaFile& rMtf ) if (m_xCbFillHoles->get_active()) { GDIMetaFile aNewMtf; - Bitmap::ScopedReadAccess pRAcc(aTmp); + BitmapScopedReadAccess pRAcc(aTmp); if( pRAcc ) { diff --git a/slideshow/inc/pch/precompiled_slideshow.hxx b/slideshow/inc/pch/precompiled_slideshow.hxx index ef4e988c96b3..6b0b55d53341 100644 --- a/slideshow/inc/pch/precompiled_slideshow.hxx +++ b/slideshow/inc/pch/precompiled_slideshow.hxx @@ -130,7 +130,6 @@ #include <vcl/rendercontext/State.hxx> #include <vcl/rendercontext/SystemTextColorFlags.hxx> #include <vcl/salnativewidgets.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/task.hxx> #include <vcl/timer.hxx> diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 34bef2dcfe2d..7b189e4af414 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -6335,7 +6335,6 @@ include/vcl/salctype.hxx include/vcl/salgtype.hxx include/vcl/salnativewidgets.hxx include/vcl/scheduler.hxx -include/vcl/scopedbitmapaccess.hxx include/vcl/seleng.hxx include/vcl/settings.hxx include/vcl/split.hxx diff --git a/svtools/inc/pch/precompiled_svt.hxx b/svtools/inc/pch/precompiled_svt.hxx index 723464d627db..6d32b32206ca 100644 --- a/svtools/inc/pch/precompiled_svt.hxx +++ b/svtools/inc/pch/precompiled_svt.hxx @@ -125,7 +125,6 @@ #include <vcl/ptrstyle.hxx> #include <vcl/region.hxx> #include <vcl/rendercontext/RasterOp.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/syswin.hxx> diff --git a/svx/inc/pch/precompiled_svxcore.hxx b/svx/inc/pch/precompiled_svxcore.hxx index 0a21fe48f2a0..cc63b1b5a10c 100644 --- a/svx/inc/pch/precompiled_svxcore.hxx +++ b/svx/inc/pch/precompiled_svxcore.hxx @@ -137,7 +137,6 @@ #include <vcl/outdev.hxx> #include <vcl/ptrstyle.hxx> #include <vcl/region.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/syswin.hxx> diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx index 34a60fdbc3e4..3ac58e33394b 100644 --- a/svx/qa/unit/customshapes.cxx +++ b/svx/qa/unit/customshapes.cxx @@ -189,7 +189,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145700_3D_NonUI) vcl::PngImageReader aPNGReader(aFileStream); BitmapEx aBMPEx = aPNGReader.read(); Bitmap aBMP = aBMPEx.GetBitmap(); - Bitmap::ScopedReadAccess pRead(aBMP); + BitmapScopedReadAccess pRead(aBMP); Size aSize = aBMP.GetSizePixel(); // GetColor(Y,X) Color aActualColor = pRead->GetColor(aSize.Height() / 2, aSize.Width() * 0.125); @@ -225,7 +225,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145700_3D_FrontLightDim) vcl::PngImageReader aPNGReader(aFileStream); BitmapEx aBMPEx = aPNGReader.read(); Bitmap aBMP = aBMPEx.GetBitmap(); - Bitmap::ScopedReadAccess pRead(aBMP); + BitmapScopedReadAccess pRead(aBMP); Size aSize = aBMP.GetSizePixel(); // GetColor(Y,X) Color aActualColor = pRead->GetColor(aSize.Height() / 2, aSize.Width() * 0.4); @@ -252,7 +252,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145700_3D_FirstLightHarsh) vcl::PngImageReader aPNGReader(aFileStream); BitmapEx aBMPEx = aPNGReader.read(); Bitmap aBMP = aBMPEx.GetBitmap(); - Bitmap::ScopedReadAccess pRead(aBMP); + BitmapScopedReadAccess pRead(aBMP); Size aSize = aBMP.GetSizePixel(); // GetColor(Y,X) const Color aActualColor = pRead->GetColor(aSize.Height() / 2, aSize.Width() / 2); @@ -1221,7 +1221,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf148501_OctagonBevel) vcl::PngImageReader aPNGReader(aFileStream); BitmapEx aBMPEx = aPNGReader.read(); Bitmap aBMP = aBMPEx.GetBitmap(); - Bitmap::ScopedReadAccess pRead(aBMP); + BitmapScopedReadAccess pRead(aBMP); Size aSize = aBMP.GetSizePixel(); // GetColor(Y,X). The chosen threshold for the ColorDistance can be adapted if necessary. diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx index 15e638e445cf..e5f99a8f8f01 100644 --- a/svx/source/svdraw/svdetc.cxx +++ b/svx/source/svdraw/svdetc.cxx @@ -278,7 +278,7 @@ std::optional<Color> GetDraftFillColor(const SfxItemSet& rSet) if (nWidth <= 0 || nHeight <= 0) return {}; - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); if (pAccess) { diff --git a/sw/inc/pch/precompiled_msword.hxx b/sw/inc/pch/precompiled_msword.hxx index 26b8daf95af7..0ef260ea7fae 100644 --- a/sw/inc/pch/precompiled_msword.hxx +++ b/sw/inc/pch/precompiled_msword.hxx @@ -156,7 +156,6 @@ #include <vcl/rendercontext/State.hxx> #include <vcl/rendercontext/SystemTextColorFlags.hxx> #include <vcl/salnativewidgets.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/task.hxx> diff --git a/sw/inc/pch/precompiled_swui.hxx b/sw/inc/pch/precompiled_swui.hxx index 3cdac268bea0..0ed7216a6b27 100644 --- a/sw/inc/pch/precompiled_swui.hxx +++ b/sw/inc/pch/precompiled_swui.hxx @@ -154,7 +154,6 @@ #include <vcl/rendercontext/SystemTextColorFlags.hxx> #include <vcl/salgtype.hxx> #include <vcl/salnativewidgets.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/syswin.hxx> diff --git a/sw/inc/pch/precompiled_vbaswobj.hxx b/sw/inc/pch/precompiled_vbaswobj.hxx index 940f5d983087..c6e0bb176da7 100644 --- a/sw/inc/pch/precompiled_vbaswobj.hxx +++ b/sw/inc/pch/precompiled_vbaswobj.hxx @@ -136,7 +136,6 @@ #include <vcl/rendercontext/State.hxx> #include <vcl/rendercontext/SystemTextColorFlags.hxx> #include <vcl/salnativewidgets.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/task.hxx> diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index ebc094803153..553fbebbc6e3 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -1159,7 +1159,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156078) Graphic exported; GraphicFilter::LoadGraphic(maTempFile.GetURL(), {}, exported); Bitmap bmp = exported.GetBitmapEx().GetBitmap(); - Bitmap::ScopedReadAccess pAccess(bmp); + BitmapScopedReadAccess pAccess(bmp); // "1" must export to the top right corner; check its pixels bool numberPixelsFound = false; diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 36431f83856f..64d2f665a66d 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -1739,7 +1739,7 @@ static void assertTilePixelColor(SwXTextDocument* pXTextDocument, int nPixelX, i pXTextDocument->paintTile(*pDevice, nCanvasSize, nCanvasSize, 0, 0, 15360, 7680); pDevice->EnableMapMode(false); Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, nTileSize)); - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); Color aActualColor(pAccess->GetPixel(nPixelX, nPixelY)); CPPUNIT_ASSERT_EQUAL(aColor, aActualColor); } @@ -2843,7 +2843,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testSemiTransparent) /*nTilePosY=*/0, /*nTileWidth=*/15360, /*nTileHeight=*/7680); pDevice->EnableMapMode(false); Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, nTileSize)); - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); Color aColor(pAccess->GetPixel(255, 255)); // Without the accompanying fix in place, this test would have failed with 'Expected greater or @@ -2872,7 +2872,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testHighlightNumbering) /*nTilePosY=*/0, /*nTileWidth=*/15360, /*nTileHeight=*/7680); pDevice->EnableMapMode(false); Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, nTileSize)); - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); // Yellow highlighting over numbering Color aColor(pAccess->GetPixel(103, 148)); @@ -2897,7 +2897,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testHighlightNumbering_shd) /*nTilePosY=*/0, /*nTileWidth=*/15360, /*nTileHeight=*/7680); pDevice->EnableMapMode(false); Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, nTileSize)); - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); // No highlighting over numbering - w:shd does not apply to numbering. Color aColor(pAccess->GetPixel(103, 148)); @@ -2927,7 +2927,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testPilcrowRedlining) /*nTilePosY=*/0, /*nTileWidth=*/15360, /*nTileHeight=*/7680); pDevice->EnableMapMode(false); Bitmap aBitmap = pDevice->GetBitmap(Point(100, 100), Size(nTileSize, nTileSize)); - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); const char* aTexts[] = { "Insert paragraph break", @@ -3008,7 +3008,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testDoubleUnderlineAndStrikeOut) /*nTilePosY=*/0, /*nTileWidth=*/15360, /*nTileHeight=*/7680); pDevice->EnableMapMode(false); Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, nTileSize)); - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); bool bGreenLine = false; size_t nGreenLine = 0; // count green horizontal lines by tracking a column of pixels counting the @@ -3054,7 +3054,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testTdf43244_SpacesOnMargin) /*nTilePosY=*/0, /*nTileWidth=*/15360, /*nTileHeight=*/7680); pDevice->EnableMapMode(false); Bitmap aBitmap = pDevice->GetBitmap(Point(730, 120), Size(nTileSize, nTileSize)); - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); //Test if we see any spaces on the right margin in a 47x48 rectangle bool bSpaceFound = false; @@ -3097,7 +3097,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testClipText) /*nTilePosY=*/0, /*nTileWidth=*/15360, /*nTileHeight=*/7680); pDevice->EnableMapMode(false); Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, nTileSize)); - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); // check top margin, it's not white completely (i.e. showing top of letter "T") bool bClipTop = true; diff --git a/vbahelper/inc/pch/precompiled_msforms.hxx b/vbahelper/inc/pch/precompiled_msforms.hxx index 9afb398bbb2d..4718389ac675 100644 --- a/vbahelper/inc/pch/precompiled_msforms.hxx +++ b/vbahelper/inc/pch/precompiled_msforms.hxx @@ -106,7 +106,6 @@ #include <vcl/rendercontext/State.hxx> #include <vcl/rendercontext/SystemTextColorFlags.hxx> #include <vcl/salnativewidgets.hxx> -#include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/vclenum.hxx> #include <vcl/vclptr.hxx> diff --git a/vcl/backendtest/outputdevice/bitmap.cxx b/vcl/backendtest/outputdevice/bitmap.cxx index 9ea1a6f08d84..517be3968eb4 100644 --- a/vcl/backendtest/outputdevice/bitmap.cxx +++ b/vcl/backendtest/outputdevice/bitmap.cxx @@ -11,7 +11,7 @@ #include <test/outputdevice.hxx> #include <vcl/bitmapex.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> namespace vcl::test { @@ -104,7 +104,7 @@ Bitmap OutputDeviceTestBitmap::setupDrawBitmapExWithAlpha(vcl::PixelFormat aBitm AlphaMask aAlpha(aBitmapSize); { - AlphaScopedWriteAccess aWriteAccess(aAlpha); + BitmapScopedWriteAccess aWriteAccess(aAlpha); aWriteAccess->Erase(COL_ALPHA_TRANSPARENT); aWriteAccess->SetLineColor(Color(0xBB, 0xBB, 0xBB)); aWriteAccess->DrawRect(tools::Rectangle(0, 0, 8, 8)); @@ -153,7 +153,7 @@ BitmapEx OutputDeviceTestBitmap::setupDrawBlend(vcl::PixelFormat aBitmapFormat) AlphaMask aAlpha(aBitmapSize); { - AlphaScopedWriteAccess aWriteAccess(aAlpha); + BitmapScopedWriteAccess aWriteAccess(aAlpha); aWriteAccess->Erase(COL_ALPHA_TRANSPARENT); aWriteAccess->SetLineColor(Color(0xBB, 0xBB, 0xBB)); aWriteAccess->DrawRect(tools::Rectangle(0, 0, 8, 8)); diff --git a/vcl/backendtest/outputdevice/common.cxx b/vcl/backendtest/outputdevice/common.cxx index 38c616bf3c93..bd8b905f647f 100644 --- a/vcl/backendtest/outputdevice/common.cxx +++ b/vcl/backendtest/outputdevice/common.cxx @@ -10,7 +10,7 @@ #include <test/outputdevice.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> #include <salgdi.hxx> #include <map> diff --git a/vcl/inc/canvasbitmap.hxx b/vcl/inc/canvasbitmap.hxx index 54586a1ad60e..9460dcec96fc 100644 --- a/vcl/inc/canvasbitmap.hxx +++ b/vcl/inc/canvasbitmap.hxx @@ -26,6 +26,7 @@ #include <com/sun/star/rendering/XBitmapPalette.hpp> #include <vcl/bitmapex.hxx> +#include <vcl/BitmapReadAccess.hxx> namespace vcl::unotools { @@ -38,10 +39,10 @@ namespace vcl::unotools BitmapEx m_aBmpEx; ::Bitmap m_aBitmap; ::Bitmap m_aAlpha; - Bitmap::ScopedInfoAccess m_pBmpAcc; - Bitmap::ScopedInfoAccess m_pAlphaAcc; - std::optional<Bitmap::ScopedReadAccess> m_pBmpReadAcc; - std::optional<Bitmap::ScopedReadAccess> m_pAlphaReadAcc; + BitmapScopedInfoAccess m_pBmpAcc; + BitmapScopedInfoAccess m_pAlphaAcc; + std::optional<BitmapScopedReadAccess> m_pBmpReadAcc; + std::optional<BitmapScopedReadAccess> m_pAlphaReadAcc; css::uno::Sequence<sal_Int8> m_aComponentTags; css::uno::Sequence<sal_Int32> m_aComponentBitCounts; css::rendering::IntegerBitmapLayout m_aLayout; @@ -55,8 +56,8 @@ namespace vcl::unotools bool m_bPalette; SAL_DLLPRIVATE void setComponentInfo( sal_uInt32 redShift, sal_uInt32 greenShift, sal_uInt32 blueShift ); - Bitmap::ScopedReadAccess& getBitmapReadAccess(); - Bitmap::ScopedReadAccess& getAlphaReadAccess(); + BitmapScopedReadAccess& getBitmapReadAccess(); + BitmapScopedReadAccess& getAlphaReadAccess(); virtual ~VclCanvasBitmap() override; diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx index eace78ec0d85..fac11693cfa0 100644 --- a/vcl/inc/pch/precompiled_vcl.hxx +++ b/vcl/inc/pch/precompiled_vcl.hxx @@ -145,7 +145,7 @@ #include <basegfx/vector/b2enums.hxx> #include <basegfx/vector/b2isize.hxx> #include <basegfx/vector/b2ivector.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/datatransfer/XTransferable2.hpp> diff --git a/vcl/qa/cppunit/BackendTest.cxx b/vcl/qa/cppunit/BackendTest.cxx index c4cc184fb7ad..b45f5ee33fba 100644 --- a/vcl/qa/cppunit/BackendTest.cxx +++ b/vcl/qa/cppunit/BackendTest.cxx @@ -14,7 +14,7 @@ #include <tools/stream.hxx> #include <vcl/graphicfilter.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> #include <svdata.hxx> #include <salinst.hxx> @@ -1180,9 +1180,9 @@ public: // as the alpha mask. device->Erase(); alpha.Erase(255); // transparent - BitmapWriteAccess* alphaWrite = alpha.AcquireAlphaWriteAccess(); + BitmapScopedWriteAccess alphaWrite(alpha); alphaWrite->SetPixelIndex(0, 0, 255); // opaque - Bitmap::ReleaseAccess(alphaWrite); + alphaWrite.reset(); device->DrawBitmapEx(Point(2, 2), BitmapEx(bitmap, alpha)); exportDevice("blend_extended_04.png", device); CPPUNIT_ASSERT_EQUAL(COL_BLUE, device->GetPixel(Point(2, 2))); diff --git a/vcl/qa/cppunit/BitmapExTest.cxx b/vcl/qa/cppunit/BitmapExTest.cxx index 8313de37fc60..9b40df6cafbe 100644 --- a/vcl/qa/cppunit/BitmapExTest.cxx +++ b/vcl/qa/cppunit/BitmapExTest.cxx @@ -13,7 +13,7 @@ #include <vcl/bitmapex.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> #include <svdata.hxx> #include <salinst.hxx> @@ -47,7 +47,7 @@ void BitmapExTest::testGetPixelColor24_8() } AlphaMask aMask(Size(3, 3)); { - AlphaScopedWriteAccess pWriteAccess(aMask); + BitmapScopedWriteAccess pWriteAccess(aMask); pWriteAccess->Erase(Color(ColorTransparency, 0x00, 0xAA, 0xAA, 0xAA)); } @@ -95,7 +95,7 @@ void BitmapExTest::testTransformBitmapEx() aMatrix.rotate(M_PI / 2); BitmapEx aTransformed = aBitmapEx.TransformBitmapEx(16, 16, aMatrix); aBitmap = aTransformed.GetBitmap(); - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); for (int i = 0; i < 16; ++i) { for (int j = 0; j < 16; ++j) @@ -126,49 +126,49 @@ void BitmapExTest::testAlphaBlendWith() bitmap.Erase(64); alpha.BlendWith(bitmap); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255 - 112), - AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0)); + BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0)); alpha.Erase(12); bitmap.Erase(64); alpha.BlendWith(bitmap); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255 - 73), - AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0)); + BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0)); alpha.Erase(12); bitmap.Erase(12); alpha.BlendWith(bitmap); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255 - 24), - AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0)); + BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0)); alpha.Erase(127); bitmap.Erase(13); alpha.BlendWith(bitmap); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255 - 134), - AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0)); + BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0)); alpha.Erase(255); bitmap.Erase(255); alpha.BlendWith(bitmap); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255 - 255), - AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0)); + BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0)); alpha.Erase(0); bitmap.Erase(255); alpha.BlendWith(bitmap); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255 - 255), - AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0)); + BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0)); alpha.Erase(255); bitmap.Erase(0); alpha.BlendWith(bitmap); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255 - 255), - AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0)); + BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0)); alpha.Erase(0); bitmap.Erase(0); alpha.BlendWith(bitmap); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255 - 0), - AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0)); + BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0)); } void BitmapExTest::testCreateMask() @@ -181,7 +181,7 @@ void BitmapExTest::testCreateMask() pWriteAccess->SetPixel(i, i, COL_RED); } aBitmap = aBitmap.CreateMask(COL_RED, 1); - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); // the output is a greyscale palette bitmap CPPUNIT_ASSERT_EQUAL(sal_uInt8(0xff), pAccess->GetPixelIndex(0, 0)); CPPUNIT_ASSERT_EQUAL(sal_uInt8(0x00), pAccess->GetPixelIndex(0, 1)); @@ -205,7 +205,7 @@ void BitmapExTest::testCombineMaskOr() } AlphaMask aAlphaBitmap(Size(3, 3)); { - AlphaMask::ScopedWriteAccess pWriteAccess(aAlphaBitmap); + BitmapScopedWriteAccess pWriteAccess(aAlphaBitmap); pWriteAccess->Erase(Color(0xff, 0xff, 0xff)); for (int i = 1; i < 3; ++i) { @@ -217,7 +217,7 @@ void BitmapExTest::testCombineMaskOr() { AlphaMask aMask = aBitmap.CreateAlphaMask(COL_RED, 1); - AlphaMask::ScopedReadAccess pAccess(aMask); + BitmapScopedReadAccess pAccess(aMask); // the output is a greyscale palette bitmap CPPUNIT_ASSERT_EQUAL(sal_uInt8(0xff), pAccess->GetPixelIndex(0, 0)); CPPUNIT_ASSERT_EQUAL(sal_uInt8(0xff), pAccess->GetPixelIndex(0, 1)); diff --git a/vcl/qa/cppunit/BitmapFilterTest.cxx b/vcl/qa/cppunit/BitmapFilterTest.cxx index a2aa37ceb900..0432041cac7c 100644 --- a/vcl/qa/cppunit/BitmapFilterTest.cxx +++ b/vcl/qa/cppunit/BitmapFilterTest.cxx @@ -10,7 +10,7 @@ #include <test/bootstrapfixture.hxx> #include <vcl/bitmap.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> #include <tools/stream.hxx> #include <vcl/graphicfilter.hxx> @@ -130,7 +130,7 @@ void BitmapFilterTest::testBlurCorrectness() CPPUNIT_ASSERT(BitmapSymmetryCheck::check(aBitmap24Bit)); { - Bitmap::ScopedReadAccess aReadAccess(aBitmap24Bit); + BitmapScopedReadAccess aReadAccess(aBitmap24Bit); CPPUNIT_ASSERT_EQUAL(scanlineFormat, aReadAccess->GetScanlineFormat()); } } diff --git a/vcl/qa/cppunit/BitmapProcessorTest.cxx b/vcl/qa/cppunit/BitmapProcessorTest.cxx index 0852a33914b0..874419092d30 100644 --- a/vcl/qa/cppunit/BitmapProcessorTest.cxx +++ b/vcl/qa/cppunit/BitmapProcessorTest.cxx @@ -16,7 +16,7 @@ #include <vcl/alpha.hxx> #include <bitmap/BitmapDisabledImageFilter.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> namespace { @@ -42,7 +42,7 @@ void BitmapProcessorTest::testDisabledImage() BitmapEx aDisabledBitmapEx(aDisabledImageFilter.execute(aBitmapEx)); Bitmap aDisabledBitmap(aDisabledBitmapEx.GetBitmap()); { - Bitmap::ScopedReadAccess pReadAccess(aDisabledBitmap); + BitmapScopedReadAccess pReadAccess(aDisabledBitmap); Color aColor(pReadAccess->GetPixel(0, 0)); CPPUNIT_ASSERT_EQUAL(Color(0x00C5C5C5), aColor); } @@ -56,7 +56,7 @@ void BitmapProcessorTest::testDisabledImage() } AlphaMask aMask(Size(3, 3)); { - AlphaScopedWriteAccess pWriteAccess(aMask); + BitmapScopedWriteAccess pWriteAccess(aMask); pWriteAccess->Erase(Color(ColorTransparency, 0x00, 0xAA, 0xAA, 0xAA)); } @@ -66,13 +66,13 @@ void BitmapProcessorTest::testDisabledImage() Bitmap aDisabledBitmap(aDisabledBitmapEx.GetBitmap()); { - Bitmap::ScopedReadAccess pReadAccess(aDisabledBitmap); + BitmapScopedReadAccess pReadAccess(aDisabledBitmap); Color aColor(pReadAccess->GetPixel(0, 0)); CPPUNIT_ASSERT_EQUAL(Color(0x00C5C5C5), aColor); } AlphaMask aDisabledAlphaMask(aDisabledBitmapEx.GetAlphaMask()); { - AlphaMask::ScopedReadAccess pReadAccess(aDisabledAlphaMask); + BitmapScopedReadAccess pReadAccess(aDisabledAlphaMask); Color aColor(pReadAccess->GetPixel(0, 0)); CPPUNIT_ASSERT_EQUAL(Color(0x0000AA), aColor); } diff --git a/vcl/qa/cppunit/BitmapScaleTest.cxx b/vcl/qa/cppunit/BitmapScaleTest.cxx index ce8f67437d9d..9bb6a48e4872 100644 --- a/vcl/qa/cppunit/BitmapScaleTest.cxx +++ b/vcl/qa/cppunit/BitmapScaleTest.cxx @@ -17,7 +17,7 @@ #include <vcl/graphicfilter.hxx> #include <BitmapSymmetryCheck.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> namespace { @@ -38,7 +38,7 @@ bool checkBitmapColor(Bitmap const& rBitmap, Color const& rExpectedColor) { bool bResult = true; Bitmap aBitmap(rBitmap); - Bitmap::ScopedReadAccess pReadAccess(aBitmap); + BitmapScopedReadAccess pReadAccess(aBitmap); tools::Long nHeight = pReadAccess->Height(); tools::Long nWidth = pReadAccess->Width(); for (tools::Long y = 0; y < nHeight; ++y) diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx index dfcf44a8f6a7..e00f2e0dc873 100644 --- a/vcl/qa/cppunit/BitmapTest.cxx +++ b/vcl/qa/cppunit/BitmapTest.cxx @@ -21,7 +21,7 @@ #include <vcl/skia/SkiaHelper.hxx> #include <vcl/BitmapMonochromeFilter.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> #include <bitmap/Octree.hxx> #include <salinst.hxx> #include <svdata.hxx> @@ -271,7 +271,7 @@ void BitmapTest::testConvert() CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, aBitmap.getPixelFormat()); { - Bitmap::ScopedReadAccess pReadAccess(aBitmap); + BitmapScopedReadAccess pReadAccess(aBitmap); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(8), pReadAccess->GetBitCount()); #if defined MACOSX || defined IOS if (SkiaHelper::isVCLSkiaEnabled()) @@ -293,7 +293,7 @@ void BitmapTest::testConvert() CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N24_BPP, aBitmap.getPixelFormat()); { - Bitmap::ScopedReadAccess pReadAccess(aBitmap); + BitmapScopedReadAccess pReadAccess(aBitmap); // 24 bit Bitmap on SVP backend can now use 24bit RGB everywhere. CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(24), pReadAccess->GetBitCount()); @@ -450,7 +450,7 @@ void BitmapTest::testCustom8BitPalette() } { - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); CPPUNIT_ASSERT_EQUAL(0, int(pAccess->GetPixelIndex(0, 0))); CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0xCC, 0x22), pAccess->GetColor(0, 0)); @@ -479,7 +479,7 @@ void BitmapTest::testErase() pWriteAccess->Erase(Color(0x11, 0x22, 0x33)); } { - Bitmap::ScopedReadAccess pReadAccess(aBitmap); + BitmapScopedReadAccess pReadAccess(aBitmap); BitmapColor aColor(pReadAccess->GetPixel(0, 0)); CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x11, 0x22, 0x33, 0x00), aColor); } @@ -500,7 +500,7 @@ void BitmapTest::testBitmap32() pWriteAccess->SetPixel(2, 2, BitmapColor(ColorTransparency, 0x99, 0x77, 0x66, 0x55)); } { - Bitmap::ScopedReadAccess pReadAccess(aBitmap); + BitmapScopedReadAccess pReadAccess(aBitmap); BitmapColor aColor = pReadAccess->GetPixel(0, 0); CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x00, 0xFF), aColor); @@ -532,7 +532,7 @@ void BitmapTest::testOctree() { // Reduce to 1 color - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); Octree aOctree(*pAccess, 1); auto aBitmapPalette = aOctree.GetPalette(); CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), aBitmapPalette.GetEntryCount()); @@ -541,7 +541,7 @@ void BitmapTest::testOctree() { // Reduce to 4 color - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); Octree aOctree(*pAccess, 4); auto aBitmapPalette = aOctree.GetPalette(); CPPUNIT_ASSERT_EQUAL(sal_uInt16(4), aBitmapPalette.GetEntryCount()); @@ -553,7 +553,7 @@ void BitmapTest::testOctree() { // Reduce to 256 color - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); Octree aOctree(*pAccess, 256); auto aBitmapPalette = aOctree.GetPalette(); CPPUNIT_ASSERT_EQUAL(sal_uInt16(74), aBitmapPalette.GetEntryCount()); diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx index 94cbd654b5ce..557ac41df2ef 100644 --- a/vcl/qa/cppunit/GraphicTest.cxx +++ b/vcl/qa/cppunit/GraphicTest.cxx @@ -123,7 +123,7 @@ bool checkBitmap(Graphic& rGraphic) Bitmap aBitmap(rGraphic.GetBitmapEx().GetBitmap()); { - Bitmap::ScopedReadAccess pReadAccess(aBitmap); + BitmapScopedReadAccess pReadAccess(aBitmap); for (tools::Long y = 0; y < rGraphic.GetSizePixel().Height(); y++) { for (tools::Long x = 0; x < rGraphic.GetSizePixel().Width(); x++) diff --git a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx index dbe02d455b04..991f202cefe1 100644 --- a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx +++ b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx @@ -260,7 +260,7 @@ void BitmapRenderTest::testTdf116888() Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap(); CPPUNIT_ASSERT(!aBitmap.IsEmpty()); aBitmap.Scale(0.8, 0.8); // This scaling discards mpUserData, - Bitmap::ScopedReadAccess pAccess(aBitmap); // forcing ReadTexture() here. + BitmapScopedReadAccess pAccess(aBitmap); // forcing ReadTexture() here. // Check that there is mpUserBuffer content. CPPUNIT_ASSERT(pAccess); const ScanlineFormat eFormat = pAccess->GetScanlineFormat(); diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx index d2a62ad8bfce..91db2e4f73f3 100644 --- a/vcl/qa/cppunit/canvasbitmaptest.cxx +++ b/vcl/qa/cppunit/canvasbitmaptest.cxx @@ -36,7 +36,7 @@ #include <vcl/bitmapex.hxx> #include <canvasbitmap.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> #include <algorithm> @@ -87,7 +87,7 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp, int extraBpp = 0; { - Bitmap::ScopedReadAccess pAcc( aContainedBmp ); + BitmapScopedReadAccess pAcc( aContainedBmp ); nDepth = pAcc->GetBitCount(); if( pAcc->GetScanlineFormat() == ScanlineFormat::N32BitTcMask ) extraBpp = 8; // the format has 8 unused bits @@ -675,7 +675,7 @@ void CanvasBitmapTest::runTest() AlphaMask aMask(Size(200,200)); aMask.Erase(255); { - AlphaMask::ScopedWriteAccess pAcc(aMask); + BitmapScopedWriteAccess pAcc(aMask); if( pAcc.get() ) { pAcc->SetFillColor(COL_ALPHA_OPAQUE); @@ -693,7 +693,7 @@ void CanvasBitmapTest::runTest() AlphaMask aAlpha(Size(200,200)); aAlpha.Erase(0); { - BitmapWriteAccess* pAcc = aAlpha.AcquireAlphaWriteAccess(); + BitmapScopedWriteAccess pAcc(aAlpha); if( pAcc ) { pAcc->SetFillColor(COL_ALPHA_OPAQUE); @@ -701,7 +701,6 @@ void CanvasBitmapTest::runTest() pAcc->SetPixel(0,0,BitmapColor(0)); pAcc->SetPixel(0,1,BitmapColor(255)); pAcc->SetPixel(0,2,BitmapColor(0)); - Bitmap::ReleaseAccess(pAcc); } } @@ -724,7 +723,7 @@ void CanvasBitmapTest::runTest() vcl::PixelFormat::N8_BPP, aBmp.getPixelFormat()); { Bitmap aBitmap = aBmp.GetBitmap(); - BitmapReadAccess* pBmpAcc = aBitmap.AcquireReadAccess(); + BitmapScopedReadAccess pBmpAcc(aBitmap); CPPUNIT_ASSERT_MESSAGE( "Bitmap has invalid BitmapReadAccess", pBmpAcc ); @@ -735,8 +734,6 @@ void CanvasBitmapTest::runTest() BitmapColor(2), pBmpAcc->GetPixel(2,2)); CPPUNIT_ASSERT_EQUAL_MESSAGE("(9,2) incorrect content", BitmapColor(9), pBmpAcc->GetPixel(2,9)); - - Bitmap::ReleaseAccess(pBmpAcc); } xTestBmp.set( new TestBitmap( geometry::IntegerSize2D(10,10), false )); @@ -750,9 +747,9 @@ void CanvasBitmapTest::runTest() vcl::PixelFormat::N24_BPP, aBmp.getPixelFormat()); { Bitmap aBitmap = aBmp.GetBitmap(); - BitmapReadAccess* pBmpAcc = aBitmap.AcquireReadAccess(); + BitmapScopedReadAccess pBmpAcc(aBitmap); AlphaMask aBitmapAlpha = aBmp.GetAlphaMask(); - BitmapReadAccess* pAlphaAcc = aBitmapAlpha.AcquireReadAccess(); + BitmapScopedReadAccess pAlphaAcc(aBitmapAlpha); CPPUNIT_ASSERT_MESSAGE( "Bitmap has invalid BitmapReadAccess", pBmpAcc); @@ -771,9 +768,6 @@ void CanvasBitmapTest::runTest() BitmapColor(0,3,9), pBmpAcc->GetPixel(2,9)); CPPUNIT_ASSERT_EQUAL_MESSAGE("(9,2) correct alpha content", BitmapColor(2), pAlphaAcc->GetPixel(2,9)); - - Bitmap::ReleaseAccess(pAlphaAcc); - Bitmap::ReleaseAccess(pBmpAcc); } } diff --git a/vcl/qa/cppunit/cjktext.cxx b/vcl/qa/cppunit/cjktext.cxx index 91d14805544d..8dbed792b97c 100644 --- a/vcl/qa/cppunit/cjktext.cxx +++ b/vcl/qa/cppunit/cjktext.cxx @@ -63,7 +63,7 @@ public: static tools::Long getCharacterTopWidth(VirtualDevice* device, const Point& start) { Bitmap bitmap = device->GetBitmap(Point(), device->GetOutputSizePixel()); - Bitmap::ScopedReadAccess access(bitmap); + BitmapScopedReadAccess access(bitmap); tools::Long y = start.Y(); while (y < bitmap.GetSizePixel().Height() && access->GetColor(y, start.X()) != COL_BLACK) ++y; @@ -82,7 +82,7 @@ static tools::Long getCharacterTopWidth(VirtualDevice* device, const Point& star static tools::Long getCharacterRightSideHeight(VirtualDevice* device, const Point& start) { Bitmap bitmap = device->GetBitmap(Point(), device->GetOutputSizePixel()); - Bitmap::ScopedReadAccess access(bitmap); + BitmapScopedReadAccess access(bitmap); tools::Long x = start.X(); while (x >= 0 && access->GetColor(start.Y(), x) != COL_BLACK) --x; diff --git a/vcl/qa/cppunit/drawmode.cxx b/vcl/qa/cppunit/drawmode.cxx index 9a1408bb2ec9..3dce4a7af636 100644 --- a/vcl/qa/cppunit/drawmode.cxx +++ b/vcl/qa/cppunit/drawmode.cxx @@ -16,7 +16,7 @@ #include <vcl/metric.hxx> #include <vcl/settings.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> #include <drawmode.hxx> class VclDrawModeTest : public test::BootstrapFixture @@ -340,7 +340,7 @@ void VclDrawModeTest::testDrawModeBitmapEx() { BitmapEx aResultBitmapEx(vcl::drawmode::GetBitmapEx(aBmpEx, DrawModeFlags::GrayBitmap)); Bitmap aResultBitmap(aResultBitmapEx.GetBitmap()); - Bitmap::ScopedReadAccess pReadAccess(aResultBitmap); + BitmapScopedReadAccess pReadAccess(aResultBitmap); const BitmapColor& rColor = pReadAccess->GetColor(0, 0); CPPUNIT_ASSERT_EQUAL(BitmapColor(0x26, 0x26, 0x26), rColor); @@ -350,7 +350,7 @@ void VclDrawModeTest::testDrawModeBitmapEx() { BitmapEx aResultBitmapEx(vcl::drawmode::GetBitmapEx(aBmpEx, DrawModeFlags::NoFill)); Bitmap aResultBitmap(aResultBitmapEx.GetBitmap()); - Bitmap::ScopedReadAccess pReadAccess(aResultBitmap); + BitmapScopedReadAccess pReadAccess(aResultBitmap); const BitmapColor& rColor = pReadAccess->GetColor(0, 0); CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_RED), rColor); diff --git a/vcl/qa/cppunit/gen/gen.cxx b/vcl/qa/cppunit/gen/gen.cxx index a716711c9ab4..29d950113282 100644 --- a/vcl/qa/cppunit/gen/gen.cxx +++ b/vcl/qa/cppunit/gen/gen.cxx @@ -42,7 +42,7 @@ public: CPPUNIT_TEST_FIXTURE(GenTest, testTdf121120) { Bitmap aBitmap = load("tdf121120.png"); - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); const Size& rSize = aBitmap.GetSizePixel(); Color aColor(pAccess->GetPixel(rSize.getHeight() / 2, rSize.getWidth() / 2)); // Without the accompanying fix in place, this test would have failed with 'Expected: 255; @@ -79,7 +79,7 @@ CPPUNIT_TEST_FIXTURE(GenTest, testTdf107966) // Make sure that the polygon is visible. Bitmap aBitmap = pVirtualDevice->GetBitmap(Point(), Size(1350, 15)); - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); Color aPixel(pAccess->GetPixel(0, 0)); // Without the accompanying fix in place, this test would have failed with 'Expected: 000000; // Actual: ffffff', i.e. the top left pixel was white, not black. diff --git a/vcl/qa/cppunit/gradient.cxx b/vcl/qa/cppunit/gradient.cxx index 2f33f4b1a6d0..4af26d0be5d1 100644 --- a/vcl/qa/cppunit/gradient.cxx +++ b/vcl/qa/cppunit/gradient.cxx @@ -26,7 +26,7 @@ #include <vcl/gdimtf.hxx> #include <vcl/metaact.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> #include <bufferdevice.hxx> #include <window.h> diff --git a/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx index 56b2f1c5b087..4e7585398e19 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx @@ -13,7 +13,7 @@ #include <tools/stream.hxx> #include <vcl/graph.hxx> #include <vcl/graphicfilter.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> #include <graphic/GraphicFormatDetector.hxx> #include <filter/TiffReader.hxx> @@ -165,7 +165,7 @@ void TiffFilterTest::testTdf74331() CPPUNIT_ASSERT_EQUAL(tools::Long(200), aSize.Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(200), aSize.Height()); - Bitmap::ScopedReadAccess pReadAccess(aBitmap); + BitmapScopedReadAccess pReadAccess(aBitmap); // Check the image contains different kinds of grays int nGrayCount = 0; @@ -223,7 +223,7 @@ void TiffFilterTest::testRoundtrip() CPPUNIT_ASSERT_EQUAL(Size(2, 2), aResultBitmap.GetSizePixel()); { - Bitmap::ScopedReadAccess pAccess(aResultBitmap); + BitmapScopedReadAccess pAccess(aResultBitmap); CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(pAccess->GetPixel(0, 0))); CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(pAccess->GetPixel(0, 1))); CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, Color(pAccess->GetPixel(1, 0))); @@ -262,7 +262,7 @@ void TiffFilterTest::testRGB8bits() CPPUNIT_ASSERT_EQUAL(tools::Long(10), aSize.Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(10), aSize.Height()); - Bitmap::ScopedReadAccess pReadAccess(aBitmap); + BitmapScopedReadAccess pReadAccess(aBitmap); const Color aColor = pReadAccess->GetColor(5, 5); if (rName == u"red8.tif") @@ -297,7 +297,7 @@ void TiffFilterTest::testRGB16bits() CPPUNIT_ASSERT_EQUAL(tools::Long(10), aSize.Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(10), aSize.Height()); - Bitmap::ScopedReadAccess pReadAccess(aBitmap); + BitmapScopedReadAccess pReadAccess(aBitmap); const Color aColor = pReadAccess->GetColor(5, 5); if (rName == u"red16.tif") diff --git a/vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx index 0244c388ead8..d3c43f48191f 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx @@ -10,7 +10,7 @@ #include <unotest/filters-test.hxx> #include <test/bootstrapfixture.hxx> #include <vcl/FilterConfigItem.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> #include <tools/stream.hxx> #include <vcl/graph.hxx> #include <vcl/graphicfilter.hxx> @@ -94,7 +94,7 @@ void WebpFilterTest::testRoundtrip(bool lossy) pAccess->FillRect(tools::Rectangle(Point(0, 10), Size(10, 10))); pAccess->SetFillColor(COL_BLUE); pAccess->FillRect(tools::Rectangle(Point(10, 10), Size(10, 10))); - AlphaScopedWriteAccess pAccessAlpha(aAlpha); + BitmapScopedWriteAccess pAccessAlpha(aAlpha); pAccessAlpha->SetFillColor(BitmapColor(0)); // opaque pAccessAlpha->FillRect(tools::Rectangle(Point(0, 0), Size(10, 10))); pAccessAlpha->FillRect(tools::Rectangle(Point(10, 0), Size(10, 10))); @@ -124,7 +124,7 @@ void WebpFilterTest::testRoundtrip(bool lossy) { Bitmap tmpBitmap = aResultBitmap.GetBitmap(); - Bitmap::ScopedReadAccess pAccess(tmpBitmap); + BitmapScopedReadAccess pAccess(tmpBitmap); // Note that x,y are swapped. CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(pAccess->GetPixel(0, 0))); CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(pAccess->GetPixel(0, 19))); @@ -140,7 +140,7 @@ void WebpFilterTest::testRoundtrip(bool lossy) CPPUNIT_ASSERT_EQUAL(COL_BLUE, Color(pAccess->GetPixel(19, 19))); } AlphaMask tmpAlpha = aResultBitmap.GetAlphaMask(); - AlphaMask::ScopedReadAccess pAccessAlpha(tmpAlpha); + BitmapScopedReadAccess pAccessAlpha(tmpAlpha); CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), pAccessAlpha->GetPixelIndex(0, 0)); CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), pAccessAlpha->GetPixelIndex(0, 19)); CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), pAccessAlpha->GetPixelIndex(19, 0)); @@ -181,7 +181,7 @@ void WebpFilterTest::testRead(std::u16string_view rName, bool lossy, bool alpha) { Bitmap tmpBitmap = aResultBitmap.GetBitmap(); - Bitmap::ScopedReadAccess pAccess(tmpBitmap); + BitmapScopedReadAccess pAccess(tmpBitmap); // Note that x,y are swapped. if (lossy) CPPUNIT_ASSERT_LESS(sal_uInt16(2), pAccess->GetPixel(0, 0).GetColorError(COL_LIGHTRED)); @@ -191,7 +191,7 @@ void WebpFilterTest::testRead(std::u16string_view rName, bool lossy, bool alpha) if (alpha) { AlphaMask tmpAlpha = aResultBitmap.GetAlphaMask(); - AlphaMask::ScopedReadAccess pAccessAlpha(tmpAlpha); + BitmapScopedReadAccess pAccessAlpha(tmpAlpha); CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), pAccessAlpha->GetPixelIndex(0, 0)); CPPUNIT_ASSERT_EQUAL(sal_uInt8(255), pAccessAlpha->GetPixelIndex(0, 9)); } diff --git a/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx b/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx index 0900c02d4bb5..f83d58d51d73 100644 --- a/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx +++ b/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx @@ -14,7 +14,7 @@ #include <unotest/bootstrapfixturebase.hxx> #include <vcl/graphicfilter.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> #include <tools/stream.hxx> constexpr OUStringLiteral gaDataUrl(u"/vcl/qa/cppunit/jpeg/data/"); @@ -176,7 +176,7 @@ void JpegReaderTest::testTdf138950() CPPUNIT_ASSERT_EQUAL(tools::Long(720), aSize.Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(1280), aSize.Height()); - Bitmap::ScopedReadAccess pReadAccess(aBitmap); + BitmapScopedReadAccess pReadAccess(aBitmap); int nBlackCount = 0; for (tools::Long nY = 0; nY < aSize.Height(); ++nY) { diff --git a/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx b/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx index f9b58c30843b..c20dd9e8bcdb 100644 --- a/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx +++ b/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx @@ -79,7 +79,7 @@ BitmapEx JpegWriterTest::roundtripJPG(const BitmapEx& bitmap) void JpegWriterTest::testWrite8BitGrayscale() { Bitmap bitmap = roundtripJPG(getFullUrl(u"8BitGrayscale.jpg")).GetBitmap(); - Bitmap::ScopedReadAccess access(bitmap); + BitmapScopedReadAccess access(bitmap); const ScanlineFormat format = access->GetScanlineFormat(); // Check that it's still 8bit grayscale. CPPUNIT_ASSERT_EQUAL(ScanlineFormat::N8BitPal, format); @@ -95,7 +95,7 @@ void JpegWriterTest::testWrite8BitGrayscale() void JpegWriterTest::testWrite8BitNonGrayscale() { Bitmap bitmap = roundtripJPG(getFullUrl(u"8BitNonGrayscale.gif")).GetBitmap(); - Bitmap::ScopedReadAccess access(bitmap); + BitmapScopedReadAccess access(bitmap); const ScanlineFormat format = access->GetScanlineFormat(); // Check that it's still 8bit grayscale. CPPUNIT_ASSERT_EQUAL(ScanlineFormat::N8BitPal, format); diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx index 83325db08b60..12f1dea4e582 100644 --- a/vcl/qa/cppunit/outdev.cxx +++ b/vcl/qa/cppunit/outdev.cxx @@ -26,7 +26,7 @@ #include <vcl/gdimtf.hxx> #include <vcl/metaact.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> #include <bufferdevice.hxx> #include <window.h> @@ -110,7 +110,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testVirtualDevice) CPPUNIT_ASSERT_EQUAL(COL_WHITE, pVDev->GetPixel(Point(30, 31))); // Gotcha: y and x swap for BitmapReadAccess: deep joy. - Bitmap::ScopedReadAccess pAcc(aBmp); + BitmapScopedReadAccess pAcc(aBmp); CPPUNIT_ASSERT_EQUAL(COL_WHITE, static_cast<Color>(pAcc->GetPixel(0, 0))); #if !defined _WIN32 //TODO: various failures on Windows tinderboxes CPPUNIT_ASSERT_EQUAL(COL_BLUE, static_cast<Color>(pAcc->GetPixel(2, 1))); @@ -204,7 +204,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawBlackBitmap) // test to see if the color is black Bitmap aBlackBmp(pVDev->GetBitmap(Point(0, 0), Size(10, 10))); - Bitmap::ScopedReadAccess pReadAccess(aBlackBmp); + BitmapScopedReadAccess pReadAccess(aBlackBmp); const BitmapColor& rColor = pReadAccess->GetColor(0, 0); CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_BLACK), rColor); } @@ -248,7 +248,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawWhiteBitmap) // test to see if the color is white Bitmap aWhiteBmp(pVDev->GetBitmap(Point(0, 0), Size(10, 10))); - Bitmap::ScopedReadAccess pReadAccess(aWhiteBmp); + BitmapScopedReadAccess pReadAccess(aWhiteBmp); const BitmapColor& rColor = pReadAccess->GetColor(0, 0); CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_WHITE), rColor); } @@ -319,7 +319,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawGrayBitmap) // check to ensure that the bitmap is red { - Bitmap::ScopedReadAccess pReadAccess(aBmp); + BitmapScopedReadAccess pReadAccess(aBmp); const BitmapColor& rColor = pReadAccess->GetColor(0, 0); CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_RED), rColor); } @@ -332,7 +332,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawGrayBitmap) // should be a grey Bitmap aVDevBmp(pVDev->GetBitmap(Point(), Size(1, 1))); { - Bitmap::ScopedReadAccess pReadAccess(aVDevBmp); + BitmapScopedReadAccess pReadAccess(aVDevBmp); const BitmapColor& rColor = pReadAccess->GetColor(0, 0); CPPUNIT_ASSERT_EQUAL(BitmapColor(0x26, 0x26, 0x26), rColor); } @@ -379,7 +379,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawTransformedBitmapEx) CPPUNIT_ASSERT_EQUAL(Size(16, 16), aTransformedSize); aBitmap = rBitmapEx.GetBitmap(); - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); for (int i = 0; i < 16; ++i) { for (int j = 0; j < 16; ++j) @@ -438,7 +438,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawTransformedBitmapExFlip) const BitmapEx& rBitmapEx = pBitmapAction->GetBitmapEx(); aBitmap = rBitmapEx.GetBitmap(); - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); int nX = 8 * 0.25; int nY = 8 * 0.25; BitmapColor aColor = pAccess->GetPixel(nY, nX); diff --git a/vcl/qa/cppunit/png/PngFilterTest.cxx b/vcl/qa/cppunit/png/PngFilterTest.cxx index 51833b870d05..2e900ec41d4c 100644 --- a/vcl/qa/cppunit/png/PngFilterTest.cxx +++ b/vcl/qa/cppunit/png/PngFilterTest.cxx @@ -27,7 +27,7 @@ #include <vcl/filter/PngImageWriter.hxx> #include <vcl/BitmapReadAccess.hxx> #include <vcl/BitmapMonochromeFilter.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> #include <vcl/alpha.hxx> #include <vcl/graphicfilter.hxx> #include <unotools/tempfile.hxx> @@ -64,7 +64,7 @@ void checkImportExportPng(const OUString& sFilePath, const Case& aCase) CPPUNIT_ASSERT_MESSAGE(OString("Failed to read png from: " + sFilePath.toUtf8()).getStr(), bReadOk); Bitmap aImportedBitmap = aImportedBitmapEx.GetBitmap(); - Bitmap::ScopedInfoAccess pAccess(aImportedBitmap); + BitmapScopedInfoAccess pAccess(aImportedBitmap); auto nActualWidth = aImportedBitmapEx.GetSizePixel().Width(); auto nActualHeight = aImportedBitmapEx.GetSizePixel().Height(); auto nActualBpp = vcl::pixelFormatBitCount(aImportedBitmapEx.GetBitmap().getPixelFormat()); @@ -103,7 +103,7 @@ void checkImportExportPng(const OUString& sFilePath, const Case& aCase) CPPUNIT_ASSERT_MESSAGE( OString("Failed to read exported png: " + sFilePath.toUtf8()).getStr(), bReadOk); Bitmap aExportedImportedBitmap = aExportedImportedBitmapEx.GetBitmap(); - Bitmap::ScopedInfoAccess pAccess(aExportedImportedBitmap); + BitmapScopedInfoAccess pAccess(aExportedImportedBitmap); auto nActualWidth = aExportedImportedBitmapEx.GetSizePixel().Width(); auto nActualHeight = aExportedImportedBitmapEx.GetSizePixel().Height(); auto nActualBpp @@ -208,7 +208,7 @@ void PngFilterTest::testPng() Bitmap aBitmap = aBitmapEx.GetBitmap(); { - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAccess->Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAccess->Height()); @@ -255,7 +255,7 @@ void PngFilterTest::testPng() Bitmap aBitmap = aBitmapEx.GetBitmap(); { - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAccess->Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAccess->Height()); if (pAccess->GetBitCount() == 24 || pAccess->GetBitCount() == 32) @@ -294,7 +294,7 @@ void PngFilterTest::testPng() Bitmap aBitmap = aBitmapEx.GetBitmap(); { - Bitmap::ScopedReadAccess pAccess(aBitmap); + BitmapScopedReadAccess pAccess(aBitmap); CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAccess->Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAccess->Height()); @@ -320,7 +320,7 @@ void PngFilterTest::testPng() AlphaMask aAlpha = aBitmapEx.GetAlphaMask(); { - AlphaMask::ScopedReadAccess pAlphaAccess(aAlpha); + BitmapScopedReadAccess pAlphaAccess(aAlpha); CPPUNIT_ASSERT_EQUAL(sal_uInt16(8), pAlphaAccess->GetBitCount()); CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAlphaAccess->Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAlphaAccess->Height()); @@ -1920,7 +1920,7 @@ void PngFilterTest::testPngRoundtrip24_8() AlphaMask aAlpha(Size(16, 16)); { BitmapScopedWriteAccess pWriteAccessBitmap(aBitmap); - AlphaScopedWriteAccess pWriteAccessAlpha(aAlpha); + BitmapScopedWriteAccess pWriteAccessAlpha(aAlpha); pWriteAccessAlpha->Erase(Color(0xAA, 0xAA, 0xAA)); pWriteAccessBitmap->Erase(COL_BLACK); for (int i = 0; i < 8; ++i) diff --git a/vcl/qa/cppunit/skia/skia.cxx b/vcl/qa/cppunit/skia/skia.cxx index 0caa1922280e..cb4223a4f8f5 100644 --- a/vcl/qa/cppunit/skia/skia.cxx +++ b/vcl/qa/cppunit/skia/skia.cxx @@ -18,7 +18,7 @@ #include <skia/salbmp.hxx> #include <skia/utils.hxx> -#include <bitmap/BitmapWriteAccess.hxx> +#include <vcl/BitmapWriteAccess.hxx> using namespace SkiaHelper; @@ -248,17 +248,17 @@ void SkiaTest::testAlphaBlendWith() CPPUNIT_ASSERT(skiaAlpha->unittestHasEraseColor()); CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, alpha.getPixelFormat()); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(208), - AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0)); + BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0)); // Test with images set. alpha.Erase(64); - AlphaMask::ScopedReadAccess(alpha)->GetColor(0, 0); // Reading a pixel will create pixel data. + BitmapScopedReadAccess(alpha)->GetColor(0, 0); // Reading a pixel will create pixel data. skiaAlpha = dynamic_cast<SkiaSalBitmap*>(alpha.GetBitmap().ImplGetSalBitmap().get()); skiaAlpha->GetSkImage(); CPPUNIT_ASSERT(!skiaAlpha->unittestHasEraseColor()); CPPUNIT_ASSERT(skiaAlpha->unittestHasImage()); bitmap.Erase(64); - AlphaMask::ScopedReadAccess(bitmap)->GetColor(0, 0); // Reading a pixel will create pixel data. + BitmapScopedReadAccess(bitmap)->GetColor(0, 0); // Reading a pixel will create pixel data. skiaBitmap = dynamic_cast<SkiaSalBitmap*>(bitmap.GetBitmap().ImplGetSalBitmap().get()); skiaBitmap->GetSkImage(); CPPUNIT_ASSERT(!skiaBitmap->unittestHasEraseColor()); @@ -268,14 +268,14 @@ void SkiaTest::testAlphaBlendWith() CPPUNIT_ASSERT(skiaAlpha->unittestHasImage()); CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, alpha.getPixelFormat()); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(207), - AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0)); + BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0)); // Test with erase color for alpha and image for other bitmap. alpha.Erase(64); skiaAlpha = dynamic_cast<SkiaSalBitmap*>(alpha.GetBitmap().ImplGetSalBitmap().get()); CPPUNIT_ASSERT(skiaAlpha->unittestHasEraseColor()); bitmap.Erase(64); - AlphaMask::ScopedReadAccess(bitmap)->GetColor(0, 0); // Reading a pixel will create pixel data. + BitmapScopedReadAccess(bitmap)->GetColor(0, 0); // Reading a pixel will create pixel data. skiaBitmap = dynamic_cast<SkiaSalBitmap*>(bitmap.GetBitmap().ImplGetSalBitmap().get()); skiaBitmap->GetSkImage(); CPPUNIT_ASSERT(!skiaBitmap->unittestHasEraseColor()); @@ -285,7 +285,7 @@ void SkiaTest::testAlphaBlendWith() CPPUNIT_ASSERT(skiaAlpha->unittestHasImage()); CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, alpha.getPixelFormat()); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(207), ... etc. - the rest is truncated