include/vcl/alpha.hxx | 2 +- vcl/qa/cppunit/BackendTest.cxx | 2 +- vcl/qa/cppunit/canvasbitmaptest.cxx | 4 ++-- vcl/source/bitmap/BitmapTools.cxx | 2 +- vcl/source/bitmap/alpha.cxx | 11 ----------- vcl/unx/generic/window/salframe.cxx | 2 +- 6 files changed, 6 insertions(+), 17 deletions(-)
New commits: commit 1c1806724dd9010d365fa64cc741a1e94dc9b065 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sat Dec 2 15:28:47 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Dec 2 20:20:40 2023 +0100 AlphaMask::ReleaseAccess is unnecessary There is no way the format can change via the Bitmap*Access mechanisms, and we already perform these asserts in the constructor and operator=. The code has been there since commit 8ab086b6cc054501bfbf7ef6fa509c393691e860 Author: Jens-Heiner Rechtien <h...@openoffice.org> Date: Mon Sep 18 16:07:07 2000 +0000 initial import Change-Id: I75195f6fd4e29d7133e787131b6c8479a9188d1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160242 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/vcl/alpha.hxx b/include/vcl/alpha.hxx index 9c6b1070ed53..8de4ea113d01 100644 --- a/include/vcl/alpha.hxx +++ b/include/vcl/alpha.hxx @@ -66,7 +66,7 @@ public: BitmapReadAccess* AcquireAlphaReadAccess() { return Bitmap::AcquireReadAccess(); } BitmapWriteAccess* AcquireAlphaWriteAccess() { return Bitmap::AcquireWriteAccess(); } - void ReleaseAccess( BitmapReadAccess* pAccess ); + using Bitmap::ReleaseAccess; typedef vcl::ScopedBitmapAccess<BitmapReadAccess, AlphaMask, &AlphaMask::AcquireAlphaReadAccess> ScopedReadAccess; diff --git a/vcl/qa/cppunit/BackendTest.cxx b/vcl/qa/cppunit/BackendTest.cxx index e5013d244335..c4cc184fb7ad 100644 --- a/vcl/qa/cppunit/BackendTest.cxx +++ b/vcl/qa/cppunit/BackendTest.cxx @@ -1182,7 +1182,7 @@ public: alpha.Erase(255); // transparent BitmapWriteAccess* alphaWrite = alpha.AcquireAlphaWriteAccess(); alphaWrite->SetPixelIndex(0, 0, 255); // opaque - alpha.ReleaseAccess(alphaWrite); + Bitmap::ReleaseAccess(alphaWrite); 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/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx index 78eb033f90b0..5aba5982427e 100644 --- a/vcl/qa/cppunit/canvasbitmaptest.cxx +++ b/vcl/qa/cppunit/canvasbitmaptest.cxx @@ -701,7 +701,7 @@ void CanvasBitmapTest::runTest() pAcc->SetPixel(0,0,BitmapColor(0)); pAcc->SetPixel(0,1,BitmapColor(255)); pAcc->SetPixel(0,2,BitmapColor(0)); - aAlpha.ReleaseAccess(pAcc); + Bitmap::ReleaseAccess(pAcc); } } @@ -772,7 +772,7 @@ void CanvasBitmapTest::runTest() CPPUNIT_ASSERT_EQUAL_MESSAGE("(9,2) correct alpha content", BitmapColor(2), pAlphaAcc->GetPixel(2,9)); - aBitmapAlpha.ReleaseAccess(pAlphaAcc); + Bitmap::ReleaseAccess(pAlphaAcc); Bitmap::ReleaseAccess(pBmpAcc); } } diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx index 7caf1f12f328..1b67ea06ac1a 100644 --- a/vcl/source/bitmap/BitmapTools.cxx +++ b/vcl/source/bitmap/BitmapTools.cxx @@ -992,7 +992,7 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un ::Bitmap::ReleaseAccess( pBitmapReadAcc ); if( pAlphaReadAcc ) - aAlpha.ReleaseAccess( pAlphaReadAcc ); + ::Bitmap::ReleaseAccess( pAlphaReadAcc ); bHasAlpha = bIsAlpha; diff --git a/vcl/source/bitmap/alpha.cxx b/vcl/source/bitmap/alpha.cxx index b250f4170a74..65b63dd1ffd0 100644 --- a/vcl/source/bitmap/alpha.cxx +++ b/vcl/source/bitmap/alpha.cxx @@ -176,17 +176,6 @@ bool AlphaMask::hasAlpha() const return false; } -void AlphaMask::ReleaseAccess( BitmapReadAccess* pAccess ) -{ - if( pAccess ) - { - Bitmap::ReleaseAccess( pAccess ); - Convert( BmpConversion::N8BitNoConversion ); - } - assert( getPixelFormat() == vcl::PixelFormat::N8_BPP && "alpha bitmap should be 8bpp" ); - assert( HasGreyPalette8Bit() && "alpha bitmap should have greyscale palette" ); -} - bool AlphaMask::AlphaCombineOr(const AlphaMask& rMask) { ScopedReadAccess pMaskAcc(const_cast<AlphaMask&>(rMask)); diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index d634bddb1eab..8d1691ee212d 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -282,7 +282,7 @@ static void CreateNetWmAppIcon( sal_uInt16 nIcon, NetWmIconData& netwm_icon ) netwm_icon[ pos++ ] = (((( 255 - alpha.GetBlue()) * 256U ) + col.GetRed()) * 256 + col.GetGreen()) * 256 + col.GetBlue(); } Bitmap::ReleaseAccess( iconData ); - mask.ReleaseAccess( maskData ); + Bitmap::ReleaseAccess( maskData ); } netwm_icon.resize( pos ); }