include/svx/svdhdl.hxx | 2 include/vcl/filter/PngImageReader.hxx | 6 sd/qa/unit/PNGExportTests.cxx | 106 ++----- sd/qa/unit/export-tests-ooxml1.cxx | 4 sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx | 2 sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx | 30 +- sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx | 22 - sfx2/source/control/recentdocsviewitem.cxx | 2 svx/qa/unit/customshapes.cxx | 14 svx/qa/unit/unodraw.cxx | 6 svx/source/sdr/contact/viewcontactofsdrobj.cxx | 2 svx/source/svdraw/svddrgmt.cxx | 2 svx/source/svdraw/svdhdl.cxx | 50 +-- vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx | 17 - vcl/qa/cppunit/png/PngFilterTest.cxx | 247 ++++++----------- vcl/source/filter/png/PngImageReader.cxx | 12 vcl/source/gdi/pdfwriter_impl.cxx | 4 vcl/source/image/ImplImageTree.cxx | 8 18 files changed, 227 insertions(+), 309 deletions(-)
New commits: commit 88e9af00f2b5e7ae01f3c061485ffb9e99598fd3 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Wed Aug 6 09:49:42 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Aug 6 15:23:30 2025 +0200 BitmapEx->Bitmap in PngImageReader now that Bitmap supports transparency Change-Id: If8db5317d51ef22695df59aaee65a6ac4a914f81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188992 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/vcl/filter/PngImageReader.hxx b/include/vcl/filter/PngImageReader.hxx index 32f494dde692..c4e17044b46d 100644 --- a/include/vcl/filter/PngImageReader.hxx +++ b/include/vcl/filter/PngImageReader.hxx @@ -40,7 +40,7 @@ namespace com::sun::star::task class XStatusIndicator; } -class BitmapEx; +class Bitmap; class SvStream; namespace vcl @@ -55,10 +55,10 @@ public: // Returns true if image was successfully read without errors. // A usable bitmap may be returned even if there were errors (e.g. incomplete image). - bool read(BitmapEx& rBitmap); + bool read(Bitmap& rBitmap); bool read(ImportOutput& rImportOutput); // Returns a bitmap without indicating if there were errors. - BitmapEx read(); + Bitmap read(); // Returns the contents of the msOG chunk (containing a Gif image), if it exists. // Does not change position in the stream. diff --git a/sd/qa/unit/PNGExportTests.cxx b/sd/qa/unit/PNGExportTests.cxx index 0dfaef1eb2cc..362a83eec5ea 100644 --- a/sd/qa/unit/PNGExportTests.cxx +++ b/sd/qa/unit/PNGExportTests.cxx @@ -62,10 +62,10 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf105998) SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); + Bitmap aBMP = aPNGReader.read(); // make sure only the shape is exported - Size aSize = aBMPEx.GetSizePixel(); + Size aSize = aBMP.GetSizePixel(); const auto[scalingX, scalingY] = getDPIScaling(); CPPUNIT_ASSERT_DOUBLES_EQUAL(193 * scalingX, aSize.getWidth(), 1.5); CPPUNIT_ASSERT_DOUBLES_EQUAL(193 * scalingY, aSize.getHeight(), 1.5); @@ -74,7 +74,6 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf105998) // Check all borders are red // use assertColorsAreSimilar since the color might differ a little bit on mac - Bitmap aBMP = aBMPEx.GetBitmap(); { BitmapScopedReadAccess pReadAccess(aBMP); for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) @@ -123,10 +122,10 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf126319) SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); + Bitmap aBMP = aPNGReader.read(); // make sure only the shape is exported - Size aSize = aBMPEx.GetSizePixel(); + Size aSize = aBMP.GetSizePixel(); const auto[scalingX, scalingY] = getDPIScaling(); CPPUNIT_ASSERT_DOUBLES_EQUAL(295 * scalingX, aSize.getWidth(), 1.5); CPPUNIT_ASSERT_DOUBLES_EQUAL(134 * scalingY, aSize.getHeight(), 1.5); @@ -134,7 +133,6 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf126319) return; // Check all borders are red or similar. Ignore the corners - Bitmap aBMP = aBMPEx.GetBitmap(); { BitmapScopedReadAccess pReadAccess(aBMP); for (tools::Long nX = 2; nX < aSize.Width() - 2; ++nX) @@ -194,12 +192,10 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf136632) SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); - AlphaMask aAlpha = aBMPEx.GetAlphaMask(); - BitmapScopedReadAccess pReadAccess(aAlpha); + Bitmap aBMP = aPNGReader.read(); // Without the fix in place, this test would have failed here - CPPUNIT_ASSERT(!pReadAccess); + CPPUNIT_ASSERT(!aBMP.HasAlpha()); } CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157652) @@ -229,12 +225,11 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157652) SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); + Bitmap aBMP = aPNGReader.read(); // make sure the bitmap is not empty and correct size (PNG export->import was successful) - Size aSize = aBMPEx.GetSizePixel(); + Size aSize = aBMP.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); - Bitmap aBMP = aBMPEx.GetBitmap(); BitmapScopedReadAccess pReadAccess(aBMP); for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) { @@ -277,12 +272,11 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf156808) SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); + Bitmap aBMP = aPNGReader.read(); // make sure the bitmap is not empty and correct size (PNG export->import was successful) - Size aSize = aBMPEx.GetSizePixel(); + Size aSize = aBMP.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); - Bitmap aBMP = aBMPEx.GetBitmap(); BitmapScopedReadAccess pReadAccess(aBMP); int nBlackCount = 0; for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) @@ -329,33 +323,25 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf158743) SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); + Bitmap aBMP = aPNGReader.read(); // make sure the bitmap is not empty and correct size (PNG export->import was successful) - Size aSize = aBMPEx.GetSizePixel(); + Size aSize = aBMP.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); - // read RGB - Bitmap aBMP = aBMPEx.GetBitmap(); + // read RGBA BitmapScopedReadAccess pReadAccess(aBMP); - // read Alpha - Bitmap aAlpha = aBMPEx.GetAlphaMask().GetBitmap(); - BitmapScopedReadAccess pReadAccessAlpha(aAlpha); - int nBlackCount = 0; for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) { for (tools::Long nY = 1; nY < aSize.Height() - 1; ++nY) { const Color aColor = pReadAccess->GetColor(nY, nX); - const Color aTrans = pReadAccessAlpha->GetColor(nY, nX); // only count as black when *not* transparent, else - // the color is random/luck. Note that when accessing - // AlphaMask like this alpha is actually in R, G and B, - // *not* in GetAlpha() (sigh...) - if (0 != aTrans.GetRed() && aColor == COL_BLACK) + // the color is random/luck. + if (aColor == COL_BLACK) ++nBlackCount; } } @@ -394,12 +380,11 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157795) SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); + Bitmap aBMP = aPNGReader.read(); // make sure the bitmap is not empty and correct size (PNG export->import was successful) - Size aSize = aBMPEx.GetSizePixel(); + Size aSize = aBMP.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); - Bitmap aBMP = aBMPEx.GetBitmap(); BitmapScopedReadAccess pReadAccess(aBMP); for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) { @@ -443,12 +428,11 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf105362) SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); + Bitmap aBMP = aPNGReader.read(); // make sure the bitmap is not empty and correct size (PNG export->import was successful) - Size aSize = aBMPEx.GetSizePixel(); + Size aSize = aBMP.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); - Bitmap aBMP = aBMPEx.GetBitmap(); BitmapScopedReadAccess pReadAccess(aBMP); for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) { @@ -491,12 +475,11 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157636) SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); + Bitmap aBMP = aPNGReader.read(); // make sure the bitmap is not empty and correct size (PNG export->import was successful) - Size aSize = aBMPEx.GetSizePixel(); + Size aSize = aBMP.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); - Bitmap aBMP = aBMPEx.GetBitmap(); BitmapScopedReadAccess pReadAccess(aBMP); int nBlackCount = 0; for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) @@ -542,12 +525,11 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157793) SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); + Bitmap aBMP = aPNGReader.read(); // make sure the bitmap is not empty and correct size (PNG export->import was successful) - Size aSize = aBMPEx.GetSizePixel(); + Size aSize = aBMP.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); - Bitmap aBMP = aBMPEx.GetBitmap(); BitmapScopedReadAccess pReadAccess(aBMP); int nWhiteCount = 0; for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) @@ -593,12 +575,11 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157635) SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); + Bitmap aBMP = aPNGReader.read(); // make sure the bitmap is not empty and correct size (PNG export->import was successful) - Size aSize = aBMPEx.GetSizePixel(); + Size aSize = aBMP.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); - Bitmap aBMP = aBMPEx.GetBitmap(); BitmapScopedReadAccess pReadAccess(aBMP); int nBlackCount = 0; for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) @@ -644,12 +625,11 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf113163) SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); + Bitmap aBMP = aPNGReader.read(); // make sure the bitmap is not empty and correct size (PNG export->import was successful) - Size aSize = aBMPEx.GetSizePixel(); + Size aSize = aBMP.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); - Bitmap aBMP = aBMPEx.GetBitmap(); { BitmapScopedReadAccess pReadAccess(aBMP); for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) @@ -695,13 +675,12 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf147119) SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); + Bitmap aBMP = aPNGReader.read(); - Size aSize = aBMPEx.GetSizePixel(); + Size aSize = aBMP.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); - AlphaMask aAlpha = aBMPEx.GetAlphaMask(); { - BitmapScopedReadAccess pReadAccess(aAlpha); + BitmapScopedReadAccess pReadAccess(aBMP); for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) { for (tools::Long nY = 1; nY < aSize.Height() - 1; ++nY) @@ -709,8 +688,8 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf147119) // Without the fix in place, this test would have failed with // - Expected: Color: R:255 G:255 B:255 A:0 // - Actual : Color: R:0 G:0 B:0 A:0 - const Color aColor = pReadAccess->GetColor(nY, nX); - CPPUNIT_ASSERT_EQUAL(COL_ALPHA_TRANSPARENT, aColor); + sal_uInt8 nAlpha = pReadAccess->GetColor(nY, nX).GetAlpha(); + CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), nAlpha); } } } @@ -743,12 +722,11 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf113197) SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); + Bitmap aBMP = aPNGReader.read(); // make sure the bitmap is not empty and correct size (PNG export->import was successful) - Size aSize = aBMPEx.GetSizePixel(); + Size aSize = aBMP.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize); - Bitmap aBMP = aBMPEx.GetBitmap(); { BitmapScopedReadAccess pReadAccess(aBMP); for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX) @@ -794,11 +772,10 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf93124) SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); + Bitmap aBMP = aPNGReader.read(); // make sure the bitmap is not empty and correct size (PNG export->import was successful) - CPPUNIT_ASSERT_EQUAL(Size(320, 180), aBMPEx.GetSizePixel()); - Bitmap aBMP = aBMPEx.GetBitmap(); + CPPUNIT_ASSERT_EQUAL(Size(320, 180), aBMP.GetSizePixel()); { BitmapScopedReadAccess pReadAccess(aBMP); int nNonWhiteCount = 0; @@ -853,8 +830,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf99729) SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); - Bitmap aBMP = aBMPEx.GetBitmap(); + Bitmap aBMP = aPNGReader.read(); BitmapScopedReadAccess pRead(aBMP); for (tools::Long nX = 154; nX < (154 + 12); ++nX) { @@ -914,7 +890,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf155048) xGraphicExporter->filter(aDescriptor); - BitmapEx bmp = vcl::PngImageReader(*maTempFile.GetStream(StreamMode::READ)).read(); + Bitmap bmp = vcl::PngImageReader(*maTempFile.GetStream(StreamMode::READ)).read(); std::set<Color> foundColors; for (tools::Long x = 0; x < bmp.GetSizePixel().Width(); ++x) for (tools::Long y = 0; y < bmp.GetSizePixel().Height(); ++y) @@ -942,7 +918,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf155048) xGraphicExporter->filter(aDescriptor); - BitmapEx bmp = vcl::PngImageReader(*maTempFile.GetStream(StreamMode::READ)).read(); + Bitmap bmp = vcl::PngImageReader(*maTempFile.GetStream(StreamMode::READ)).read(); std::set<Color> foundColors; for (tools::Long x = 0; x < bmp.GetSizePixel().Width(); ++x) for (tools::Long y = 0; y < bmp.GetSizePixel().Height(); ++y) @@ -985,7 +961,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testNoAntiAliasExport) }; xGraphicExporter->filter(aDescriptor); - BitmapEx bmp = vcl::PngImageReader(*maTempFile.GetStream(StreamMode::READ)).read(); + Bitmap bmp = vcl::PngImageReader(*maTempFile.GetStream(StreamMode::READ)).read(); std::set<Color> colors; @@ -1026,7 +1002,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf162259) }; xGraphicExporter->filter(aDescriptor); - BitmapEx bmp = vcl::PngImageReader(*maTempFile.GetStream(StreamMode::READ)).read(); + Bitmap bmp = vcl::PngImageReader(*maTempFile.GetStream(StreamMode::READ)).read(); tools::Rectangle topX(12, 21, 37, 60); int topNonWhites = 0; diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 59d46c235375..8e74163e43f2 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -1567,12 +1567,12 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testNarrationMimeType) CPPUNIT_ASSERT(aImageAbsName.startsWith("file:///", &aImageRelName)); std::unique_ptr<SvStream> pImageStream = parseExportStream(maTempFile.GetURL(), aImageRelName); vcl::PngImageReader aReader(*pImageStream); - BitmapEx aBitmapEx = aReader.read(); + Bitmap aBitmap = aReader.read(); // Without the accompanying fix in place, this test would have failed with: // - Expected: 256 // - Actual : 120 // i.e. the bitmap of the narration was lost, some default placeholder was exported instead. - CPPUNIT_ASSERT_EQUAL(static_cast<tools::Long>(256), aBitmapEx.GetSizePixel().Height()); + CPPUNIT_ASSERT_EQUAL(static_cast<tools::Long>(256), aBitmap.GetSizePixel().Height()); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx index ca0bd8cf4b8b..51bdc2cd3db2 100644 --- a/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx +++ b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx @@ -504,7 +504,7 @@ void BitmapCache::CacheEntry::Compress (const std::shared_ptr<BitmapCompressor>& if (mpReplacement == nullptr) { - mpReplacement = rpCompressor->Compress(maPreview); + mpReplacement = rpCompressor->Compress(Bitmap(maPreview)); #ifdef DEBUG_SD_SLSBITMAPCACHE sal_uInt32 nOldSize (maPreview.GetSizeBytes()); diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx index 2d63bd47493e..79f090e0a67b 100644 --- a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx +++ b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx @@ -35,19 +35,19 @@ class NoBitmapCompression::DummyReplacement : public BitmapReplacement { public: - BitmapEx maPreview; + Bitmap maPreview; - explicit DummyReplacement (const BitmapEx& rPreview) : maPreview(rPreview) { } + explicit DummyReplacement (const Bitmap& rPreview) : maPreview(rPreview) { } virtual ~DummyReplacement() {} virtual sal_Int32 GetMemorySize() const override { return maPreview.GetSizeBytes(); } }; -std::shared_ptr<BitmapReplacement> NoBitmapCompression::Compress (const BitmapEx& rBitmap) const +std::shared_ptr<BitmapReplacement> NoBitmapCompression::Compress (const Bitmap& rBitmap) const { return std::make_shared<DummyReplacement>(rBitmap); } -BitmapEx NoBitmapCompression::Decompress (const BitmapReplacement& rBitmapData) const +Bitmap NoBitmapCompression::Decompress (const BitmapReplacement& rBitmapData) const { return dynamic_cast<const DummyReplacement&>(rBitmapData).maPreview; } @@ -59,16 +59,16 @@ bool NoBitmapCompression::IsLossless() const //===== CompressionByDeletion ================================================= -std::shared_ptr<BitmapReplacement> CompressionByDeletion::Compress (const BitmapEx& ) const +std::shared_ptr<BitmapReplacement> CompressionByDeletion::Compress (const Bitmap& ) const { return std::shared_ptr<BitmapReplacement>(); } -BitmapEx CompressionByDeletion::Decompress (const BitmapReplacement& ) const +Bitmap CompressionByDeletion::Decompress (const BitmapReplacement& ) const { // Return a NULL pointer. This will eventually lead to a request for // the creation of a new one. - return BitmapEx(); + return Bitmap(); } bool CompressionByDeletion::IsLossless() const @@ -83,7 +83,7 @@ bool CompressionByDeletion::IsLossless() const class ResolutionReduction::ResolutionReducedReplacement : public BitmapReplacement { public: - BitmapEx maPreview; + Bitmap maPreview; Size maOriginalSize; virtual ~ResolutionReducedReplacement(); @@ -100,7 +100,7 @@ sal_Int32 ResolutionReduction::ResolutionReducedReplacement::GetMemorySize() con } std::shared_ptr<BitmapReplacement> ResolutionReduction::Compress ( - const BitmapEx& rBitmap) const + const Bitmap& rBitmap) const { auto pResult = std::make_shared<ResolutionReducedReplacement>(); pResult->maPreview = rBitmap; @@ -115,9 +115,9 @@ std::shared_ptr<BitmapReplacement> ResolutionReduction::Compress ( return pResult; } -BitmapEx ResolutionReduction::Decompress (const BitmapReplacement& rBitmapData) const +Bitmap ResolutionReduction::Decompress (const BitmapReplacement& rBitmapData) const { - BitmapEx aResult; + Bitmap aResult; const ResolutionReducedReplacement* pData ( dynamic_cast<const ResolutionReducedReplacement*>(&rBitmapData)); @@ -158,7 +158,7 @@ public: } }; -std::shared_ptr<BitmapReplacement> PngCompression::Compress (const BitmapEx& rBitmap) const +std::shared_ptr<BitmapReplacement> PngCompression::Compress (const Bitmap& rBitmap) const { SvMemoryStream aStream (32768, 32768); vcl::PngImageWriter aWriter(aStream); @@ -172,16 +172,16 @@ std::shared_ptr<BitmapReplacement> PngCompression::Compress (const BitmapEx& rBi return pResult; } -BitmapEx PngCompression::Decompress ( +Bitmap PngCompression::Decompress ( const BitmapReplacement& rBitmapData) const { - BitmapEx aResult; + Bitmap aResult; const PngReplacement* pData (dynamic_cast<const PngReplacement*>(&rBitmapData)); if (pData != nullptr) { SvMemoryStream aStream (pData->mpData, pData->mnDataSize, StreamMode::READ); vcl::PngImageReader aReader (aStream); - aResult = aReader.read().GetBitmap(); + aResult = aReader.read(); } return aResult; diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx index 4754bead999b..91f0c69a3448 100644 --- a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx +++ b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx @@ -22,7 +22,7 @@ #include <sal/types.h> #include <memory> -class BitmapEx; +class Bitmap; namespace sd::slidesorter::cache { @@ -37,7 +37,7 @@ public: /** Compress the given bitmap into a replacement format that is specific to the compressor class. */ - virtual std::shared_ptr<BitmapReplacement> Compress(const BitmapEx& rBitmap) const = 0; + virtual std::shared_ptr<BitmapReplacement> Compress(const Bitmap& rBitmap) const = 0; /** Decompress the given replacement data into a preview bitmap. Depending on the compression technique the returned bitmap may @@ -46,7 +46,7 @@ public: task of the caller to create a new preview bitmap if the returned one is not as desired. */ - virtual BitmapEx Decompress(const BitmapReplacement& rBitmapData) const = 0; + virtual Bitmap Decompress(const BitmapReplacement& rBitmapData) const = 0; /** Return whether the compression and decompression is lossless. This value is used by the caller of Decompress() to decide whether to use @@ -81,8 +81,8 @@ class NoBitmapCompression : public BitmapCompressor public: virtual ~NoBitmapCompression() {} - virtual std::shared_ptr<BitmapReplacement> Compress(const BitmapEx& rpBitmap) const override; - virtual BitmapEx Decompress(const BitmapReplacement& rBitmapData) const override; + virtual std::shared_ptr<BitmapReplacement> Compress(const Bitmap& rpBitmap) const override; + virtual Bitmap Decompress(const BitmapReplacement& rBitmapData) const override; virtual bool IsLossless() const override; }; @@ -95,8 +95,8 @@ class CompressionByDeletion : public BitmapCompressor { public: virtual ~CompressionByDeletion() {} - virtual std::shared_ptr<BitmapReplacement> Compress(const BitmapEx& rBitmap) const override; - virtual BitmapEx Decompress(const BitmapReplacement& rBitmapData) const override; + virtual std::shared_ptr<BitmapReplacement> Compress(const Bitmap& rBitmap) const override; + virtual Bitmap Decompress(const BitmapReplacement& rBitmapData) const override; virtual bool IsLossless() const override; }; @@ -112,10 +112,10 @@ class ResolutionReduction : public BitmapCompressor public: virtual ~ResolutionReduction() {} - virtual std::shared_ptr<BitmapReplacement> Compress(const BitmapEx& rpBitmap) const override; + virtual std::shared_ptr<BitmapReplacement> Compress(const Bitmap& rpBitmap) const override; /** Scale the replacement bitmap up to the original size. */ - virtual BitmapEx Decompress(const BitmapReplacement& rBitmapData) const override; + virtual Bitmap Decompress(const BitmapReplacement& rBitmapData) const override; virtual bool IsLossless() const override; }; @@ -128,8 +128,8 @@ class PngCompression : public BitmapCompressor public: virtual ~PngCompression() {} - virtual std::shared_ptr<BitmapReplacement> Compress(const BitmapEx& rBitmap) const override; - virtual BitmapEx Decompress(const BitmapReplacement& rBitmapData) const override; + virtual std::shared_ptr<BitmapReplacement> Compress(const Bitmap& rBitmap) const override; + virtual Bitmap Decompress(const BitmapReplacement& rBitmapData) const override; virtual bool IsLossless() const override; }; diff --git a/sfx2/source/control/recentdocsviewitem.cxx b/sfx2/source/control/recentdocsviewitem.cxx index a2defa9d9ffd..b5230cbe9eeb 100644 --- a/sfx2/source/control/recentdocsviewitem.cxx +++ b/sfx2/source/control/recentdocsviewitem.cxx @@ -159,7 +159,7 @@ RecentDocsViewItem::RecentDocsViewItem(sfx2::RecentDocsView &rView, const OUStri SvMemoryStream aStream(aDecoded.getArray(), aDecoded.getLength(), StreamMode::READ); vcl::PngImageReader aReader(aStream); - aThumbnail = Bitmap(aReader.read()); + aThumbnail = aReader.read(); } else if (sfx2::RecentDocsView::typeMatchesExtension(sfx2::ApplicationType::TYPE_DATABASE, aURLObj.getExtension())) diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx index d3858706cdf2..233d49793705 100644 --- a/svx/qa/unit/customshapes.cxx +++ b/svx/qa/unit/customshapes.cxx @@ -95,7 +95,7 @@ Color CustomshapesTest::getColor(const uno::Reference<drawing::XShape>& xShape, maTempFile.GetURL()); SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - Bitmap aBMP = aPNGReader.read().GetBitmap(); + Bitmap aBMP = aPNGReader.read(); Size aSize = aBMP.GetSizePixel(); BitmapScopedReadAccess pRead(aBMP); return pRead->GetColor(aSize.Height() * fY, aSize.Width() * fX); @@ -203,8 +203,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145700_3D_NonUI) // Without the changed methods the colors were in range RGB(17,11,17) to RGB(87,55,89). SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); - Bitmap aBMP = aBMPEx.GetBitmap(); + Bitmap aBMP = aPNGReader.read(); BitmapScopedReadAccess pRead(aBMP); Size aSize = aBMP.GetSizePixel(); // GetColor(Y,X) @@ -240,8 +239,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145700_3D_FrontLightDim) // Without the changed methods the nColorDistance was 476 and 173 respectively. SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); - Bitmap aBMP = aBMPEx.GetBitmap(); + Bitmap aBMP = aPNGReader.read(); BitmapScopedReadAccess pRead(aBMP); Size aSize = aBMP.GetSizePixel(); // GetColor(Y,X) @@ -268,8 +266,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145700_3D_FirstLightHarsh) // Read bitmap and test color in center SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); - Bitmap aBMP = aBMPEx.GetBitmap(); + Bitmap aBMP = aPNGReader.read(); BitmapScopedReadAccess pRead(aBMP); Size aSize = aBMP.GetSizePixel(); // GetColor(Y,X) @@ -1235,8 +1232,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf148501_OctagonBevel) // So we test segments top, right and bottom-right. SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - BitmapEx aBMPEx = aPNGReader.read(); - Bitmap aBMP = aBMPEx.GetBitmap(); + Bitmap aBMP = aPNGReader.read(); BitmapScopedReadAccess pRead(aBMP); Size aSize = aBMP.GetSizePixel(); diff --git a/svx/qa/unit/unodraw.cxx b/svx/qa/unit/unodraw.cxx index 4bf5c6bf29a2..853715dfed83 100644 --- a/svx/qa/unit/unodraw.cxx +++ b/svx/qa/unit/unodraw.cxx @@ -208,9 +208,9 @@ CPPUNIT_TEST_FIXTURE(UnodrawTest, testPngExport) // Then make sure that the size request is handled: aStream.Seek(STREAM_SEEK_TO_BEGIN); vcl::PngImageReader aPngReader(aStream); - BitmapEx aBitmapEx; - aPngReader.read(aBitmapEx); - Size aSize = aBitmapEx.GetSizePixel(); + Bitmap aBitmap; + aPngReader.read(aBitmap); + Size aSize = aBitmap.GetSizePixel(); // Without the accompanying fix in place, this test would have failed with: // - Expected: 192 // - Actual : 595 diff --git a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx index b62ba4239de4..5b259f5a9265 100644 --- a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx +++ b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx @@ -145,22 +145,21 @@ void BitmapRenderTest::testDrawAlphaBitmapEx() SvFileStream aFileStream(getFullUrl(u"ImageRGBA.png"), StreamMode::READ); vcl::PngImageReader aPngReader(aFileStream); - BitmapEx aBitmapEx; - aPngReader.read(aBitmapEx); + Bitmap aBitmap; + aPngReader.read(aBitmap); - CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N24_BPP, aBitmapEx.GetBitmap().getPixelFormat()); - CPPUNIT_ASSERT_EQUAL(true, aBitmapEx.IsAlpha()); - CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, aBitmapEx.GetAlphaMask().getPixelFormat()); + CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N32_BPP, aBitmap.getPixelFormat()); + CPPUNIT_ASSERT_EQUAL(true, aBitmap.HasAlpha()); // Check the bitmap has pixels we expect CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xFF, 0x00, 0x00, 0x00), - aBitmapEx.GetPixelColor(0, 0)); + aBitmap.GetPixelColor(0, 0)); CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0x00, 0xFF, 0xFF, 0x00), - aBitmapEx.GetPixelColor(1, 1)); + aBitmap.GetPixelColor(1, 1)); CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0x7F, 0x00, 0xFF, 0x00), - aBitmapEx.GetPixelColor(2, 2)); + aBitmap.GetPixelColor(2, 2)); - pVDev->DrawBitmapEx(Point(), aBitmapEx); + pVDev->DrawBitmapEx(Point(), aBitmap); CPPUNIT_ASSERT_EQUAL(COL_WHITE, pVDev->GetPixel(Point(0, 0))); CPPUNIT_ASSERT_EQUAL(COL_YELLOW, pVDev->GetPixel(Point(1, 1))); diff --git a/vcl/qa/cppunit/png/PngFilterTest.cxx b/vcl/qa/cppunit/png/PngFilterTest.cxx index 231eb0b96987..78de4d88c906 100644 --- a/vcl/qa/cppunit/png/PngFilterTest.cxx +++ b/vcl/qa/cppunit/png/PngFilterTest.cxx @@ -50,8 +50,8 @@ void checkImportExportPng(const OUString& sFilePath, const Case& aCase) { SvFileStream aFileStream(sFilePath, StreamMode::READ); SvMemoryStream aExportStream; - BitmapEx aImportedBitmapEx; - BitmapEx aExportedImportedBitmapEx; + Bitmap aImportedBitmap; + Bitmap aExportedImportedBitmap; bool bOpenOk = !aFileStream.GetError() && aFileStream.GetBufferSize() > 0; CPPUNIT_ASSERT_MESSAGE(OString("Failed to open file: " + sFilePath.toUtf8()).getStr(), bOpenOk); @@ -59,16 +59,15 @@ void checkImportExportPng(const OUString& sFilePath, const Case& aCase) // Read the png from the file { vcl::PngImageReader aPngReader(aFileStream); - bool bReadOk = aPngReader.read(aImportedBitmapEx); + bool bReadOk = aPngReader.read(aImportedBitmap); CPPUNIT_ASSERT_MESSAGE(OString("Failed to read png from: " + sFilePath.toUtf8()).getStr(), bReadOk); - Bitmap aImportedBitmap = aImportedBitmapEx.GetBitmap(); BitmapScopedInfoAccess pAccess(aImportedBitmap); - auto nActualWidth = aImportedBitmapEx.GetSizePixel().Width(); - auto nActualHeight = aImportedBitmapEx.GetSizePixel().Height(); - auto nActualBpp = vcl::pixelFormatBitCount(aImportedBitmapEx.GetBitmap().getPixelFormat()); + auto nActualWidth = aImportedBitmap.GetSizePixel().Width(); + auto nActualHeight = aImportedBitmap.GetSizePixel().Height(); + auto nActualBpp = vcl::pixelFormatBitCount(aImportedBitmap.getPixelFormat()); auto bActualHasPalette = pAccess->HasPalette(); - auto bActualIsAlpha = aImportedBitmapEx.IsAlpha(); + auto bActualIsAlpha = aImportedBitmap.HasAlpha(); CPPUNIT_ASSERT_EQUAL_MESSAGE( OString("Width comparison failed for exported png:" + sFilePath.toUtf8()).getStr(), aCase.mnWidth, nActualWidth); @@ -89,7 +88,7 @@ void checkImportExportPng(const OUString& sFilePath, const Case& aCase) // Write the imported png to a stream { vcl::PngImageWriter aPngWriter(aExportStream); - bool bWriteOk = aPngWriter.write(aImportedBitmapEx); + bool bWriteOk = aPngWriter.write(aImportedBitmap); CPPUNIT_ASSERT_MESSAGE(OString("Failed to write png: " + sFilePath.toUtf8()).getStr(), bWriteOk); aExportStream.Seek(0); @@ -98,17 +97,15 @@ void checkImportExportPng(const OUString& sFilePath, const Case& aCase) // Read the png again from the exported stream { vcl::PngImageReader aPngReader(aExportStream); - bool bReadOk = aPngReader.read(aExportedImportedBitmapEx); + bool bReadOk = aPngReader.read(aExportedImportedBitmap); CPPUNIT_ASSERT_MESSAGE( OString("Failed to read exported png: " + sFilePath.toUtf8()).getStr(), bReadOk); - Bitmap aExportedImportedBitmap = aExportedImportedBitmapEx.GetBitmap(); BitmapScopedInfoAccess pAccess(aExportedImportedBitmap); - auto nActualWidth = aExportedImportedBitmapEx.GetSizePixel().Width(); - auto nActualHeight = aExportedImportedBitmapEx.GetSizePixel().Height(); - auto nActualBpp - = vcl::pixelFormatBitCount(aExportedImportedBitmapEx.GetBitmap().getPixelFormat()); + auto nActualWidth = aExportedImportedBitmap.GetSizePixel().Width(); + auto nActualHeight = aExportedImportedBitmap.GetSizePixel().Height(); + auto nActualBpp = vcl::pixelFormatBitCount(aExportedImportedBitmap.getPixelFormat()); auto bActualHasPalette = pAccess->HasPalette(); - auto bActualIsAlpha = aExportedImportedBitmapEx.IsAlpha(); + auto bActualIsAlpha = aExportedImportedBitmap.HasAlpha(); CPPUNIT_ASSERT_EQUAL_MESSAGE( OString("Width comparison failed for exported png:" + sFilePath.toUtf8()).getStr(), aCase.mnWidth, nActualWidth); @@ -126,9 +123,9 @@ void checkImportExportPng(const OUString& sFilePath, const Case& aCase) aCase.mbIsAlpha, bActualIsAlpha); } - // Compare imported and exported BitmapEx + // Compare imported and exported Bitmap // This compares size, inner bitmap and alpha mask - bool bIsSame = (aExportedImportedBitmapEx == aImportedBitmapEx); + bool bIsSame = (aExportedImportedBitmap == aImportedBitmap); CPPUNIT_ASSERT_MESSAGE( OString("Import->Export png test failed for png: " + sFilePath.toUtf8()).getStr(), bIsSame); } @@ -137,12 +134,12 @@ void checkImportExportPng(const OUString& sFilePath, const Case& aCase) void checkImportCorruptedPng(const OUString& sFilePath) { SvFileStream aFileStream(sFilePath, StreamMode::READ); - BitmapEx aImportedBitmapEx; + Bitmap aImportedBitmap; bool bOpenOk = !aFileStream.GetError() && aFileStream.GetBufferSize() > 0; CPPUNIT_ASSERT_MESSAGE(OString("Failed to open file: " + sFilePath.toUtf8()).getStr(), bOpenOk); vcl::PngImageReader aPngReader(aFileStream); - bool bReadOk = aPngReader.read(aImportedBitmapEx); + bool bReadOk = aPngReader.read(aImportedBitmap); // Make sure this file was not read successfully CPPUNIT_ASSERT_MESSAGE( OString("Corrupted png should not be opened: " + sFilePath.toUtf8()).getStr(), !bReadOk); @@ -202,10 +199,9 @@ void PngFilterTest::testPng() SvFileStream aFileStream(getFullUrl(aFileName), StreamMode::READ); vcl::PngImageReader aPngReader(aFileStream); - BitmapEx aBitmapEx; - aPngReader.read(aBitmapEx); + Bitmap aBitmap; + aPngReader.read(aBitmap); - Bitmap aBitmap = aBitmapEx.GetBitmap(); { BitmapScopedReadAccess pAccess(aBitmap); CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAccess->Width()); @@ -249,10 +245,9 @@ void PngFilterTest::testPng() SvFileStream aFileStream(getFullUrl(aFileName), StreamMode::READ); vcl::PngImageReader aPngReader(aFileStream); - BitmapEx aBitmapEx; - aPngReader.read(aBitmapEx); + Bitmap aBitmap; + aPngReader.read(aBitmap); - Bitmap aBitmap = aBitmapEx.GetBitmap(); { BitmapScopedReadAccess pAccess(aBitmap); CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAccess->Width()); @@ -288,85 +283,33 @@ void PngFilterTest::testPng() SvFileStream aFileStream(getFullUrl(aFileName), StreamMode::READ); vcl::PngImageReader aPngReader(aFileStream); - BitmapEx aBitmapEx; - aPngReader.read(aBitmapEx); + Bitmap aBitmap; + aPngReader.read(aBitmap); - Bitmap aBitmap = aBitmapEx.GetBitmap(); { BitmapScopedReadAccess pAccess(aBitmap); CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAccess->Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAccess->Height()); - if (pAccess->GetBitCount() == 24) - { - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x00), - pAccess->GetPixel(0, 0)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x00), - pAccess->GetPixel(3, 3)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x00), - pAccess->GetPixel(3, 0)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x00), - pAccess->GetPixel(0, 3)); - - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0x00, 0x00, 0x00), - pAccess->GetPixel(1, 1)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0xFF, 0x00, 0x00), - pAccess->GetPixel(1, 2)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0xFF, 0x00), - pAccess->GetPixel(2, 1)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0x00, 0x00), - pAccess->GetPixel(2, 2)); - - AlphaMask aAlpha = aBitmapEx.GetAlphaMask(); - { - 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()); - - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x7F, 0x00), - pAlphaAccess->GetPixel(0, 0)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x7F, 0x00), - pAlphaAccess->GetPixel(3, 3)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x7F, 0x00), - pAlphaAccess->GetPixel(3, 0)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x7F, 0x00), - pAlphaAccess->GetPixel(0, 3)); - - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0xBF, 0x00), - pAlphaAccess->GetPixel(1, 1)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x3F, 0x00), - pAlphaAccess->GetPixel(1, 2)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x3F, 0x00), - pAlphaAccess->GetPixel(2, 1)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0xBF, 0x00), - pAlphaAccess->GetPixel(2, 2)); - } - } - else if (pAccess->GetBitCount() == 32) - { - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x80), - pAccess->GetPixel(0, 0)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x80), - pAccess->GetPixel(3, 3)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x80), - pAccess->GetPixel(3, 0)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x80), - pAccess->GetPixel(0, 3)); - - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0x00, 0x00, 0x40), - pAccess->GetPixel(1, 1)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0xFF, 0x00, 0xC0), - pAccess->GetPixel(1, 2)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0xFF, 0xC0), - pAccess->GetPixel(2, 1)); - CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0x00, 0x40), - pAccess->GetPixel(2, 2)); - } - else - { - CPPUNIT_ASSERT_MESSAGE("Bitmap is not 24 or 32 bit.", false); - } + CPPUNIT_ASSERT_EQUAL(sal_uInt16(32), pAccess->GetBitCount()); + + CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x80), + pAccess->GetPixel(0, 0)); + CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x80), + pAccess->GetPixel(3, 3)); + CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x80), + pAccess->GetPixel(3, 0)); + CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x80), + pAccess->GetPixel(0, 3)); + + CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0x00, 0x00, 0x40), + pAccess->GetPixel(1, 1)); + CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0xFF, 0x00, 0xC0), + pAccess->GetPixel(1, 2)); + CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0xFF, 0xC0), + pAccess->GetPixel(2, 1)); + CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0x00, 0x40), + pAccess->GetPixel(2, 2)); } } } @@ -542,7 +485,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // 8 bit grayscale + 8 bit alpha @@ -550,7 +493,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // 16 bit grayscale + 16 bit alpha @@ -558,7 +501,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // 8 bit rgba @@ -566,7 +509,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // 16 bit rgba @@ -663,7 +606,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // 8 bit grayscale + 8 bit alpha @@ -671,7 +614,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // 16 bit grayscale + 16 bit alpha @@ -679,7 +622,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // 8 bit rgba @@ -687,7 +630,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // 16 bit rgba @@ -986,7 +929,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // 8 bit grayscale alpha no background chunk, interlaced @@ -994,7 +937,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // 16 bit grayscale alpha no background chunk, interlaced @@ -1002,7 +945,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // 3 * 8 bits rgb color alpha, no background chunk @@ -1010,7 +953,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // 3 * 16 bits rgb color alpha, no background chunk @@ -1018,7 +961,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // 8 bit grayscale alpha, black background chunk @@ -1026,7 +969,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // 16 bit grayscale alpha, gray background chunk @@ -1034,7 +977,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // 3 * 8 bits rgb color alpha, white background chunk @@ -1042,7 +985,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // 3 * 16 bits rgb color alpha, yellow background chunk @@ -1051,7 +994,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // transparent, black background chunk @@ -1059,7 +1002,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // transparent, blue background chunk @@ -1067,7 +1010,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // transparent, black background chunk @@ -1075,7 +1018,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // transparent, green background chunk @@ -1083,7 +1026,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // transparent, light-gray background chunk @@ -1091,7 +1034,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // transparent, red background chunk @@ -1099,7 +1042,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // transparent, white background chunk @@ -1107,7 +1050,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // transparent, white background chunk @@ -1115,7 +1058,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // transparent, yellow background chunk @@ -1123,7 +1066,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // transparent, but no background chunk @@ -1131,7 +1074,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // multiple levels of transparency, 3 entries @@ -1382,7 +1325,7 @@ void PngFilterTest::testPngSuite() { 32, 32, - 24, + 32, false, true, } }, // six-cube palette-chunk in true-color+alpha image @@ -1853,15 +1796,15 @@ void PngFilterTest::testPngRoundtrip8BitGrey() SvStream& rStream = *aTempFile.GetStream(StreamMode::READ); vcl::PngImageReader aPngReader(rStream); - BitmapEx aBitmapEx; - CPPUNIT_ASSERT_EQUAL(true, aPngReader.read(aBitmapEx)); + Bitmap aBitmap; + CPPUNIT_ASSERT_EQUAL(true, aPngReader.read(aBitmap)); - CPPUNIT_ASSERT_EQUAL(Size(16, 16), aBitmapEx.GetSizePixel()); + CPPUNIT_ASSERT_EQUAL(Size(16, 16), aBitmap.GetSizePixel()); - CPPUNIT_ASSERT_EQUAL(COL_GRAY, aBitmapEx.GetPixelColor(0, 0)); - CPPUNIT_ASSERT_EQUAL(COL_LIGHTGRAY, aBitmapEx.GetPixelColor(15, 15)); - CPPUNIT_ASSERT_EQUAL(COL_BLACK, aBitmapEx.GetPixelColor(15, 0)); - CPPUNIT_ASSERT_EQUAL(COL_BLACK, aBitmapEx.GetPixelColor(0, 15)); + CPPUNIT_ASSERT_EQUAL(COL_GRAY, aBitmap.GetPixelColor(0, 0)); + CPPUNIT_ASSERT_EQUAL(COL_LIGHTGRAY, aBitmap.GetPixelColor(15, 15)); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, aBitmap.GetPixelColor(15, 0)); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, aBitmap.GetPixelColor(0, 15)); } } @@ -1901,15 +1844,15 @@ void PngFilterTest::testPngRoundtrip24() rStream.Seek(0); vcl::PngImageReader aPngReader(rStream); - BitmapEx aBitmapEx; - CPPUNIT_ASSERT_EQUAL(true, aPngReader.read(aBitmapEx)); + Bitmap aBitmap; + CPPUNIT_ASSERT_EQUAL(true, aPngReader.read(aBitmap)); - CPPUNIT_ASSERT_EQUAL(Size(16, 16), aBitmapEx.GetSizePixel()); + CPPUNIT_ASSERT_EQUAL(Size(16, 16), aBitmap.GetSizePixel()); - CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aBitmapEx.GetPixelColor(0, 0)); - CPPUNIT_ASSERT_EQUAL(COL_LIGHTBLUE, aBitmapEx.GetPixelColor(15, 15)); - CPPUNIT_ASSERT_EQUAL(COL_BLACK, aBitmapEx.GetPixelColor(15, 0)); - CPPUNIT_ASSERT_EQUAL(COL_BLACK, aBitmapEx.GetPixelColor(0, 15)); + CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aBitmap.GetPixelColor(0, 0)); + CPPUNIT_ASSERT_EQUAL(COL_LIGHTBLUE, aBitmap.GetPixelColor(15, 15)); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, aBitmap.GetPixelColor(15, 0)); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, aBitmap.GetPixelColor(0, 15)); } } @@ -1953,19 +1896,19 @@ void PngFilterTest::testPngRoundtrip24_8() rStream.Seek(0); vcl::PngImageReader aPngReader(rStream); - BitmapEx aBitmapEx; - CPPUNIT_ASSERT_EQUAL(true, aPngReader.read(aBitmapEx)); + Bitmap aBitmap; + CPPUNIT_ASSERT_EQUAL(true, aPngReader.read(aBitmap)); - CPPUNIT_ASSERT_EQUAL(Size(16, 16), aBitmapEx.GetSizePixel()); + CPPUNIT_ASSERT_EQUAL(Size(16, 16), aBitmap.GetSizePixel()); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xBB, 0xFF, 0x00, 0x00), - aBitmapEx.GetPixelColor(0, 0)); + aBitmap.GetPixelColor(0, 0)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xCC, 0x00, 0x00, 0xFF), - aBitmapEx.GetPixelColor(15, 15)); + aBitmap.GetPixelColor(15, 15)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xAA, 0x00, 0x00, 0x00), - aBitmapEx.GetPixelColor(15, 0)); + aBitmap.GetPixelColor(15, 0)); CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xAA, 0x00, 0x00, 0x00), - aBitmapEx.GetPixelColor(0, 15)); + aBitmap.GetPixelColor(0, 15)); } } @@ -2001,17 +1944,17 @@ void PngFilterTest::testPngWrite8BitRGBPalette() aExportStream.Seek(0); { vcl::PngImageReader aPngReader(aExportStream); - BitmapEx aBitmapEx; - CPPUNIT_ASSERT_EQUAL(true, aPngReader.read(aBitmapEx)); + Bitmap aBitmap; + CPPUNIT_ASSERT_EQUAL(true, aPngReader.read(aBitmap)); - CPPUNIT_ASSERT_EQUAL(Size(16, 16), aBitmapEx.GetSizePixel()); + CPPUNIT_ASSERT_EQUAL(Size(16, 16), aBitmap.GetSizePixel()); for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { CPPUNIT_ASSERT_EQUAL(aRedPalette[i * 16 + j].GetRGBColor(), - aBitmapEx.GetPixelColor(j, i)); + aBitmap.GetPixelColor(j, i)); } } } diff --git a/vcl/source/filter/png/PngImageReader.cxx b/vcl/source/filter/png/PngImageReader.cxx index 515b150ba054..4c88b0dbaf23 100644 --- a/vcl/source/filter/png/PngImageReader.cxx +++ b/vcl/source/filter/png/PngImageReader.cxx @@ -812,28 +812,28 @@ PngImageReader::PngImageReader(SvStream& rStream) { } -bool PngImageReader::read(BitmapEx& rBitmapEx) +bool PngImageReader::read(Bitmap& rBitmap) { ImportOutput aImportOutput; bool bRet = reader(mrStream, aImportOutput); if (bRet) - rBitmapEx = *aImportOutput.moBitmap; + rBitmap = Bitmap(*aImportOutput.moBitmap); return bRet; } bool PngImageReader::read(ImportOutput& rImportOutput) { return reader(mrStream, rImportOutput); } -BitmapEx PngImageReader::read() +Bitmap PngImageReader::read() { ImportOutput aImportOutput; if (read(aImportOutput)) { if (!aImportOutput.mbIsAnimated) - return *aImportOutput.moBitmap; + return Bitmap(*aImportOutput.moBitmap); else - return aImportOutput.moAnimation->GetBitmapEx(); + return Bitmap(aImportOutput.moAnimation->GetBitmapEx()); } - return BitmapEx(); + return Bitmap(); } BinaryDataContainer PngImageReader::getMicrosoftGifChunk(SvStream& rStream) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 947b88945c3d..1030f4155fda 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2627,8 +2627,8 @@ bool PDFWriterImpl::emitType3Font(const vcl::font::PhysicalFontFace* pFace, StreamMode::READ); vcl::PngImageReader aReader(aStream); - BitmapEx aBitmapEx = aReader.read(); - const BitmapEmit& rBitmapEmit = createBitmapEmit(aBitmapEx, Graphic(), + Bitmap aBitmap = aReader.read(); + const BitmapEmit& rBitmapEmit = createBitmapEmit(BitmapEx(aBitmap), Graphic(), aUsedBitmaps, aResourceDict, aOutputStreams); diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx index e2409a8475d0..be037ee56729 100644 --- a/vcl/source/image/ImplImageTree.cxx +++ b/vcl/source/image/ImplImageTree.cxx @@ -174,7 +174,9 @@ void loadImageFromStream(std::shared_ptr<SvStream> const & xStream, OUString con if (rPath.endsWith(".png")) { vcl::PngImageReader aPNGReader(*xStream); - aPNGReader.read(rParameters.mrBitmap); + Bitmap aTmp; + aPNGReader.read(aTmp); + rParameters.mrBitmap = aTmp; } else if (rPath.endsWith(".svg")) { @@ -391,7 +393,9 @@ bool loadDiskCachedVersion(std::u16string_view sVariant, ImageRequestParameters& return false; SvFileStream aFileStream(sUrl, StreamMode::READ); vcl::PngImageReader aPNGReader(aFileStream); - aPNGReader.read(rParameters.mrBitmap); + Bitmap aTmp; + aPNGReader.read(aTmp); + rParameters.mrBitmap = aTmp; return true; } commit dce9ef4e739acb7439d853da4519deb408348490 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Wed Aug 6 09:09:03 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Aug 6 15:23:22 2025 +0200 BitmapEx->Bitmap in SdrHdl now that Bitmap supports transparency Change-Id: I928e05c94da01ddae8760cd71299902d68096acc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188991 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/svx/svdhdl.hxx b/include/svx/svdhdl.hxx index 3b527c8d3bba..77af5d18f911 100644 --- a/include/svx/svdhdl.hxx +++ b/include/svx/svdhdl.hxx @@ -243,7 +243,7 @@ public: visualisation during mouse over it must override this method and call Touch(). */ virtual void onMouseLeave(); - SAL_DLLPRIVATE static BitmapEx createGluePointBitmap(); + SAL_DLLPRIVATE static Bitmap createGluePointBitmap(); }; diff --git a/svx/source/sdr/contact/viewcontactofsdrobj.cxx b/svx/source/sdr/contact/viewcontactofsdrobj.cxx index 5f13af5cbe65..13986c236b73 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobj.cxx @@ -145,7 +145,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewContactOfSdrObj::createGlueP { const drawinglayer::primitive2d::Primitive2DReference xReference( new drawinglayer::primitive2d::MarkerArrayPrimitive2D( - std::move(aGluepointVector), SdrHdl::createGluePointBitmap())); + std::move(aGluepointVector), BitmapEx(SdrHdl::createGluePointBitmap()))); xRetval = drawinglayer::primitive2d::Primitive2DContainer{ xReference }; } } diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 938bcefa005d..d0b956520bb4 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -264,7 +264,7 @@ drawinglayer::primitive2d::Primitive2DContainer SdrDragEntryPointGlueDrag::creat { aRetval = drawinglayer::primitive2d::Primitive2DContainer { new drawinglayer::primitive2d::MarkerArrayPrimitive2D(std::move(aTransformedPositions), - SdrHdl::createGluePointBitmap()) + BitmapEx(SdrHdl::createGluePointBitmap())) }; } } diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index 2d15d9aa0a8c..509a26d252b0 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -81,18 +81,18 @@ namespace { class SdrHdlBitmapSet { // the bitmap holding all information - BitmapEx maMarkersBitmap; + Bitmap maMarkersBitmap; // the cropped Bitmaps for reusage - ::std::vector< BitmapEx > maRealMarkers; + ::std::vector< Bitmap > maRealMarkers; // helpers - BitmapEx& impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const tools::Rectangle& rRectangle); + Bitmap& impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const tools::Rectangle& rRectangle); public: explicit SdrHdlBitmapSet(); - const BitmapEx& GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd); + const Bitmap& GetBitmap(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd); }; } @@ -102,15 +102,15 @@ public: #define INDIVIDUAL_COUNT (5) SdrHdlBitmapSet::SdrHdlBitmapSet() - : maMarkersBitmap(SIP_SA_MARKERS), + : maMarkersBitmap(BitmapEx(SIP_SA_MARKERS)), // 15 kinds (BitmapMarkerKind) use index [0..5] + 5 extra maRealMarkers((KIND_COUNT * INDEX_COUNT) + INDIVIDUAL_COUNT) { } -BitmapEx& SdrHdlBitmapSet::impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const tools::Rectangle& rRectangle) +Bitmap& SdrHdlBitmapSet::impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const tools::Rectangle& rRectangle) { - BitmapEx& rTargetBitmap = maRealMarkers[nIndex]; + Bitmap& rTargetBitmap = maRealMarkers[nIndex]; if(rTargetBitmap.IsEmpty()) { @@ -122,7 +122,7 @@ BitmapEx& SdrHdlBitmapSet::impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const t } // change getting of bitmap to use the big resource bitmap -const BitmapEx& SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd) +const Bitmap& SdrHdlBitmapSet::GetBitmap(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd) { // fill in size and source position in maMarkersBitmap const sal_uInt16 nYPos(nInd * 11); @@ -743,7 +743,7 @@ OUString appendMarkerColor(BitmapColorIndex eIndex) return OUString(); } -BitmapEx ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, BitmapColorIndex eIndex) +Bitmap ImpGetBitmap(BitmapMarkerKind eKindOfMarker, BitmapColorIndex eIndex) { // use this code path only when we use HiDPI (for now) if (Application::GetDefaultDevice()->GetDPIScalePercentage() > 100) @@ -770,14 +770,14 @@ BitmapEx ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, BitmapColorIndex eIndex) } if (!aBitmapEx.IsEmpty()) - return aBitmapEx; + return Bitmap(aBitmapEx); } } // if we can't load the marker... static tools::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet {}; - return aModernSet.get()->GetBitmapEx(eKindOfMarker, sal_uInt16(eIndex)); + return aModernSet.get()->GetBitmap(eKindOfMarker, sal_uInt16(eIndex)); } } // end anonymous namespace @@ -851,8 +851,8 @@ std::unique_ptr<sdr::overlay::OverlayObject> SdrHdl::CreateOverlayObject( } // create animated handle - BitmapEx aBmpEx1 = ImpGetBitmapEx(eKindOfMarker, eColIndex); - BitmapEx aBmpEx2 = ImpGetBitmapEx(eNextBigger, eColIndex); + Bitmap aBmp1 = ImpGetBitmap(eKindOfMarker, eColIndex); + Bitmap aBmp2 = ImpGetBitmap(eNextBigger, eColIndex); // #i53216# Use system cursor blink time. Use the unsigned value. const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); @@ -861,29 +861,29 @@ std::unique_ptr<sdr::overlay::OverlayObject> SdrHdl::CreateOverlayObject( if(eKindOfMarker == BitmapMarkerKind::Anchor || eKindOfMarker == BitmapMarkerKind::AnchorPressed) { // when anchor is used take upper left as reference point inside the handle - pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, Bitmap(aBmpEx1), Bitmap(aBmpEx2), nBlinkTime)); + pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmp1, aBmp2, nBlinkTime)); } else if(eKindOfMarker == BitmapMarkerKind::AnchorTR || eKindOfMarker == BitmapMarkerKind::AnchorPressedTR) { // AnchorTR for SW, take top right as (0,0) - pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, Bitmap(aBmpEx1), Bitmap(aBmpEx2), nBlinkTime, - static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1), 0, - static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Width() - 1), 0)); + pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmp1, aBmp2, nBlinkTime, + static_cast<sal_uInt16>(aBmp1.GetSizePixel().Width() - 1), 0, + static_cast<sal_uInt16>(aBmp2.GetSizePixel().Width() - 1), 0)); } else { // create centered handle as default - pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, Bitmap(aBmpEx1), Bitmap(aBmpEx2), nBlinkTime, - static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1) >> 1, - static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Height() - 1) >> 1, - static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Width() - 1) >> 1, - static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Height() - 1) >> 1)); + pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmp1, aBmp2, nBlinkTime, + static_cast<sal_uInt16>(aBmp1.GetSizePixel().Width() - 1) >> 1, + static_cast<sal_uInt16>(aBmp1.GetSizePixel().Height() - 1) >> 1, + static_cast<sal_uInt16>(aBmp2.GetSizePixel().Width() - 1) >> 1, + static_cast<sal_uInt16>(aBmp2.GetSizePixel().Height() - 1) >> 1)); } } else { // create normal handle: use ImpGetBitmapEx(...) now - Bitmap aBmp(ImpGetBitmapEx(eKindOfMarker, eColIndex)); + Bitmap aBmp(ImpGetBitmap(eKindOfMarker, eColIndex)); // When the image with handles is not found, the bitmap returned is // empty. This is a problem when we use LibreOffice as a library @@ -1068,9 +1068,9 @@ void SdrHdl::onMouseLeave() { } -BitmapEx SdrHdl::createGluePointBitmap() +Bitmap SdrHdl::createGluePointBitmap() { - return ImpGetBitmapEx(BitmapMarkerKind::Glue_Deselected, BitmapColorIndex::LightGreen); + return ImpGetBitmap(BitmapMarkerKind::Glue_Deselected, BitmapColorIndex::LightGreen); } void SdrHdl::insertNewlyCreatedOverlayObjectForSdrHdl(