diff options
48 files changed, 292 insertions, 231 deletions
diff --git a/include/vcl/alpha.hxx b/include/vcl/alpha.hxx index 396e437cf93f..1f7876b23d58 100644 --- a/include/vcl/alpha.hxx +++ b/include/vcl/alpha.hxx @@ -68,8 +68,6 @@ public: typedef vcl::ScopedBitmapAccess< BitmapReadAccess, AlphaMask, &AlphaMask::AcquireReadAccess > ScopedReadAccess; - typedef vcl::ScopedBitmapAccess< BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireWriteAccess > - ScopedWriteAccess; private: friend class BitmapEx; diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index 2549c9c05a01..172230c61a8f 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -725,7 +725,6 @@ public: static void ReleaseAccess( BitmapInfoAccess* pAccess ); typedef vcl::ScopedBitmapAccess<BitmapReadAccess, Bitmap, &Bitmap::AcquireReadAccess> ScopedReadAccess; - typedef vcl::ScopedBitmapAccess<BitmapWriteAccess, Bitmap, &Bitmap::AcquireWriteAccess> ScopedWriteAccess; typedef vcl::ScopedBitmapAccess<BitmapInfoAccess, Bitmap, &Bitmap::AcquireInfoAccess> ScopedInfoAccess; private: diff --git a/include/vcl/bitmapaccess.hxx b/include/vcl/bitmapaccess.hxx index 5403cea3e783..91343e501ea7 100644 --- a/include/vcl/bitmapaccess.hxx +++ b/include/vcl/bitmapaccess.hxx @@ -281,78 +281,6 @@ public: }; -class VCL_DLLPUBLIC BitmapWriteAccess : public BitmapReadAccess -{ -public: - BitmapWriteAccess(Bitmap& rBitmap); - virtual ~BitmapWriteAccess() override; - - void CopyScanline(long nY, const BitmapReadAccess& rReadAcc); - void CopyScanline(long nY, - ConstScanline aSrcScanline, - ScanlineFormat nSrcScanlineFormat, - sal_uLong nSrcScanlineSize); - - void CopyBuffer( const BitmapReadAccess& rReadAcc ); - - void SetPalette(const BitmapPalette& rPalette) - { - assert(mpBuffer && "Access is not valid!"); - - mpBuffer->maPalette = rPalette; - } - - void SetPaletteEntryCount(sal_uInt16 nCount) - { - assert(mpBuffer && "Access is not valid!"); - - mpBuffer->maPalette.SetEntryCount(nCount); - } - - void SetPaletteColor(sal_uInt16 nColor, const BitmapColor& rBitmapColor) - { - assert(mpBuffer && "Access is not valid!"); - assert(HasPalette() && "Bitmap has no palette!"); - - mpBuffer->maPalette[nColor] = rBitmapColor; - } - - void SetPixel(long nY, long nX, const BitmapColor& rBitmapColor) - { - assert(mpBuffer && "Access is not valid!"); - assert(nX < mpBuffer->mnWidth && "x-coordinate out of range!"); - assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!"); - - mFncSetPixel(GetScanline(nY), nX, rBitmapColor, maColorMask); - } - - void SetPixelIndex(long nY, long nX, sal_uInt8 cIndex) - { - SetPixel(nY, nX, BitmapColor(cIndex)); - } - - void SetLineColor(const Color& rColor); - - void SetFillColor(); - void SetFillColor(const Color& rColor); - - void Erase(const Color& rColor); - - void DrawLine(const Point& rStart, const Point& rEnd); - - void FillRect(const tools::Rectangle& rRect); - void DrawRect(const tools::Rectangle& rRect); - -private: - - std::unique_ptr<BitmapColor> mpLineColor; - std::unique_ptr<BitmapColor> mpFillColor; - - BitmapWriteAccess() = delete; - BitmapWriteAccess(const BitmapWriteAccess&) = delete; - BitmapWriteAccess& operator=(const BitmapWriteAccess&) = delete; -}; - #endif // INCLUDED_VCL_BMPACC_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/scopedbitmapaccess.hxx b/include/vcl/scopedbitmapaccess.hxx index bcdfa2b1bd20..f63bcc55f8a3 100644 --- a/include/vcl/scopedbitmapaccess.hxx +++ b/include/vcl/scopedbitmapaccess.hxx @@ -35,7 +35,7 @@ namespace vcl pReadAccess->SetPixel()... Bitmap aBitmap2; - Bitmap::ScopedWriteAccess pWriteAccess( bCond ? aBitmap2.AcquireWriteAccess() : 0, aBitmap2 ); + BitmapScopedWriteAccess pWriteAccess( bCond ? aBitmap2.AcquireWriteAccess() : 0, aBitmap2 ); if ( pWriteAccess )... @attention for practical reasons, ScopedBitmapAccess stores a diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx index 742481a4e24c..6cdd73cd2a5b 100644 --- a/libreofficekit/qa/unit/tiledrendering.cxx +++ b/libreofficekit/qa/unit/tiledrendering.cxx @@ -320,7 +320,7 @@ static void dumpRGBABitmap( const OUString& rPath, const unsigned char* pBuffer, const int nWidth, const int nHeight ) { Bitmap aBitmap( Size( nWidth, nHeight ), 32 ); - Bitmap::ScopedWriteAccess pWriteAccess( aBitmap ); + BitmapScopedWriteAccess pWriteAccess( aBitmap ); memcpy( pWriteAccess->GetBuffer(), pBuffer, 4*nWidth*nHeight ); BitmapEx aBitmapEx( aBitmap ); diff --git a/vcl/CppunitTest_vcl_jpeg_read_write_test.mk b/vcl/CppunitTest_vcl_jpeg_read_write_test.mk index 60b2a11666b4..e741916bba0f 100644 --- a/vcl/CppunitTest_vcl_jpeg_read_write_test.mk +++ b/vcl/CppunitTest_vcl_jpeg_read_write_test.mk @@ -15,6 +15,11 @@ $(eval $(call gb_CppunitTest_add_exception_objects,vcl_jpeg_read_write_test, \ $(eval $(call gb_CppunitTest_use_external,vcl_jpeg_read_write_test,boost_headers)) +$(eval $(call gb_CppunitTest_set_include,vcl_jpeg_read_write_test,\ + $$(INCLUDE) \ + -I$(SRCDIR)/vcl/inc \ +)) + $(eval $(call gb_CppunitTest_use_libraries,vcl_jpeg_read_write_test, \ comphelper \ cppu \ diff --git a/vcl/backendtest/outputdevice/bitmap.cxx b/vcl/backendtest/outputdevice/bitmap.cxx index d8836330d5be..dbbb052c122e 100644 --- a/vcl/backendtest/outputdevice/bitmap.cxx +++ b/vcl/backendtest/outputdevice/bitmap.cxx @@ -11,6 +11,7 @@ #include <test/outputdevice.hxx> #include <vcl/bitmapex.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <bitmapwriteaccess.hxx> namespace vcl { namespace test { @@ -20,7 +21,7 @@ Bitmap OutputDeviceTestBitmap::setupDrawTransformedBitmap() Size aBitmapSize(9, 9); Bitmap aBitmap(aBitmapSize, 24); { - Bitmap::ScopedWriteAccess aWriteAccess(aBitmap); + BitmapScopedWriteAccess aWriteAccess(aBitmap); aWriteAccess->Erase(constFillColor); aWriteAccess->SetLineColor(COL_YELLOW); aWriteAccess->DrawRect(tools::Rectangle(0, 0, 8, 8)); @@ -45,7 +46,7 @@ Bitmap OutputDeviceTestBitmap::setupDrawBitmap() Size aBitmapSize(9, 9); Bitmap aBitmap(aBitmapSize, 24); { - Bitmap::ScopedWriteAccess aWriteAccess(aBitmap); + BitmapScopedWriteAccess aWriteAccess(aBitmap); aWriteAccess->Erase(constFillColor); aWriteAccess->SetLineColor(COL_YELLOW); aWriteAccess->DrawRect(tools::Rectangle(0, 0, 8, 8)); @@ -67,7 +68,7 @@ Bitmap OutputDeviceTestBitmap::setupDrawBitmapExWithAlpha() Size aBitmapSize(9, 9); Bitmap aBitmap(aBitmapSize, 24); { - Bitmap::ScopedWriteAccess aWriteAccess(aBitmap); + BitmapScopedWriteAccess aWriteAccess(aBitmap); aWriteAccess->Erase(COL_WHITE); aWriteAccess->SetLineColor(Color(0xFF, 0xFF, 0x00)); aWriteAccess->DrawRect(tools::Rectangle(0, 0, 8, 8)); @@ -76,7 +77,7 @@ Bitmap OutputDeviceTestBitmap::setupDrawBitmapExWithAlpha() AlphaMask aAlpha(aBitmapSize); { - AlphaMask::ScopedWriteAccess aWriteAccess(aAlpha); + AlphaScopedWriteAccess aWriteAccess(aAlpha); aWriteAccess->Erase(COL_WHITE); aWriteAccess->SetLineColor(Color(0x44, 0x44, 0x44)); aWriteAccess->DrawRect(tools::Rectangle(0, 0, 8, 8)); @@ -97,7 +98,7 @@ Bitmap OutputDeviceTestBitmap::setupDrawMask() Size aBitmapSize(9, 9); Bitmap aBitmap(aBitmapSize, 24); { - Bitmap::ScopedWriteAccess aWriteAccess(aBitmap); + BitmapScopedWriteAccess aWriteAccess(aBitmap); aWriteAccess->Erase(COL_WHITE); aWriteAccess->SetLineColor(COL_BLACK); aWriteAccess->DrawRect(tools::Rectangle(0, 0, 8, 8)); diff --git a/vcl/backendtest/outputdevice/common.cxx b/vcl/backendtest/outputdevice/common.cxx index ac2646498642..9f69a28fabd3 100644 --- a/vcl/backendtest/outputdevice/common.cxx +++ b/vcl/backendtest/outputdevice/common.cxx @@ -9,6 +9,7 @@ */ #include <test/outputdevice.hxx> +#include <bitmapwriteaccess.hxx> namespace vcl { namespace test { @@ -25,7 +26,7 @@ int deltaColor(BitmapColor aColor1, BitmapColor aColor2) return std::max(std::max(deltaR, deltaG), deltaB); } -void checkValue(Bitmap::ScopedWriteAccess& pAccess, int x, int y, Color aExpected, +void checkValue(BitmapScopedWriteAccess& pAccess, int x, int y, Color aExpected, int& nNumberOfQuirks, int& nNumberOfErrors, bool bQuirkMode, int nColorDeltaThresh = 0) { const bool bColorize = false; @@ -53,7 +54,7 @@ void checkValue(Bitmap::ScopedWriteAccess& pAccess, int x, int y, Color aExpecte TestResult checkRect(Bitmap& rBitmap, int aLayerNumber, Color aExpectedColor) { - Bitmap::ScopedWriteAccess pAccess(rBitmap); + BitmapScopedWriteAccess pAccess(rBitmap); long nHeight = pAccess->Height(); long nWidth = pAccess->Width(); @@ -92,7 +93,7 @@ TestResult checkRect(Bitmap& rBitmap, int aLayerNumber, Color aExpectedColor) TestResult checkHorizontalVerticalDiagonalLines(Bitmap& rBitmap, Color aExpectedColor, int nColorThresh) { - Bitmap::ScopedWriteAccess pAccess(rBitmap); + BitmapScopedWriteAccess pAccess(rBitmap); long nWidth = pAccess->Width(); long nHeight = pAccess->Height(); @@ -164,7 +165,7 @@ TestResult checkHorizontalVerticalDiagonalLines(Bitmap& rBitmap, Color aExpected TestResult checkDiamondLine(Bitmap& rBitmap, int aLayerNumber, Color aExpectedColor) { - Bitmap::ScopedWriteAccess pAccess(rBitmap); + BitmapScopedWriteAccess pAccess(rBitmap); long nHeight = pAccess->Height(); long nWidth = pAccess->Width(); diff --git a/vcl/inc/bitmapwriteaccess.hxx b/vcl/inc/bitmapwriteaccess.hxx new file mode 100644 index 000000000000..0223ad778f10 --- /dev/null +++ b/vcl/inc/bitmapwriteaccess.hxx @@ -0,0 +1,95 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_BITMAPWRITEACCESS_HXX +#define INCLUDED_VCL_INC_BITMAPWRITEACCESS_HXX + +#include <vcl/alpha.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/bitmapaccess.hxx> + +typedef vcl::ScopedBitmapAccess<BitmapWriteAccess, Bitmap, &Bitmap::AcquireWriteAccess> + BitmapScopedWriteAccess; + +typedef vcl::ScopedBitmapAccess<BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireWriteAccess> + AlphaScopedWriteAccess; + +class VCL_DLLPUBLIC BitmapWriteAccess : public BitmapReadAccess +{ +public: + BitmapWriteAccess(Bitmap& rBitmap); + virtual ~BitmapWriteAccess() override; + + void CopyScanline(long nY, const BitmapReadAccess& rReadAcc); + void CopyScanline(long nY, ConstScanline aSrcScanline, ScanlineFormat nSrcScanlineFormat, + sal_uLong nSrcScanlineSize); + + void CopyBuffer(const BitmapReadAccess& rReadAcc); + + void SetPalette(const BitmapPalette& rPalette) + { + assert(mpBuffer && "Access is not valid!"); + + mpBuffer->maPalette = rPalette; + } + + void SetPaletteEntryCount(sal_uInt16 nCount) + { + assert(mpBuffer && "Access is not valid!"); + + mpBuffer->maPalette.SetEntryCount(nCount); + } + + void SetPaletteColor(sal_uInt16 nColor, const BitmapColor& rBitmapColor) + { + assert(mpBuffer && "Access is not valid!"); + assert(HasPalette() && "Bitmap has no palette!"); + + mpBuffer->maPalette[nColor] = rBitmapColor; + } + + void SetPixel(long nY, long nX, const BitmapColor& rBitmapColor) + { + assert(mpBuffer && "Access is not valid!"); + assert(nX < mpBuffer->mnWidth && "x-coordinate out of range!"); + assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!"); + + mFncSetPixel(GetScanline(nY), nX, rBitmapColor, maColorMask); + } + + void SetPixelIndex(long nY, long nX, sal_uInt8 cIndex) + { + SetPixel(nY, nX, BitmapColor(cIndex)); + } + + void SetLineColor(const Color& rColor); + + void SetFillColor(); + void SetFillColor(const Color& rColor); + + void Erase(const Color& rColor); + + void DrawLine(const Point& rStart, const Point& rEnd); + + void FillRect(const tools::Rectangle& rRect); + void DrawRect(const tools::Rectangle& rRect); + +private: + std::unique_ptr<BitmapColor> mpLineColor; + std::unique_ptr<BitmapColor> mpFillColor; + + BitmapWriteAccess() = delete; + BitmapWriteAccess(const BitmapWriteAccess&) = delete; + BitmapWriteAccess& operator=(const BitmapWriteAccess&) = delete; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qa/cppunit/BitmapProcessorTest.cxx b/vcl/qa/cppunit/BitmapProcessorTest.cxx index 300302d41d60..1e46ecd47477 100644 --- a/vcl/qa/cppunit/BitmapProcessorTest.cxx +++ b/vcl/qa/cppunit/BitmapProcessorTest.cxx @@ -23,6 +23,7 @@ #include <config_features.h> #include <BitmapProcessor.hxx> +#include <bitmapwriteaccess.hxx> namespace @@ -41,7 +42,7 @@ void BitmapProcessorTest::testDisabledImage() { Bitmap aBitmap(Size(3, 3), 24); { - Bitmap::ScopedWriteAccess pWriteAccess(aBitmap); + BitmapScopedWriteAccess pWriteAccess(aBitmap); pWriteAccess->Erase(Color(0x00, 0x11, 0x22, 0x33)); } BitmapEx aBitmapEx(aBitmap); diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx index 3f112fa6f86b..f835c7b78bc3 100644 --- a/vcl/qa/cppunit/BitmapTest.cxx +++ b/vcl/qa/cppunit/BitmapTest.cxx @@ -27,6 +27,7 @@ #endif #include <BitmapSymmetryCheck.hxx> +#include <bitmapwriteaccess.hxx> namespace { @@ -397,7 +398,7 @@ void BitmapTest::testScale() CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(24), aBitmap24Bit.GetBitCount()); { - Bitmap::ScopedWriteAccess aWriteAccess(aBitmap24Bit); + BitmapScopedWriteAccess aWriteAccess(aBitmap24Bit); aWriteAccess->Erase(COL_WHITE); aWriteAccess->SetLineColor(COL_BLACK); aWriteAccess->DrawRect(tools::Rectangle(1, 1, 8, 8)); diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx index 192aa1d58c1f..c91819a6b391 100644 --- a/vcl/qa/cppunit/canvasbitmaptest.cxx +++ b/vcl/qa/cppunit/canvasbitmaptest.cxx @@ -42,6 +42,7 @@ #include <canvasbitmap.hxx> #include <algorithm> +#include <bitmapwriteaccess.hxx> using namespace ::com::sun::star; using namespace vcl::unotools; @@ -641,7 +642,7 @@ void CanvasBitmapTest::runTest() Bitmap aBitmap(Size(200,200),nDepth); aBitmap.Erase(COL_WHITE); { - Bitmap::ScopedWriteAccess pAcc(aBitmap); + BitmapScopedWriteAccess pAcc(aBitmap); if( pAcc.get() ) { BitmapColor aBlack(0); @@ -671,7 +672,7 @@ void CanvasBitmapTest::runTest() Bitmap aMask(Size(200,200),1); aMask.Erase(COL_WHITE); { - Bitmap::ScopedWriteAccess pAcc(aMask); + BitmapScopedWriteAccess pAcc(aMask); if( pAcc.get() ) { pAcc->SetFillColor(COL_BLACK); diff --git a/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx b/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx index 64125245c82a..4cae79645bd6 100644 --- a/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx +++ b/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx @@ -12,6 +12,7 @@ #include <unotest/bootstrapfixturebase.hxx> #include <vcl/graphicfilter.hxx> #include <vcl/bitmapaccess.hxx> +#include <bitmapwriteaccess.hxx> class JpegReaderTest : public test::BootstrapFixtureBase { @@ -51,7 +52,7 @@ int deltaColor(BitmapColor aColor1, BitmapColor aColor2) bool checkRect(Bitmap& rBitmap, int aLayerNumber, long nAreaHeight, long nAreaWidth, Color aExpectedColor, int nMaxDelta) { - Bitmap::ScopedWriteAccess pAccess(rBitmap); + BitmapScopedWriteAccess pAccess(rBitmap); long nWidth = std::min(nAreaWidth, pAccess->Width()); long nHeight = std::min(nAreaHeight, pAccess->Height()); diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx index 4633c64e6a11..0015706c8a0f 100644 --- a/vcl/qa/cppunit/svm/svmtest.cxx +++ b/vcl/qa/cppunit/svm/svmtest.cxx @@ -14,6 +14,7 @@ #include <vcl/metaact.hxx> #include <vcl/virdev.hxx> #include <vcl/bitmapaccess.hxx> +#include <bitmapwriteaccess.hxx> using namespace css; @@ -789,17 +790,17 @@ void SvmTest::testBitmaps() Bitmap aBitmap1(Size(4,4), 24); { - Bitmap::ScopedWriteAccess pAccess(aBitmap1); + BitmapScopedWriteAccess pAccess(aBitmap1); pAccess->Erase(COL_RED); } Bitmap aBitmap2(Size(4,4), 24); { - Bitmap::ScopedWriteAccess pAccess(aBitmap2); + BitmapScopedWriteAccess pAccess(aBitmap2); pAccess->Erase(COL_GREEN); } Bitmap aBitmap3(Size(4,4), 24); { - Bitmap::ScopedWriteAccess pAccess(aBitmap3); + BitmapScopedWriteAccess pAccess(aBitmap3); pAccess->Erase(COL_BLUE); } pVirtualDev->DrawBitmap(Point(1, 2), aBitmap1); @@ -850,21 +851,21 @@ void SvmTest::testBitmapExs() Bitmap aBitmap1(Size(4,4), 24); { - Bitmap::ScopedWriteAccess pAccess(aBitmap1); + BitmapScopedWriteAccess pAccess(aBitmap1); pAccess->Erase(COL_RED); } BitmapEx aBitmapEx1(aBitmap1, COL_YELLOW); Bitmap aBitmap2(Size(4,4), 24); { - Bitmap::ScopedWriteAccess pAccess(aBitmap2); + BitmapScopedWriteAccess pAccess(aBitmap2); pAccess->Erase(COL_GREEN); } BitmapEx aBitmapEx2(aBitmap2, COL_YELLOW); Bitmap aBitmap3(Size(4,4), 24); { - Bitmap::ScopedWriteAccess pAccess(aBitmap3); + BitmapScopedWriteAccess pAccess(aBitmap3); pAccess->Erase(COL_BLUE); } BitmapEx aBitmapEx3(aBitmap3, COL_YELLOW); @@ -906,17 +907,17 @@ void SvmTest::testMasks() Bitmap aBitmap1(Size(4,4), 24); { - Bitmap::ScopedWriteAccess pAccess(aBitmap1); + BitmapScopedWriteAccess pAccess(aBitmap1); pAccess->Erase(COL_RED); } Bitmap aBitmap2(Size(4,4), 24); { - Bitmap::ScopedWriteAccess pAccess(aBitmap2); + BitmapScopedWriteAccess pAccess(aBitmap2); pAccess->Erase(COL_GREEN); } Bitmap aBitmap3(Size(4,4), 24); { - Bitmap::ScopedWriteAccess pAccess(aBitmap3); + BitmapScopedWriteAccess pAccess(aBitmap3); pAccess->Erase(COL_BLUE); } diff --git a/vcl/source/bitmap/BitmapProcessor.cxx b/vcl/source/bitmap/BitmapProcessor.cxx index ab191189ccf6..c49f3c489c76 100644 --- a/vcl/source/bitmap/BitmapProcessor.cxx +++ b/vcl/source/bitmap/BitmapProcessor.cxx @@ -12,6 +12,7 @@ #include <basegfx/color/bcolortools.hxx> #include <BitmapProcessor.hxx> +#include <bitmapwriteaccess.hxx> BitmapEx BitmapProcessor::createLightImage(const BitmapEx& rBitmapEx) { @@ -21,7 +22,7 @@ BitmapEx BitmapProcessor::createLightImage(const BitmapEx& rBitmapEx) Bitmap aDarkBitmap(aSize, 24); Bitmap::ScopedReadAccess pRead(aBitmap); - Bitmap::ScopedWriteAccess pWrite(aDarkBitmap); + BitmapScopedWriteAccess pWrite(aDarkBitmap); if (pRead && pWrite) { @@ -79,8 +80,8 @@ BitmapEx BitmapProcessor::createDisabledImage(const BitmapEx& rBitmapEx) Bitmap aBitmap(rBitmapEx.GetBitmap()); Bitmap::ScopedReadAccess pRead(aBitmap); - Bitmap::ScopedWriteAccess pGrey(aGrey); - AlphaMask::ScopedWriteAccess pGreyAlpha(aGreyAlpha); + BitmapScopedWriteAccess pGrey(aGrey); + AlphaScopedWriteAccess pGreyAlpha(aGreyAlpha); BitmapEx aReturnBitmap; @@ -148,7 +149,7 @@ BitmapEx BitmapProcessor::createDisabledImage(const BitmapEx& rBitmapEx) void BitmapProcessor::colorizeImage(BitmapEx const & rBitmapEx, Color aColor) { Bitmap aBitmap = rBitmapEx.GetBitmap(); - Bitmap::ScopedWriteAccess pWriteAccess(aBitmap); + BitmapScopedWriteAccess pWriteAccess(aBitmap); if (!pWriteAccess) return; diff --git a/vcl/source/bitmap/BitmapScaleConvolution.cxx b/vcl/source/bitmap/BitmapScaleConvolution.cxx index 7644c687033b..05b9c4c627b9 100644 --- a/vcl/source/bitmap/BitmapScaleConvolution.cxx +++ b/vcl/source/bitmap/BitmapScaleConvolution.cxx @@ -19,6 +19,7 @@ #include <BitmapScaleConvolution.hxx> #include <ResampleKernel.hxx> +#include <bitmapwriteaccess.hxx> #include <vcl/bitmapaccess.hxx> #include <osl/diagnose.h> @@ -108,7 +109,7 @@ bool ImplScaleConvolutionHor(Bitmap& rSource, Bitmap& rTarget, const double& rSc const long nHeight(rSource.GetSizePixel().Height()); ImplCalculateContributions(nWidth, nNewWidth, aNumberOfContributions, pWeights, pPixels, pCount, aKernel); rTarget = Bitmap(Size(nNewWidth, nHeight), 24); - Bitmap::ScopedWriteAccess pWriteAcc(rTarget); + BitmapScopedWriteAccess pWriteAcc(rTarget); bool bResult(pWriteAcc); if(bResult) @@ -196,7 +197,7 @@ bool ImplScaleConvolutionVer(Bitmap& rSource, Bitmap& rTarget, const double& rSc const long nWidth(rSource.GetSizePixel().Width()); ImplCalculateContributions(nHeight, nNewHeight, aNumberOfContributions, pWeights, pPixels, pCount, aKernel); rTarget = Bitmap(Size(nWidth, nNewHeight), 24); - Bitmap::ScopedWriteAccess pWriteAcc(rTarget); + BitmapScopedWriteAccess pWriteAcc(rTarget); bool bResult(pWriteAcc); if(pWriteAcc) diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx index e750a63880e5..366c6be37af0 100644 --- a/vcl/source/bitmap/BitmapTools.cxx +++ b/vcl/source/bitmap/BitmapTools.cxx @@ -32,6 +32,7 @@ #endif #include <tools/diagnose_ex.h> #include <tools/fract.hxx> +#include <bitmapwriteaccess.hxx> using namespace css; @@ -123,16 +124,16 @@ BitmapEx CreateFromData( sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHe assert( nBitCount == 1 || nBitCount == 24 || nBitCount == 32); Bitmap aBmp( Size( nWidth, nHeight ), nBitCount ); - Bitmap::ScopedWriteAccess pWrite(aBmp); + BitmapScopedWriteAccess pWrite(aBmp); assert(pWrite.get()); if( !pWrite ) return BitmapEx(); std::unique_ptr<AlphaMask> pAlphaMask; - AlphaMask::ScopedWriteAccess xMaskAcc; + AlphaScopedWriteAccess xMaskAcc; if (nBitCount == 32) { pAlphaMask.reset( new AlphaMask( Size(nWidth, nHeight) ) ); - xMaskAcc = AlphaMask::ScopedWriteAccess(*pAlphaMask); + xMaskAcc = AlphaScopedWriteAccess(*pAlphaMask); } if (nBitCount == 1) { @@ -186,16 +187,16 @@ BitmapEx CreateFromData( RawBitmap&& rawBitmap ) assert( nBitCount == 24 || nBitCount == 32); Bitmap aBmp( rawBitmap.maSize, nBitCount ); - Bitmap::ScopedWriteAccess pWrite(aBmp); + BitmapScopedWriteAccess pWrite(aBmp); assert(pWrite.get()); if( !pWrite ) return BitmapEx(); std::unique_ptr<AlphaMask> pAlphaMask; - AlphaMask::ScopedWriteAccess xMaskAcc; + AlphaScopedWriteAccess xMaskAcc; if (nBitCount == 32) { pAlphaMask.reset( new AlphaMask( rawBitmap.maSize ) ); - xMaskAcc = AlphaMask::ScopedWriteAccess(*pAlphaMask); + xMaskAcc = AlphaScopedWriteAccess(*pAlphaMask); } auto nHeight = rawBitmap.maSize.getHeight(); @@ -249,12 +250,12 @@ BitmapEx* CreateFromCairoSurface(Size aSize, cairo_surface_t * pSurface) ::Bitmap aRGB( aSize, 24 ); ::AlphaMask aMask( aSize ); - Bitmap::ScopedWriteAccess pRGBWrite(aRGB); + BitmapScopedWriteAccess pRGBWrite(aRGB); assert(pRGBWrite); if (!pRGBWrite) return nullptr; - AlphaMask::ScopedWriteAccess pMaskWrite(aMask); + AlphaScopedWriteAccess pMaskWrite(aMask); assert(pMaskWrite); if (!pMaskWrite) return nullptr; @@ -382,8 +383,8 @@ BitmapEx CanvasTransformBitmap( const BitmapEx& rBitmap, // copy-constructing the resulting bitmap. This will // rule out the possibility that cached accessor data // is not yet written back. - Bitmap::ScopedWriteAccess pWriteAccess( aDstBitmap ); - Bitmap::ScopedWriteAccess pAlphaWriteAccess( aDstAlpha ); + BitmapScopedWriteAccess pWriteAccess( aDstBitmap ); + BitmapScopedWriteAccess pAlphaWriteAccess( aDstAlpha ); if( pWriteAccess.get() != nullptr && @@ -488,7 +489,7 @@ void DrawAlphaBitmapAndAlphaGradient(BitmapEx & rBitmapEx, bool bFixedTransparen } { - AlphaMask::ScopedWriteAccess pOld(aOldMask); + AlphaScopedWriteAccess pOld(aOldMask); assert(pOld && "Got no access to old alpha mask (!)"); @@ -572,7 +573,7 @@ void DrawAndClipBitmap(const Point& rPos, const Size& rSize, const BitmapEx& rBi AlphaMask fromVDev(aVDevMask); AlphaMask fromBmpEx(aBmpEx.GetAlpha()); AlphaMask::ScopedReadAccess pR(fromVDev); - AlphaMask::ScopedWriteAccess pW(fromBmpEx); + AlphaScopedWriteAccess pW(fromBmpEx); if(pR && pW) { diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx index b5602327f75d..bf13e87fe68c 100644 --- a/vcl/source/bitmap/bitmap.cxx +++ b/vcl/source/bitmap/bitmap.cxx @@ -24,6 +24,7 @@ #include <impbmp.hxx> #include <salbmp.hxx> +#include <bitmapwriteaccess.hxx> #include <algorithm> #include <memory> @@ -388,7 +389,7 @@ bool Bitmap::Crop( const tools::Rectangle& rRectPixel ) { const tools::Rectangle aNewRect( Point(), aRect.GetSize() ); Bitmap aNewBmp( aNewRect.GetSize(), GetBitCount(), &pReadAcc->GetPalette() ); - ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); if( pWriteAcc ) { @@ -458,7 +459,7 @@ bool Bitmap::CopyPixel( const tools::Rectangle& rRectDst, if( nNextIndex ) { ScopedReadAccess pSrcAcc(*pSrc); - ScopedWriteAccess pDstAcc(*this); + BitmapScopedWriteAccess pDstAcc(*this); if( pSrcAcc && pDstAcc ) { @@ -495,7 +496,7 @@ bool Bitmap::CopyPixel( const tools::Rectangle& rRectDst, if( pReadAcc ) { - ScopedWriteAccess pWriteAcc(*this); + BitmapScopedWriteAccess pWriteAcc(*this); if( pWriteAcc ) { @@ -558,7 +559,7 @@ bool Bitmap::CopyPixel( const tools::Rectangle& rRectDst, if( !aRectSrc.IsEmpty() && ( aRectSrc != aRectDst ) ) { - ScopedWriteAccess pWriteAcc(*this); + BitmapScopedWriteAccess pWriteAcc(*this); if( pWriteAcc ) { @@ -651,7 +652,7 @@ bool Bitmap::CopyPixel_AlphaOptimized( const tools::Rectangle& rRectDst, const t if( pReadAcc ) { - ScopedWriteAccess pWriteAcc(*this); + BitmapScopedWriteAccess pWriteAcc(*this); if( pWriteAcc ) { @@ -685,7 +686,7 @@ bool Bitmap::CopyPixel_AlphaOptimized( const tools::Rectangle& rRectDst, const t if( !aRectSrc.IsEmpty() && ( aRectSrc != aRectDst ) ) { - ScopedWriteAccess pWriteAcc(*this); + BitmapScopedWriteAccess pWriteAcc(*this); if( pWriteAcc ) { @@ -768,7 +769,7 @@ bool Bitmap::Expand( sal_uLong nDX, sal_uLong nDY, const Color* pInitColor ) { BitmapPalette aBmpPal( pReadAcc->GetPalette() ); Bitmap aNewBmp( aNewSize, GetBitCount(), &aBmpPal ); - ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); if( pWriteAcc ) { @@ -841,7 +842,7 @@ bool Bitmap::MakeMonochrome(sal_uInt8 cThreshold) if( pReadAcc ) { Bitmap aNewBmp( GetSizePixel(), 1 ); - ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); if( pWriteAcc ) { diff --git a/vcl/source/bitmap/bitmappaint.cxx b/vcl/source/bitmap/bitmappaint.cxx index 2de3624007e2..942d627b588c 100644 --- a/vcl/source/bitmap/bitmappaint.cxx +++ b/vcl/source/bitmap/bitmappaint.cxx @@ -23,6 +23,7 @@ #include <vcl/alpha.hxx> #include <impbmp.hxx> +#include <bitmapwriteaccess.hxx> #include <algorithm> #include <memory> @@ -32,7 +33,7 @@ bool Bitmap::Erase(const Color& rFillColor) if (IsEmpty()) return true; - Bitmap::ScopedWriteAccess pWriteAcc(*this); + BitmapScopedWriteAccess pWriteAcc(*this); bool bRet = false; if (pWriteAcc) @@ -109,7 +110,7 @@ bool Bitmap::Erase(const Color& rFillColor) bool Bitmap::Invert() { - ScopedWriteAccess pAcc(*this); + BitmapScopedWriteAccess pAcc(*this); bool bRet = false; if (pAcc) @@ -158,7 +159,7 @@ bool Bitmap::Mirror(BmpMirrorFlags nMirrorFlags) if (bHorz && !bVert) { - ScopedWriteAccess pAcc(*this); + BitmapScopedWriteAccess pAcc(*this); if (pAcc) { @@ -185,7 +186,7 @@ bool Bitmap::Mirror(BmpMirrorFlags nMirrorFlags) } else if (bVert && !bHorz) { - ScopedWriteAccess pAcc(*this); + BitmapScopedWriteAccess pAcc(*this); if (pAcc) { @@ -208,7 +209,7 @@ bool Bitmap::Mirror(BmpMirrorFlags nMirrorFlags) } else if (bHorz && bVert) { - ScopedWriteAccess pAcc(*this); + BitmapScopedWriteAccess pAcc(*this); if (pAcc) { @@ -278,7 +279,7 @@ bool Bitmap::Rotate(long nAngle10, const Color& rFillColor) { const Size aNewSizePix(aSizePix.Height(), aSizePix.Width()); Bitmap aNewBmp(aNewSizePix, GetBitCount(), &pReadAcc->GetPalette()); - ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); if (pWriteAcc) { @@ -329,7 +330,7 @@ bool Bitmap::Rotate(long nAngle10, const Color& rFillColor) tools::Rectangle aNewBound(aPoly.GetBoundRect()); const Size aNewSizePix(aNewBound.GetSize()); Bitmap aNewBmp(aNewSizePix, GetBitCount(), &pReadAcc->GetPalette()); - ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); if (pWriteAcc) { @@ -423,7 +424,7 @@ Bitmap Bitmap::CreateMask(const Color& rTransColor, sal_uInt8 nTol) const } Bitmap aNewBmp(GetSizePixel(), 1); - ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); bool bRet = false; if (pWriteAcc && pReadAcc) @@ -730,7 +731,7 @@ vcl::Region Bitmap::CreateRegion(const Color& rColor, const tools::Rectangle& rR bool Bitmap::Replace(const Bitmap& rMask, const Color& rReplaceColor) { ScopedReadAccess pMaskAcc(const_cast<Bitmap&>(rMask)); - ScopedWriteAccess pAcc(*this); + BitmapScopedWriteAccess pAcc(*this); bool bRet = false; if (pMaskAcc && pAcc) @@ -810,7 +811,7 @@ bool Bitmap::Replace(const AlphaMask& rAlpha, const Color& rMergeColor) Bitmap aNewBmp(GetSizePixel(), 24); ScopedReadAccess pAcc(*this); AlphaMask::ScopedReadAccess pAlphaAcc(const_cast<AlphaMask&>(rAlpha)); - ScopedWriteAccess pNewAcc(aNewBmp); + BitmapScopedWriteAccess pNewAcc(aNewBmp); bool bRet = false; if (pAcc && pAlphaAcc && pNewAcc) @@ -874,7 +875,7 @@ bool Bitmap::Replace(const Color& rSearchColor, const Color& rReplaceColor, sal_ if (GetBitCount() == 1) Convert(BmpConversion::N4BitColors); - ScopedWriteAccess pAcc(*this); + BitmapScopedWriteAccess pAcc(*this); bool bRet = false; if (pAcc) @@ -937,7 +938,7 @@ bool Bitmap::Replace(const Color* pSearchColors, const Color* pReplaceColors, sa if (GetBitCount() == 1) Convert(BmpConversion::N4BitColors); - ScopedWriteAccess pAcc(*this); + BitmapScopedWriteAccess pAcc(*this); bool bRet = false; if (pAcc) @@ -1037,7 +1038,7 @@ bool Bitmap::Replace(const Color* pSearchColors, const Color* pReplaceColors, sa bool Bitmap::CombineSimple(const Bitmap& rMask, BmpCombine eCombine) { ScopedReadAccess pMaskAcc(const_cast<Bitmap&>(rMask)); - ScopedWriteAccess pAcc(*this); + BitmapScopedWriteAccess pAcc(*this); bool bRet = false; if (pMaskAcc && pAcc) @@ -1115,7 +1116,7 @@ bool Bitmap::Blend(const AlphaMask& rAlpha, const Color& rBackgroundColor) AlphaMask::ScopedReadAccess pAlphaAcc(const_cast<AlphaMask&>(rAlpha)); - ScopedWriteAccess pAcc(*this); + BitmapScopedWriteAccess pAcc(*this); bool bRet = false; if (pAlphaAcc && pAcc) diff --git a/vcl/source/bitmap/bitmapscalesuper.cxx b/vcl/source/bitmap/bitmapscalesuper.cxx index 46f8a6b02d67..c653a81bf929 100644 --- a/vcl/source/bitmap/bitmapscalesuper.cxx +++ b/vcl/source/bitmap/bitmapscalesuper.cxx @@ -19,6 +19,7 @@ #include <vcl/bitmapaccess.hxx> #include <bitmapscalesuper.hxx> +#include <bitmapwriteaccess.hxx> #include <algorithm> #include <memory> @@ -949,7 +950,7 @@ bool BitmapScaleSuperFilter::execute(Bitmap& rBitmap) Bitmap::ScopedReadAccess pReadAccess(rBitmap); Bitmap aOutBmp(Size(nDstW, nDstH), 24); - Bitmap::ScopedWriteAccess pWriteAccess(aOutBmp); + BitmapScopedWriteAccess pWriteAccess(aOutBmp); const long nStartY = 0; const long nEndY = nDstH - 1; diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index ebf885537f2b..115bc476782d 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -1303,7 +1303,7 @@ struct GraphicImportContext /// The Graphic the import filter gets. std::shared_ptr<Graphic> m_pGraphic; /// Write pixel data using this access. - std::unique_ptr<Bitmap::ScopedWriteAccess> m_pAccess; + std::unique_ptr<BitmapScopedWriteAccess> m_pAccess; /// Signals if import finished correctly. ErrCode m_nStatus = ERRCODE_GRFILTER_FILTERERROR; /// Original graphic format. @@ -1384,7 +1384,7 @@ void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGra else { Bitmap& rBitmap = const_cast<Bitmap&>(rContext.m_pGraphic->GetBitmapExRef().GetBitmapRef()); - rContext.m_pAccess = o3tl::make_unique<Bitmap::ScopedWriteAccess>(rBitmap); + rContext.m_pAccess = o3tl::make_unique<BitmapScopedWriteAccess>(rBitmap); pStream->Seek(rContext.m_nStreamBegin); if (bThreads) rSharedPool.pushTask(new GraphicImportTask(pTag, rContext)); @@ -1610,7 +1610,7 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, else { Bitmap& rBitmap = const_cast<Bitmap&>(rGraphic.GetBitmapExRef().GetBitmapRef()); - Bitmap::ScopedWriteAccess pWriteAccess(rBitmap); + BitmapScopedWriteAccess pWriteAccess(rBitmap); rIStream.Seek(nPosition); if( !ImportJPEG( rIStream, rGraphic, nImportFlags | GraphicFilterImportFlags::UseExistingBitmap, &pWriteAccess ) ) nStatus = ERRCODE_GRFILTER_FILTERERROR; diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx index 30ba1116eeb6..aa34877a9873 100644 --- a/vcl/source/filter/igif/gifread.cxx +++ b/vcl/source/filter/igif/gifread.cxx @@ -21,6 +21,7 @@ #include "gifread.hxx" #include <memory> #include <o3tl/make_unique.hxx> +#include <bitmapwriteaccess.hxx> #define NO_PENDING( rStm ) ( ( rStm ).GetError() != ERRCODE_IO_PENDING ) @@ -59,8 +60,8 @@ class GIFReader : public GraphicReader SvStream& rIStm; std::vector<sal_uInt8> aSrcBuf; std::unique_ptr<GIFLZWDecompressor> pDecomp; - Bitmap::ScopedWriteAccess pAcc8; - Bitmap::ScopedWriteAccess pAcc1; + BitmapScopedWriteAccess pAcc8; + BitmapScopedWriteAccess pAcc1; long nYAcc; long nLastPos; sal_uInt64 nMaxStreamData; @@ -205,7 +206,7 @@ void GIFReader::CreateBitmaps(long nWidth, long nHeight, BitmapPalette* pPal, if (!aAnimation.Count()) aBmp1.Erase(aWhite); - pAcc1 = Bitmap::ScopedWriteAccess(aBmp1); + pAcc1 = BitmapScopedWriteAccess(aBmp1); if (pAcc1) { @@ -227,7 +228,7 @@ void GIFReader::CreateBitmaps(long nWidth, long nHeight, BitmapPalette* pPal, else aBmp8.Erase(COL_WHITE); - pAcc8 = Bitmap::ScopedWriteAccess(aBmp8); + pAcc8 = BitmapScopedWriteAccess(aBmp8); bStatus = bool(pAcc8); } } @@ -690,13 +691,13 @@ Graphic GIFReader::GetIntermediateGraphic() pAcc1.reset(); aImGraphic = BitmapEx( aBmp8, aBmp1 ); - pAcc1 = Bitmap::ScopedWriteAccess(aBmp1); + pAcc1 = BitmapScopedWriteAccess(aBmp1); bStatus = bStatus && pAcc1; } else aImGraphic = aBmp8; - pAcc8 = Bitmap::ScopedWriteAccess(aBmp8); + pAcc8 = BitmapScopedWriteAccess(aBmp8); bStatus = bStatus && pAcc8; } diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index 376885703194..5597e851c6ea 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -19,6 +19,7 @@ #include <vcl/bitmapaccess.hxx> #include <vcl/graph.hxx> +#include <bitmapwriteaccess.hxx> using namespace com::sun::star; @@ -96,7 +97,7 @@ bool generatePreview(SvStream& rStream, Bitmap& rBitmap, // Save the buffer as a bitmap. Bitmap aBitmap(Size(nPageWidth, nPageHeight), 24); { - Bitmap::ScopedWriteAccess pWriteAccess(aBitmap); + BitmapScopedWriteAccess pWriteAccess(aBitmap); auto pPdfBuffer = static_cast<ConstScanline>(FPDFBitmap_GetBuffer(pPdfBitmap)); for (size_t nRow = 0; nRow < nPageHeight; ++nRow) { diff --git a/vcl/source/filter/ixbm/xbmread.cxx b/vcl/source/filter/ixbm/xbmread.cxx index 950bbb5c0f09..41258c387866 100644 --- a/vcl/source/filter/ixbm/xbmread.cxx +++ b/vcl/source/filter/ixbm/xbmread.cxx @@ -22,6 +22,7 @@ #include <comphelper/string.hxx> #include <rtl/character.hxx> +#include <bitmapwriteaccess.hxx> #include "xbmread.hxx" @@ -42,7 +43,7 @@ class XBMReader : public GraphicReader { SvStream& rIStm; Bitmap aBmp1; - Bitmap::ScopedWriteAccess pAcc1; + BitmapScopedWriteAccess pAcc1; std::unique_ptr<short[]> pHexTable; BitmapColor aWhite; @@ -323,7 +324,7 @@ ReadState XBMReader::ReadXBM( Graphic& rGraphic ) if ( bStatus && nWidth && nHeight ) { aBmp1 = Bitmap( Size( nWidth, nHeight ), 1 ); - pAcc1 = Bitmap::ScopedWriteAccess(aBmp1); + pAcc1 = BitmapScopedWriteAccess(aBmp1); if( pAcc1 ) { diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx index d627bd31db08..3f746715217a 100644 --- a/vcl/source/filter/ixpm/xpmread.cxx +++ b/vcl/source/filter/ixpm/xpmread.cxx @@ -18,6 +18,7 @@ */ #include <vcl/bitmapaccess.hxx> +#include <bitmapwriteaccess.hxx> #include <vcl/graph.hxx> #include "rgbtable.hxx" #include "xpmread.hxx" @@ -57,9 +58,9 @@ private: SvStream& mrIStm; Bitmap maBmp; - Bitmap::ScopedWriteAccess mpAcc; + BitmapScopedWriteAccess mpAcc; Bitmap maMaskBmp; - Bitmap::ScopedWriteAccess mpMaskAcc; + BitmapScopedWriteAccess mpMaskAcc; long mnLastPos; sal_uLong mnWidth; @@ -191,13 +192,13 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic ) nBits = 1; maBmp = Bitmap( Size( mnWidth, mnHeight ), nBits ); - mpAcc = Bitmap::ScopedWriteAccess(maBmp); + mpAcc = BitmapScopedWriteAccess(maBmp); // mbTransparent is TRUE if at least one colour is transparent if ( mbTransparent ) { maMaskBmp = Bitmap( Size( mnWidth, mnHeight ), 1 ); - mpMaskAcc = Bitmap::ScopedWriteAccess(maMaskBmp); + mpMaskAcc = BitmapScopedWriteAccess(maMaskBmp); if ( !mpMaskAcc ) mbStatus = false; } diff --git a/vcl/source/filter/jpeg/JpegReader.cxx b/vcl/source/filter/jpeg/JpegReader.cxx index 82d1279c1ba9..7b307d7f97cb 100644 --- a/vcl/source/filter/jpeg/JpegReader.cxx +++ b/vcl/source/filter/jpeg/JpegReader.cxx @@ -252,7 +252,7 @@ Graphic JPEGReader::CreateIntermediateGraphic(long nLines) if (nNewLines > 0) { { - Bitmap::ScopedWriteAccess pAccess(*mpIncompleteAlpha); + BitmapScopedWriteAccess pAccess(*mpIncompleteAlpha); pAccess->SetFillColor(COL_BLACK); pAccess->FillRect(tools::Rectangle(Point(0, mnLastLines), Size(pAccess->Width(), nNewLines))); } @@ -274,7 +274,7 @@ Graphic JPEGReader::CreateIntermediateGraphic(long nLines) return aGraphic; } -ReadState JPEGReader::Read( Graphic& rGraphic, GraphicFilterImportFlags nImportFlags, Bitmap::ScopedWriteAccess* ppAccess ) +ReadState JPEGReader::Read( Graphic& rGraphic, GraphicFilterImportFlags nImportFlags, BitmapScopedWriteAccess* ppAccess ) { ReadState eReadState; bool bRet = false; diff --git a/vcl/source/filter/jpeg/JpegReader.hxx b/vcl/source/filter/jpeg/JpegReader.hxx index 84ad8c2a718c..420351a092ca 100644 --- a/vcl/source/filter/jpeg/JpegReader.hxx +++ b/vcl/source/filter/jpeg/JpegReader.hxx @@ -25,6 +25,7 @@ #include <vcl/fltcall.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> +#include <bitmapwriteaccess.hxx> enum class GraphicFilterImportFlags; @@ -62,7 +63,7 @@ public: JPEGReader( SvStream& rStream, GraphicFilterImportFlags nImportFlags ); virtual ~JPEGReader() override; - ReadState Read(Graphic& rGraphic, GraphicFilterImportFlags nImportFlags, Bitmap::ScopedWriteAccess* ppAccess); + ReadState Read(Graphic& rGraphic, GraphicFilterImportFlags nImportFlags, BitmapScopedWriteAccess* ppAccess); bool CreateBitmap(JPEGCreateBitmapParam const & param); diff --git a/vcl/source/filter/jpeg/jpeg.cxx b/vcl/source/filter/jpeg/jpeg.cxx index 5b067153dc30..8739ed989a9a 100644 --- a/vcl/source/filter/jpeg/jpeg.cxx +++ b/vcl/source/filter/jpeg/jpeg.cxx @@ -25,7 +25,7 @@ #include <vcl/FilterConfigItem.hxx> #include <vcl/graphicfilter.hxx> -VCL_DLLPUBLIC bool ImportJPEG( SvStream& rInputStream, Graphic& rGraphic, GraphicFilterImportFlags nImportFlags, Bitmap::ScopedWriteAccess* ppAccess ) +VCL_DLLPUBLIC bool ImportJPEG( SvStream& rInputStream, Graphic& rGraphic, GraphicFilterImportFlags nImportFlags, BitmapScopedWriteAccess* ppAccess ) { bool bReturn = true; diff --git a/vcl/source/filter/jpeg/jpeg.h b/vcl/source/filter/jpeg/jpeg.h index 9e9a23c549c0..5dc114bd6516 100644 --- a/vcl/source/filter/jpeg/jpeg.h +++ b/vcl/source/filter/jpeg/jpeg.h @@ -26,6 +26,7 @@ #include <sal/types.h> #include <basegfx/vector/b2dsize.hxx> #include <vcl/bitmap.hxx> +#include <bitmapwriteaccess.hxx> #include <jpeglib.h> @@ -49,7 +50,7 @@ bool WriteJPEG( JPEGWriter* pJPEGWriter, void* pOutputStream, void ReadJPEG( JPEGReader* pJPEGReader, void* pInputStream, long* pLines, Size const & previewSize, GraphicFilterImportFlags nImportFlags, - Bitmap::ScopedWriteAccess* ppAccess ); + BitmapScopedWriteAccess* ppAccess ); void Transform(void* pInputStream, void* pOutputStream, long nAngle); diff --git a/vcl/source/filter/jpeg/jpeg.hxx b/vcl/source/filter/jpeg/jpeg.hxx index 776e7d60042f..442de6898cea 100644 --- a/vcl/source/filter/jpeg/jpeg.hxx +++ b/vcl/source/filter/jpeg/jpeg.hxx @@ -27,8 +27,9 @@ #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> +#include <bitmapwriteaccess.hxx> -VCL_DLLPUBLIC bool ImportJPEG( SvStream& rInputStream, Graphic& rGraphic, GraphicFilterImportFlags nImportFlags, Bitmap::ScopedWriteAccess* ppAccess ); +VCL_DLLPUBLIC bool ImportJPEG( SvStream& rInputStream, Graphic& rGraphic, GraphicFilterImportFlags nImportFlags, BitmapScopedWriteAccess* ppAccess ); bool ExportJPEG(SvStream& rOutputStream, const Graphic& rGraphic, diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx index 228de495f01a..c24b23463c21 100644 --- a/vcl/source/filter/jpeg/jpegc.cxx +++ b/vcl/source/filter/jpeg/jpegc.cxx @@ -133,14 +133,14 @@ struct JpegStuff jpeg_decompress_struct cinfo; ErrorManagerStruct jerr; JpegDecompressOwner aOwner; - std::unique_ptr<Bitmap::ScopedWriteAccess> pScopedAccess; + std::unique_ptr<BitmapScopedWriteAccess> pScopedAccess; std::vector<sal_uInt8> pScanLineBuffer; std::vector<sal_uInt8> pCYMKBuffer; }; void ReadJPEG(JpegStuff& rContext, JPEGReader* pJPEGReader, void* pInputStream, long* pLines, Size const & previewSize, GraphicFilterImportFlags nImportFlags, - Bitmap::ScopedWriteAccess* ppAccess) + BitmapScopedWriteAccess* ppAccess) { if (setjmp(rContext.jerr.setjmp_buffer)) { @@ -234,9 +234,9 @@ void ReadJPEG(JpegStuff& rContext, JPEGReader* pJPEGReader, void* pInputStream, // ppAccess must be set if this flag is used. assert(ppAccess); else - rContext.pScopedAccess.reset(new Bitmap::ScopedWriteAccess(pJPEGReader->GetBitmap())); + rContext.pScopedAccess.reset(new BitmapScopedWriteAccess(pJPEGReader->GetBitmap())); - Bitmap::ScopedWriteAccess& pAccess = bUseExistingBitmap ? *ppAccess : *rContext.pScopedAccess.get(); + BitmapScopedWriteAccess& pAccess = bUseExistingBitmap ? *ppAccess : *rContext.pScopedAccess.get(); if (pAccess) { @@ -341,7 +341,7 @@ void ReadJPEG(JpegStuff& rContext, JPEGReader* pJPEGReader, void* pInputStream, void ReadJPEG( JPEGReader* pJPEGReader, void* pInputStream, long* pLines, Size const & previewSize, GraphicFilterImportFlags nImportFlags, - Bitmap::ScopedWriteAccess* ppAccess ) + BitmapScopedWriteAccess* ppAccess ) { JpegStuff aContext; ReadJPEG(aContext, pJPEGReader, pInputStream, pLines, previewSize, nImportFlags, ppAccess); diff --git a/vcl/source/gdi/alpha.cxx b/vcl/source/gdi/alpha.cxx index 05207c39256f..25180f805319 100644 --- a/vcl/source/gdi/alpha.cxx +++ b/vcl/source/gdi/alpha.cxx @@ -20,6 +20,7 @@ #include <vcl/bitmapaccess.hxx> #include <tools/color.hxx> #include <vcl/alpha.hxx> +#include <bitmapwriteaccess.hxx> AlphaMask::AlphaMask() { @@ -88,7 +89,7 @@ void AlphaMask::Erase( sal_uInt8 cTransparency ) bool AlphaMask::Replace( const Bitmap& rMask, sal_uInt8 cReplaceTransparency ) { Bitmap::ScopedReadAccess pMaskAcc( const_cast<Bitmap&>(rMask) ); - AlphaMask::ScopedWriteAccess pAcc(*this); + AlphaScopedWriteAccess pAcc(*this); if( pMaskAcc && pAcc ) { @@ -111,7 +112,7 @@ bool AlphaMask::Replace( const Bitmap& rMask, sal_uInt8 cReplaceTransparency ) void AlphaMask::Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransparency ) { - AlphaMask::ScopedWriteAccess pAcc(*this); + AlphaScopedWriteAccess pAcc(*this); if( pAcc && pAcc->GetBitCount() == 8 ) { diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index 3ca45b578cf1..3d330f3b8366 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -36,6 +36,7 @@ #include <bitmapscalesuper.hxx> #include <octree.hxx> #include <BitmapScaleConvolution.hxx> +#include <bitmapwriteaccess.hxx> #define RGB15( _def_cR, _def_cG, _def_cB ) ((static_cast<sal_uLong>(_def_cR)<<10)|(static_cast<sal_uLong>(_def_cG)<<5)|static_cast<sal_uLong>(_def_cB)) #define GAMMA( _def_cVal, _def_InvGamma ) (static_cast<sal_uInt8>(MinMax(FRound(pow( _def_cVal/255.0,_def_InvGamma)*255.0),0,255))) @@ -319,7 +320,7 @@ bool Bitmap::ImplMakeGreyscales( sal_uInt16 nGreys ) if( bPalDiffers ) { Bitmap aNewBmp( GetSizePixel(), ( nGreys == 16 ) ? 4 : 8, &rPal ); - ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); if( pWriteAcc ) { @@ -429,7 +430,7 @@ bool Bitmap::ImplConvertUp(sal_uInt16 nBitCount, Color const * pExtColor) { BitmapPalette aPalette; Bitmap aNewBmp(GetSizePixel(), nBitCount, pReadAcc->HasPalette() ? &pReadAcc->GetPalette() : &aPalette); - Bitmap::ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); if (pWriteAcc) { @@ -518,7 +519,7 @@ bool Bitmap::ImplConvertDown(sal_uInt16 nBitCount, Color const * pExtColor) { BitmapPalette aPalette; Bitmap aNewBmp(GetSizePixel(), nBitCount, &aPalette); - Bitmap::ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); if (pWriteAcc) { @@ -654,7 +655,7 @@ bool Bitmap::ImplConvertGhosted() } aNewBmp = Bitmap( GetSizePixel(), GetBitCount(), &aNewPal ); - ScopedWriteAccess pW(aNewBmp); + BitmapScopedWriteAccess pW(aNewBmp); if( pW ) { @@ -666,7 +667,7 @@ bool Bitmap::ImplConvertGhosted() { aNewBmp = Bitmap( GetSizePixel(), 24 ); - ScopedWriteAccess pW(aNewBmp); + BitmapScopedWriteAccess pW(aNewBmp); if( pW ) { @@ -901,7 +902,7 @@ bool Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY ) if(pReadAcc) { Bitmap aNewBmp( Size( nNewWidth, nNewHeight ), GetBitCount(), &pReadAcc->GetPalette() ); - ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); if( pWriteAcc ) { @@ -971,7 +972,7 @@ bool Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rScaleY long nWidth = pReadAcc->Width(); long nHeight = pReadAcc->Height(); Bitmap aNewBmp( Size( nNewWidth, nHeight ), 24 ); - ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); if( pWriteAcc ) { @@ -1061,7 +1062,7 @@ bool Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rScaleY *this = aNewBmp; aNewBmp = Bitmap( Size( nNewWidth, nNewHeight ), 24 ); pReadAcc = ScopedReadAccess(*this); - pWriteAcc = ScopedWriteAccess(aNewBmp); + pWriteAcc = BitmapScopedWriteAccess(aNewBmp); if( pReadAcc && pWriteAcc ) { @@ -1166,7 +1167,7 @@ bool Bitmap::ImplDitherMatrix() { ScopedReadAccess pReadAcc(*this); Bitmap aNewBmp( GetSizePixel(), 8 ); - ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); bool bRet = false; if( pReadAcc && pWriteAcc ) @@ -1243,7 +1244,7 @@ bool Bitmap::ImplDitherFloyd() { ScopedReadAccess pReadAcc(*this); Bitmap aNewBmp( GetSizePixel(), 8 ); - ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); if( pReadAcc && pWriteAcc ) { @@ -1379,7 +1380,7 @@ bool Bitmap::ImplDitherFloyd16() { ScopedReadAccess pReadAcc(*this); Bitmap aNewBmp( GetSizePixel(), 24 ); - ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); bool bRet = false; if( pReadAcc && pWriteAcc ) @@ -1514,7 +1515,7 @@ bool Bitmap::ImplReduceSimple( sal_uInt16 nColorCount ) const BitmapPalette& rPal = aOct.GetPalette(); aNewBmp = Bitmap( GetSizePixel(), nBitCount, &rPal ); - ScopedWriteAccess pWAcc(aNewBmp); + BitmapScopedWriteAccess pWAcc(aNewBmp); if( pWAcc ) { @@ -1671,7 +1672,7 @@ bool Bitmap::ImplReducePopular( sal_uInt16 nColCount ) } Bitmap aNewBmp( GetSizePixel(), nBitCount, &aNewPal ); - ScopedWriteAccess pWAcc(aNewBmp); + BitmapScopedWriteAccess pWAcc(aNewBmp); if( pWAcc ) { @@ -1757,7 +1758,7 @@ bool Bitmap::ImplReduceMedian( sal_uInt16 nColCount ) if( pRAcc ) { Bitmap aNewBmp( GetSizePixel(), nBitCount ); - ScopedWriteAccess pWAcc(aNewBmp); + BitmapScopedWriteAccess pWAcc(aNewBmp); if( pWAcc ) { @@ -1985,7 +1986,7 @@ bool Bitmap::Adjust( short nLuminancePercent, short nContrastPercent, } else { - ScopedWriteAccess pAcc(*this); + BitmapScopedWriteAccess pAcc(*this); if( pAcc ) { @@ -2122,7 +2123,7 @@ bool Bitmap::ImplConvolutionPass(Bitmap& aNewBitmap, BitmapReadAccess const * pR if (!pReadAcc) return false; - ScopedWriteAccess pWriteAcc(aNewBitmap); + BitmapScopedWriteAccess pWriteAcc(aNewBitmap); if (!pWriteAcc) return false; diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx index 118fdf8916c4..62d0dc418350 100644 --- a/vcl/source/gdi/bitmap4.cxx +++ b/vcl/source/gdi/bitmap4.cxx @@ -23,6 +23,7 @@ #include <vcl/bitmapaccess.hxx> #include <vcl/bitmap.hxx> #include <impbmp.hxx> +#include <bitmapwriteaccess.hxx> #define S2(a,b) { long t; if( ( t = b - a ) < 0 ) { a += t; b -= t; } } #define MN3(a,b,c) S2(a,b); S2(a,c); @@ -121,7 +122,7 @@ bool Bitmap::ImplConvolute3( const long* pMatrix ) if( pReadAcc ) { Bitmap aNewBmp( GetSizePixel(), 24 ); - ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); if( pWriteAcc ) { @@ -279,7 +280,7 @@ bool Bitmap::ImplMedianFilter() if( pReadAcc ) { Bitmap aNewBmp( GetSizePixel(), 24 ); - ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); if( pWriteAcc ) { @@ -444,7 +445,7 @@ bool Bitmap::ImplSobelGrey() if( pReadAcc ) { Bitmap aNewBmp( GetSizePixel(), 8, &pReadAcc->GetPalette() ); - ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); if( pWriteAcc ) { @@ -571,7 +572,7 @@ bool Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam ) if( pReadAcc ) { Bitmap aNewBmp( GetSizePixel(), 8, &pReadAcc->GetPalette() ); - ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); if( pWriteAcc ) { @@ -674,7 +675,7 @@ bool Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam ) bool Bitmap::ImplSolarize( const BmpFilterParam* pFilterParam ) { bool bRet = false; - ScopedWriteAccess pWriteAcc(*this); + BitmapScopedWriteAccess pWriteAcc(*this); if( pWriteAcc ) { @@ -743,7 +744,7 @@ bool Bitmap::ImplSepia( const BmpFilterParam* pFilterParam ) } Bitmap aNewBmp( GetSizePixel(), 8, &aSepiaPal ); - ScopedWriteAccess pWriteAcc(aNewBmp); + BitmapScopedWriteAccess pWriteAcc(aNewBmp); if( pWriteAcc ) { @@ -1007,7 +1008,7 @@ bool Bitmap::ImplPopArt() { bRet = false; - ScopedWriteAccess pWriteAcc(*this); + BitmapScopedWriteAccess pWriteAcc(*this); if( pWriteAcc ) { @@ -1216,7 +1217,7 @@ bool Bitmap::ImplSeparableUnsharpenFilter(const double radius) { ScopedReadAccess pReadAccBlur(aBlur); ScopedReadAccess pReadAcc(*this); - ScopedWriteAccess pWriteAcc(aResultBitmap); + BitmapScopedWriteAccess pWriteAcc(aResultBitmap); BitmapColor aColor, aColorBlur; @@ -1252,7 +1253,7 @@ bool Bitmap::ImplDuotoneFilter( const sal_uLong nColorOne, const sal_uLong nColo Bitmap aResultBitmap( GetSizePixel(), 24); ScopedReadAccess pReadAcc(*this); - ScopedWriteAccess pWriteAcc(aResultBitmap); + BitmapScopedWriteAccess pWriteAcc(aResultBitmap); const BitmapColor aColorOne( static_cast< sal_uInt8 >( nColorOne >> 16 ), static_cast< sal_uInt8 >( nColorOne >> 8 ), static_cast< sal_uInt8 >( nColorOne ) ); const BitmapColor aColorTwo( static_cast< sal_uInt8 >( nColorTwo >> 16 ), static_cast< sal_uInt8 >( nColorTwo >> 8 ), static_cast< sal_uInt8 >( nColorTwo ) ); diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index 70dbeea87026..07d5d19e7869 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -44,6 +44,7 @@ #include <svdata.hxx> #include <com/sun/star/beans/XFastPropertySet.hpp> #include <memory> +#include <bitmapwriteaccess.hxx> using namespace ::com::sun::star; @@ -823,7 +824,7 @@ namespace bool bSmooth) { Bitmap aDestination(rDestinationSize, 24); - Bitmap::ScopedWriteAccess xWrite(aDestination); + BitmapScopedWriteAccess xWrite(aDestination); if(xWrite) { @@ -1036,7 +1037,7 @@ BitmapEx BitmapEx::ModifyBitmapEx(const basegfx::BColorModifierStack& rBColorMod } else { - Bitmap::ScopedWriteAccess xContent(aChangedBitmap); + BitmapScopedWriteAccess xContent(aChangedBitmap); if(xContent) { @@ -1204,8 +1205,8 @@ BitmapEx createBlendFrame( aContent.Erase(COL_BLACK); - Bitmap::ScopedWriteAccess pContent(aContent); - AlphaMask::ScopedWriteAccess pAlpha(aAlpha); + BitmapScopedWriteAccess pContent(aContent); + AlphaScopedWriteAccess pAlpha(aAlpha); if(pContent && pAlpha) { @@ -1304,7 +1305,7 @@ void BitmapEx::Replace(const Color& rSearchColor, void BitmapEx::setAlphaFrom( sal_uInt8 cIndexFrom, sal_Int8 nAlphaTo ) { AlphaMask aAlphaMask(GetAlpha()); - Bitmap::ScopedWriteAccess pWriteAccess(aAlphaMask); + BitmapScopedWriteAccess pWriteAccess(aAlphaMask); Bitmap::ScopedReadAccess pReadAccess(maBitmap); assert( pReadAccess.get() && pWriteAccess.get() ); if ( pReadAccess.get() && pWriteAccess.get() ) @@ -1337,7 +1338,7 @@ void BitmapEx::AdjustTransparency(sal_uInt8 cTrans) else { aAlpha = GetAlpha(); - Bitmap::ScopedWriteAccess pA(aAlpha); + BitmapScopedWriteAccess pA(aAlpha); assert(pA); if( !pA ) diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx index f5a218ccf464..e5134c5019b5 100644 --- a/vcl/source/gdi/bmpacc.cxx +++ b/vcl/source/gdi/bmpacc.cxx @@ -22,7 +22,7 @@ #include <vcl/bitmapaccess.hxx> #include <impbmp.hxx> - +#include <bitmapwriteaccess.hxx> #include <string.h> diff --git a/vcl/source/gdi/bmpacc3.cxx b/vcl/source/gdi/bmpacc3.cxx index 3e665746481b..e1d382ba4114 100644 --- a/vcl/source/gdi/bmpacc3.cxx +++ b/vcl/source/gdi/bmpacc3.cxx @@ -25,6 +25,7 @@ #include <vcl/bitmapaccess.hxx> #include <bmpfast.hxx> +#include <bitmapwriteaccess.hxx> void BitmapWriteAccess::SetLineColor( const Color& rColor ) { diff --git a/vcl/source/gdi/bmpfast.cxx b/vcl/source/gdi/bmpfast.cxx index c08a9b349d1b..be98cf70ee95 100644 --- a/vcl/source/gdi/bmpfast.cxx +++ b/vcl/source/gdi/bmpfast.cxx @@ -19,6 +19,7 @@ #include <bmpfast.hxx> #include <vcl/bitmapaccess.hxx> +#include <bitmapwriteaccess.hxx> #define FAST_ARGB_BGRA diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index 68d946753728..de8615226492 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -30,6 +30,7 @@ #include <vcl/bitmapex.hxx> #include <vcl/bitmapaccess.hxx> #include <vcl/outdev.hxx> +#include <bitmapwriteaccess.hxx> #include <memory> @@ -955,7 +956,7 @@ bool ImplReadDIBBody(SvStream& rIStm, Bitmap& rBmp, AlphaMask* pBmpAlpha, sal_uL const Size aSizePixel(aHeader.nWidth, aHeader.nHeight); AlphaMask aNewBmpAlpha; - AlphaMask::ScopedWriteAccess pAccAlpha; + AlphaScopedWriteAccess pAccAlpha; bool bAlphaPossible(pBmpAlpha && aHeader.nBitCount == 32); if (bAlphaPossible) @@ -977,7 +978,7 @@ bool ImplReadDIBBody(SvStream& rIStm, Bitmap& rBmp, AlphaMask* pBmpAlpha, sal_uL if (bAlphaPossible) { aNewBmpAlpha = AlphaMask(aSizePixel); - pAccAlpha = AlphaMask::ScopedWriteAccess(aNewBmpAlpha); + pAccAlpha = AlphaScopedWriteAccess(aNewBmpAlpha); } sal_uInt16 nBitCount(discretizeBitcount(aHeader.nBitCount)); @@ -994,7 +995,7 @@ bool ImplReadDIBBody(SvStream& rIStm, Bitmap& rBmp, AlphaMask* pBmpAlpha, sal_uL } Bitmap aNewBmp(aSizePixel, nBitCount, pPal); - Bitmap::ScopedWriteAccess pAcc(aNewBmp); + BitmapScopedWriteAccess pAcc(aNewBmp); if (!pAcc) return false; if (pAcc->Width() != aHeader.nWidth || pAcc->Height() != aHeader.nHeight) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index bb9c819c4799..0050b99d863a 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -83,6 +83,7 @@ #include <sallayout.hxx> #include <textlayout.hxx> #include <textlineinfo.hxx> +#include <bitmapwriteaccess.hxx> #include "pdfwriter_impl.hxx" @@ -291,7 +292,7 @@ void doTestCode() // prepare an alpha mask Bitmap aTransMask( Size( 256, 256 ), 8, &Bitmap::GetGreyPalette( 256 ) ); - Bitmap::ScopedWriteAccess pAcc(aTransMask); + BitmapScopedWriteAccess pAcc(aTransMask); for( int nX = 0; nX < 256; nX++ ) for( int nY = 0; nY < 256; nY++ ) pAcc->SetPixel( nX, nY, BitmapColor( (sal_uInt8)((nX+nY)/2) ) ); @@ -315,7 +316,7 @@ void doTestCode() aWriter.DrawRect( aTranspRect ); Bitmap aImageBmp( Size( 256, 256 ), 24 ); - pAcc = Bitmap::ScopedWriteAccess(aImageBmp); + pAcc = BitmapScopedWriteAccess(aImageBmp); pAcc->SetFillColor( Color( 0xff, 0, 0xff ) ); pAcc->FillRect( Rectangle( Point( 0, 0 ), Size( 256, 256 ) ) ); pAcc.reset(); @@ -9372,7 +9373,7 @@ namespace if (eFormat != ScanlineFormat::N1BitLsbPal) return rBitmap; Bitmap aNewBmp(rBitmap); - Bitmap::ScopedWriteAccess xWriteAcc(aNewBmp); + BitmapScopedWriteAccess xWriteAcc(aNewBmp); const int nScanLineBytes = (pAccess->Width() + 7U) / 8U; for (long nY = 0L; nY < xWriteAcc->Height(); ++nY) { diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx index 446dd6784904..f00a096f5573 100644 --- a/vcl/source/gdi/pngread.cxx +++ b/vcl/source/gdi/pngread.cxx @@ -33,6 +33,7 @@ #include <vcl/alpha.hxx> #include <osl/endian.h> #include <o3tl/make_unique.hxx> +#include <bitmapwriteaccess.hxx> namespace vcl { @@ -80,11 +81,11 @@ private: std::vector<sal_uInt8>::iterator maDataIter; std::unique_ptr<Bitmap> mpBmp; - Bitmap::ScopedWriteAccess mxAcc; + BitmapScopedWriteAccess mxAcc; std::unique_ptr<Bitmap> mpMaskBmp; - Bitmap::ScopedWriteAccess mxMaskAcc; + BitmapScopedWriteAccess mxMaskAcc; std::unique_ptr<AlphaMask> mpAlphaMask; - AlphaMask::ScopedWriteAccess mxAlphaAcc; + AlphaScopedWriteAccess mxAlphaAcc; BitmapWriteAccess* mpMaskAcc; ZCodec mpZCodec; @@ -665,7 +666,7 @@ bool PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) return false; mpBmp = o3tl::make_unique<Bitmap>( maTargetSize, mnTargetDepth ); - mxAcc = Bitmap::ScopedWriteAccess(*mpBmp); + mxAcc = BitmapScopedWriteAccess(*mpBmp); if (!mxAcc) return false; @@ -673,7 +674,7 @@ bool PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) { mpAlphaMask = o3tl::make_unique<AlphaMask>( maTargetSize ); mpAlphaMask->Erase( 128 ); - mxAlphaAcc = AlphaMask::ScopedWriteAccess(*mpAlphaMask); + mxAlphaAcc = AlphaScopedWriteAccess(*mpAlphaMask); mpMaskAcc = mxAlphaAcc.get(); if (!mpMaskAcc) return false; @@ -790,13 +791,13 @@ bool PNGReaderImpl::ImplReadTransparent() if( bNeedAlpha) { mpAlphaMask = o3tl::make_unique<AlphaMask>( maTargetSize ); - mxAlphaAcc = AlphaMask::ScopedWriteAccess(*mpAlphaMask); + mxAlphaAcc = AlphaScopedWriteAccess(*mpAlphaMask); mpMaskAcc = mxAlphaAcc.get(); } else { mpMaskBmp = o3tl::make_unique<Bitmap>( maTargetSize, 1 ); - mxMaskAcc = Bitmap::ScopedWriteAccess(*mpMaskBmp); + mxMaskAcc = BitmapScopedWriteAccess(*mpMaskBmp); mpMaskAcc = mxMaskAcc.get(); } mbTransparent = (mpMaskAcc != nullptr); @@ -1142,7 +1143,7 @@ namespace return nIndex; } - void SanitizePaletteIndexes(sal_uInt8* pEntries, int nLen, const Bitmap::ScopedWriteAccess& rAcc) + void SanitizePaletteIndexes(sal_uInt8* pEntries, int nLen, const BitmapScopedWriteAccess& rAcc) { sal_uInt16 nPaletteEntryCount = rAcc->GetPaletteEntryCount(); for (int nX = 0; nX < nLen; ++nX) diff --git a/vcl/source/graphic/GraphicObject2.cxx b/vcl/source/graphic/GraphicObject2.cxx index c6a7e688d9af..7e951479912a 100644 --- a/vcl/source/graphic/GraphicObject2.cxx +++ b/vcl/source/graphic/GraphicObject2.cxx @@ -33,6 +33,7 @@ #include <vcl/virdev.hxx> #include "grfcache.hxx" #include <vcl/GraphicObject.hxx> +#include <bitmapwriteaccess.hxx> #include <memory> diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx index ba653f00ba35..02b0fc338d72 100644 --- a/vcl/source/helper/canvastools.cxx +++ b/vcl/source/helper/canvastools.cxx @@ -58,6 +58,7 @@ #include <canvasbitmap.hxx> #include <vcl/canvastools.hxx> +#include <bitmapwriteaccess.hxx> using namespace ::com::sun::star; @@ -89,8 +90,8 @@ namespace vcl sal_Int32 nHeight, const rendering::IntegerBitmapLayout& rLayout, const uno::Reference< rendering::XIntegerReadOnlyBitmap >& xInputBitmap, - Bitmap::ScopedWriteAccess& rWriteAcc, - Bitmap::ScopedWriteAccess& rAlphaAcc ) + BitmapScopedWriteAccess& rWriteAcc, + BitmapScopedWriteAccess& rAlphaAcc ) { rendering::IntegerBitmapLayout aCurrLayout; geometry::IntegerRectangle2D aRect; @@ -298,8 +299,8 @@ namespace vcl sal::static_int_cast<sal_uInt16>(1 << nAlphaDepth)) ); { // limit scoped access - Bitmap::ScopedWriteAccess pWriteAccess( aBitmap ); - Bitmap::ScopedWriteAccess pAlphaWriteAccess( nAlphaDepth ? aAlpha.AcquireWriteAccess() : nullptr, + BitmapScopedWriteAccess pWriteAccess( aBitmap ); + BitmapScopedWriteAccess pAlphaWriteAccess( nAlphaDepth ? aAlpha.AcquireWriteAccess() : nullptr, aAlpha ); ENSURE_OR_THROW(pWriteAccess.get() != nullptr, diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index 43038867f7e5..3bad4ea44b87 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -40,6 +40,7 @@ #include <vcl/opengl/OpenGLWrapper.hxx> #include <vcl/opengl/OpenGLContext.hxx> #include <desktop/crashreport.hxx> +#include <bitmapwriteaccess.hxx> #if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID && !defined HAIKU #include <opengl/x11/X11DeviceInfo.hxx> @@ -583,8 +584,8 @@ BitmapEx OpenGLHelper::ConvertBGRABufferToBitmapEx(const sal_uInt8* const pBuffe AlphaMask aAlpha( Size(nWidth, nHeight) ); { - Bitmap::ScopedWriteAccess pWriteAccess( aBitmap ); - AlphaMask::ScopedWriteAccess pAlphaWriteAccess( aAlpha ); + BitmapScopedWriteAccess pWriteAccess( aBitmap ); + AlphaScopedWriteAccess pAlphaWriteAccess( aAlpha ); size_t nCurPos = 0; for( long y = 0; y < nHeight; ++y) diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index 8006bd823032..eb0093d164cd 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -41,6 +41,7 @@ #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <memory> #include <comphelper/lok.hxx> +#include <bitmapwriteaccess.hxx> void OutputDevice::DrawBitmap( const Point& rDestPt, const Bitmap& rBitmap ) { @@ -997,7 +998,7 @@ void OutputDevice::DrawDeviceAlphaBitmapSlowPath(const Bitmap& rBitmap, const Al { LinearScaleContext aLinearContext(aDstRect, aBmpRect, aOutSize, nOffX, nOffY); - if (aLinearContext.blendBitmap( Bitmap::ScopedWriteAccess(aBmp).get(), pBitmapReadAccess.get(), pAlphaReadAccess.get(), + if (aLinearContext.blendBitmap( BitmapScopedWriteAccess(aBmp).get(), pBitmapReadAccess.get(), pAlphaReadAccess.get(), nDstWidth, nDstHeight)) { aNewBitmap = aBmp; @@ -1410,14 +1411,14 @@ Bitmap OutputDevice::BlendBitmapWithAlpha( mpAlphaVDev->EnableMapMode(false); Bitmap aAlphaBitmap( mpAlphaVDev->GetBitmap( aDstRect.TopLeft(), aDstRect.GetSize() ) ); - Bitmap::ScopedWriteAccess pAlphaW(aAlphaBitmap); + BitmapScopedWriteAccess pAlphaW(aAlphaBitmap); if( GetBitCount() <= 8 ) { Bitmap aDither( aBmp.GetSizePixel(), 8 ); BitmapColor aIndex( 0 ); Bitmap::ScopedReadAccess pB(aBmp); - Bitmap::ScopedWriteAccess pW(aDither); + BitmapScopedWriteAccess pW(aDither); if (pB && pP && pA && pW && pAlphaW) { @@ -1456,7 +1457,7 @@ Bitmap OutputDevice::BlendBitmapWithAlpha( } else { - Bitmap::ScopedWriteAccess pB(aBmp); + BitmapScopedWriteAccess pB(aBmp); if (pB && pP && pA && pAlphaW) { for( nY = 0; nY < nDstHeight; nY++ ) @@ -1510,7 +1511,7 @@ Bitmap OutputDevice::BlendBitmap( Bitmap aDither( aBmp.GetSizePixel(), 8 ); BitmapColor aIndex( 0 ); Bitmap::ScopedReadAccess pB(aBmp); - Bitmap::ScopedWriteAccess pW(aDither); + BitmapScopedWriteAccess pW(aDither); if( pB && pP && pA && pW ) { @@ -1553,7 +1554,7 @@ Bitmap OutputDevice::BlendBitmap( } else { - Bitmap::ScopedWriteAccess pB(aBmp); + BitmapScopedWriteAccess pB(aBmp); bool bFastBlend = false; if( pP && pA && pB ) diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx index 8d52a27bd4c6..cbe143a46da0 100644 --- a/vcl/source/outdev/transparent.cxx +++ b/vcl/source/outdev/transparent.cxx @@ -34,6 +34,7 @@ #include <outdata.hxx> #include <salgdi.hxx> +#include <bitmapwriteaccess.hxx> namespace { @@ -468,7 +469,7 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly, // #107766# check for non-empty bitmaps before accessing them if( !!aPaint && !!aPolyMask ) { - Bitmap::ScopedWriteAccess pW(aPaint); + BitmapScopedWriteAccess pW(aPaint); Bitmap::ScopedReadAccess pR(aPolyMask); if( pW && pR ) diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx index 30aa4e0e5d14..190af5689bf3 100644 --- a/vcl/workben/svptest.cxx +++ b/vcl/workben/svptest.cxx @@ -35,6 +35,7 @@ #include <vcl/bitmapaccess.hxx> #include <vcl/metric.hxx> #include <vcl/vclptr.hxx> +#include <bitmapwriteaccess.hxx> #include <rtl/ustrbuf.hxx> diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index e133c02dc49a..841cc2103cd8 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -45,6 +45,7 @@ #include <vcl/help.hxx> #include <vcl/menu.hxx> #include <vcl/ImageTree.hxx> +#include <bitmapwriteaccess.hxx> #include <basegfx/numeric/ftools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> @@ -1301,8 +1302,8 @@ public: AlphaMask aMask(aSrc.GetSizePixel()); Bitmap aRecovered(aSrc.GetSizePixel(), 24); { - AlphaMask::ScopedWriteAccess pMaskAcc(aMask); - Bitmap::ScopedWriteAccess pRecAcc(aRecovered); + AlphaScopedWriteAccess pMaskAcc(aMask); + BitmapScopedWriteAccess pRecAcc(aRecovered); Bitmap::ScopedReadAccess pAccW(aWhiteBmp); // a * pix + (1-a) Bitmap::ScopedReadAccess pAccB(aBlackBmp); // a * pix + 0 int nSizeX = aSrc.GetSizePixel().Width(); |