diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-05-10 14:06:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-05-10 15:54:11 +0200 |
commit | 04f02cfecfae481f256b6c98a1940fc5235a921a (patch) | |
tree | f2531f6d05e74109ab3a52c821281922db4b806f /vcl | |
parent | 6ec2d6461fe9c41025ce2bde13ddeb02acb01cb3 (diff) |
AlphaMask::BlendWith wants an AlphaMask parameter
so make it so
Change-Id: Ia5a91c78d2fd10f22eb19e4ebbd753151149190f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151630
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qa/cppunit/skia/skia.cxx | 8 | ||||
-rw-r--r-- | vcl/source/bitmap/alpha.cxx | 5 |
2 files changed, 6 insertions, 7 deletions
diff --git a/vcl/qa/cppunit/skia/skia.cxx b/vcl/qa/cppunit/skia/skia.cxx index 606541a0ac48..5d81e39f587a 100644 --- a/vcl/qa/cppunit/skia/skia.cxx +++ b/vcl/qa/cppunit/skia/skia.cxx @@ -232,12 +232,12 @@ void SkiaTest::testAlphaBlendWith() if (!SkiaHelper::isVCLSkiaEnabled()) return; AlphaMask alpha(Size(10, 10)); - Bitmap bitmap(Size(10, 10), vcl::PixelFormat::N24_BPP); + AlphaMask bitmap(Size(10, 10)); // Test with erase colors set. alpha.Erase(64); SkiaSalBitmap* skiaAlpha = dynamic_cast<SkiaSalBitmap*>(alpha.ImplGetSalBitmap().get()); CPPUNIT_ASSERT(skiaAlpha->unittestHasEraseColor()); - bitmap.Erase(Color(64, 64, 64)); + bitmap.Erase(64); SkiaSalBitmap* skiaBitmap = dynamic_cast<SkiaSalBitmap*>(bitmap.ImplGetSalBitmap().get()); CPPUNIT_ASSERT(skiaBitmap->unittestHasEraseColor()); alpha.BlendWith(bitmap); @@ -254,7 +254,7 @@ void SkiaTest::testAlphaBlendWith() skiaAlpha->GetSkImage(); CPPUNIT_ASSERT(!skiaAlpha->unittestHasEraseColor()); CPPUNIT_ASSERT(skiaAlpha->unittestHasImage()); - bitmap.Erase(Color(64, 64, 64)); + bitmap.Erase(64); Bitmap::ScopedReadAccess(bitmap)->GetColor(0, 0); // Reading a pixel will create pixel data. skiaBitmap = dynamic_cast<SkiaSalBitmap*>(bitmap.ImplGetSalBitmap().get()); skiaBitmap->GetSkImage(); @@ -271,7 +271,7 @@ void SkiaTest::testAlphaBlendWith() alpha.Erase(64); skiaAlpha = dynamic_cast<SkiaSalBitmap*>(alpha.ImplGetSalBitmap().get()); CPPUNIT_ASSERT(skiaAlpha->unittestHasEraseColor()); - bitmap.Erase(Color(64, 64, 64)); + bitmap.Erase(64); Bitmap::ScopedReadAccess(bitmap)->GetColor(0, 0); // Reading a pixel will create pixel data. skiaBitmap = dynamic_cast<SkiaSalBitmap*>(bitmap.ImplGetSalBitmap().get()); skiaBitmap->GetSkImage(); diff --git a/vcl/source/bitmap/alpha.cxx b/vcl/source/bitmap/alpha.cxx index 8618c052ab03..ab23c3e93427 100644 --- a/vcl/source/bitmap/alpha.cxx +++ b/vcl/source/bitmap/alpha.cxx @@ -80,7 +80,7 @@ void AlphaMask::Erase( sal_uInt8 cTransparency ) Bitmap::Erase( Color( cTransparency, cTransparency, cTransparency ) ); } -void AlphaMask::BlendWith(const Bitmap& rOther) +void AlphaMask::BlendWith(const AlphaMask& rOther) { std::shared_ptr<SalBitmap> xImpBmp(ImplGetSVData()->mpDefInst->CreateSalBitmap()); if (xImpBmp->Create(*ImplGetSalBitmap()) && xImpBmp->AlphaBlendWith(*rOther.ImplGetSalBitmap())) @@ -88,8 +88,7 @@ void AlphaMask::BlendWith(const Bitmap& rOther) ImplSetSalBitmap(xImpBmp); return; } - AlphaMask aOther(rOther); // to 8 bits - Bitmap::ScopedReadAccess pOtherAcc(aOther); + Bitmap::ScopedReadAccess pOtherAcc(const_cast<AlphaMask&>(rOther)); AlphaScopedWriteAccess pAcc(*this); assert (pOtherAcc && pAcc && pOtherAcc->GetBitCount() == 8 && pAcc->GetBitCount() == 8 && "cannot BlendWith this combination"); if (!(pOtherAcc && pAcc && pOtherAcc->GetBitCount() == 8 && pAcc->GetBitCount() == 8)) |