include/vcl/graph.hxx | 1 oox/qa/unit/testscene3d.cxx | 18 ++++----- sc/qa/unit/subsequent_filters_test2.cxx | 2 - sd/qa/unit/export-tests.cxx | 2 - sd/qa/unit/import-tests2.cxx | 18 ++++----- svx/qa/unit/XTableImportExportTest.cxx | 2 - sw/qa/extras/htmlexport/htmlexport2.cxx | 4 +- sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 4 +- sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 2 - sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 2 - sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 2 - sw/qa/extras/uiwriter/uiwriter8.cxx | 2 - sw/qa/extras/ww8export/ww8export.cxx | 2 - vcl/inc/impgraph.hxx | 3 - vcl/qa/cppunit/BitmapFilterTest.cxx | 20 ++++------ vcl/qa/cppunit/BmpFilterTest.cxx | 24 ++++++------ vcl/qa/cppunit/GraphicTest.cxx | 18 ++++----- vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx | 6 +-- vcl/qa/cppunit/graphicfilter/filters-test.cxx | 2 - vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx | 10 ++--- vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx | 16 ++++---- vcl/qa/cppunit/jpeg/JpegReaderTest.cxx | 8 ++-- vcl/qa/cppunit/jpeg/JpegWriterTest.cxx | 20 +++++----- vcl/qa/cppunit/pdfexport/pdfexport2.cxx | 4 +- vcl/qa/cppunit/png/PngFilterTest.cxx | 8 ++-- vcl/source/gdi/graph.cxx | 5 -- vcl/source/gdi/impgraph.cxx | 39 --------------------- 27 files changed, 99 insertions(+), 145 deletions(-)
New commits: commit 2592eac5fed4b5f70727ac904acbf51746026626 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Aug 27 13:15:10 2025 +0200 Commit: Noel Grandin <noelgran...@gmail.com> CommitDate: Wed Aug 27 18:59:06 2025 +0200 remove Graphic::GetBitmapEx now that all the call sites have been updated to call GetBitmap Change-Id: I975e87437b054cb8329ec02af32a7a76b0117e9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190284 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx index 626648b8b8b9..722a05677517 100644 --- a/include/vcl/graph.hxx +++ b/include/vcl/graph.hxx @@ -125,7 +125,6 @@ public: // allow giving parameters which control AntiAliasing and LineSnapping of the // MetaFile when played. Defaults will use a no-AAed, not snapped conversion as // before. - BitmapEx GetBitmapEx(const GraphicConversionParameters& rParameters = GraphicConversionParameters()) const; Bitmap GetBitmap(const GraphicConversionParameters& rParameters = GraphicConversionParameters()) const; /// Gives direct access to the contained BitmapEx. const Bitmap& GetBitmapRef() const; diff --git a/oox/qa/unit/testscene3d.cxx b/oox/qa/unit/testscene3d.cxx index 247f447a24ec..36a474dbb45e 100644 --- a/oox/qa/unit/testscene3d.cxx +++ b/oox/qa/unit/testscene3d.cxx @@ -43,7 +43,7 @@ protected: uno::Reference<drawing::XShape> getShape(sal_uInt8 nShapeIndex, sal_uInt8 nPageIndex); // Converts the shape 0 on page 0 to a bitmap and returns this bitmap. // It assumes, that shape 0 on page 0 is the only shape. - void getShapeAsBitmap(BitmapEx& rBMP, sal_uInt8 nShapeIndex); + void getShapeAsBitmap(Bitmap& rBMP, sal_uInt8 nShapeIndex); }; uno::Reference<drawing::XShape> TestScene3d::getShape(sal_uInt8 nShapeIndex, sal_uInt8 nPageIndex) @@ -60,7 +60,7 @@ uno::Reference<drawing::XShape> TestScene3d::getShape(sal_uInt8 nShapeIndex, sal return xShape; } -void TestScene3d::getShapeAsBitmap(BitmapEx& rBMP, sal_uInt8 nShapeIndex) +void TestScene3d::getShapeAsBitmap(Bitmap& rBMP, sal_uInt8 nShapeIndex) { SfxViewShell* pViewShell = SfxViewShell::Current(); CPPUNIT_ASSERT(pViewShell); @@ -78,7 +78,7 @@ void TestScene3d::getShapeAsBitmap(BitmapEx& rBMP, sal_uInt8 nShapeIndex) SdrGrafObj* pGrafObj = dynamic_cast<SdrGrafObj*>(SdrObject::getSdrObjectFromXShape(xShapeBmp)); CPPUNIT_ASSERT_MESSAGE("No image object created", pGrafObj); const Graphic& rGraphic = pGrafObj->GetGraphic(); - rBMP = rGraphic.GetBitmapEx(); + rBMP = rGraphic.GetBitmap(); CPPUNIT_ASSERT_MESSAGE("No bitmap", !rBMP.IsEmpty()); } @@ -379,7 +379,7 @@ CPPUNIT_TEST_FIXTURE(TestScene3d, test_lightRig_modernCamera) // shape. This is the same shape as in test_lightRig_legacyCamera but with a modern camera. // The test assumes rendering with ShadeMode_FLAT. loadFromFile(u"Scene3d_lightRig_modernCamera.pptx"); - BitmapEx aBMP; + Bitmap aBMP; getShapeAsBitmap(aBMP, 0); // Size in pixel depends on dpi. Thus calculate positions relative to size. @@ -401,7 +401,7 @@ CPPUNIT_TEST_FIXTURE(TestScene3d, test_lightRig_legacyCamera) // This is the same shape as in test_lightRig_modernCamera but with a legacy camera. // The test assumes rendering with ShadeMode_FLAT. loadFromFile(u"Scene3d_lightRig_legacyCamera.pptx"); - BitmapEx aBMP; + Bitmap aBMP; getShapeAsBitmap(aBMP, 0); // Size in pixel depends on dpi. Thus calculate positions relative to size. @@ -422,7 +422,7 @@ CPPUNIT_TEST_FIXTURE(TestScene3d, test_lightRig_default) // second light is against view direction, the colors are same in LibreOffice and MS Office. // The test assumes rendering with ShadeMode_FLAT. loadFromFile(u"Scene3d_lightRig_default.pptx"); - BitmapEx aBMP; + Bitmap aBMP; getShapeAsBitmap(aBMP, 0); // Size in pixel depends on dpi. Thus calculate positions relative to size. @@ -447,7 +447,7 @@ CPPUNIT_TEST_FIXTURE(TestScene3d, test_lightRig_dir_rotation) // direction of the second light is against the view direction, colors are same in LibreOffice // and MSO. The test assumes rendering with ShadeMode_FLAT. loadFromFile(u"Scene3d_lightRig_dir_rotation.pptx"); - BitmapEx aBMP; + Bitmap aBMP; getShapeAsBitmap(aBMP, 0); // Size in pixel depends on dpi. Thus calculate positions relative to size. @@ -471,7 +471,7 @@ CPPUNIT_TEST_FIXTURE(TestScene3d, test_lightRig_rot_rotation) // rotated around x- and y-axis by element 'rot'. // The test assumes rendering with ShadeMode_FLAT. loadFromFile(u"Scene3d_lightRig_rot_rotation.pptx"); - BitmapEx aBMP; + Bitmap aBMP; getShapeAsBitmap(aBMP, 0); // Size in pixel depends on dpi. Thus calculate positions relative to size. @@ -497,7 +497,7 @@ CPPUNIT_TEST_FIXTURE(TestScene3d, test_material_highlight) loadFromFile(u"Scene3d_material_highlight.pptx"); - BitmapEx aBMP; + Bitmap aBMP; getShapeAsBitmap(aBMP, 0); // material legacyPlastic sal_Int32 nX = 0.75 * aBMP.GetSizePixel().Width(); sal_Int32 nYhigh = 0.25 * aBMP.GetSizePixel().Height(); diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx index 91101037f918..6fb5816e9057 100644 --- a/sc/qa/unit/subsequent_filters_test2.cxx +++ b/sc/qa/unit/subsequent_filters_test2.cxx @@ -722,7 +722,7 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testEmbeddedImageXLS) const SdrGrafObj* pImageObj = dynamic_cast<const SdrGrafObj*>(pObj); CPPUNIT_ASSERT(pImageObj); const Graphic& rGrf = pImageObj->GetGraphic(); - BitmapEx aBMP = rGrf.GetBitmapEx(); + Bitmap aBMP = rGrf.GetBitmap(); CPPUNIT_ASSERT_MESSAGE( "Bitmap content should not be empty if the image has been properly imported.", !aBMP.IsEmpty()); diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 821380c07aae..7369e4fe9bd0 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -1423,7 +1423,7 @@ CPPUNIT_TEST_FIXTURE(SdExportTest, testTdf141269) CPPUNIT_ASSERT(xGraphic.is()); Graphic aGraphic(xGraphic); - BitmapEx aBitmap(aGraphic.GetBitmapEx()); + Bitmap aBitmap(aGraphic.GetBitmap()); CPPUNIT_ASSERT_EQUAL(tools::Long(1920), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(1080), aBitmap.GetSizePixel().Height()); diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index 6bda61ec964c..45947c83000d 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -1200,7 +1200,7 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf134174) CPPUNIT_ASSERT(xGraphic.is()); Graphic aGraphic(xGraphic); - BitmapEx aBitmap(aGraphic.GetBitmapEx()); + Bitmap aBitmap(aGraphic.GetBitmap()); CPPUNIT_ASSERT_EQUAL(Color(0x8b21db), aBitmap.GetPixelColor(0, 0)); } @@ -1215,7 +1215,7 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf134210) CPPUNIT_ASSERT(xGraphic.is()); Graphic aGraphic(xGraphic); - BitmapEx aBitmap(aGraphic.GetBitmapEx()); + Bitmap aBitmap(aGraphic.GetBitmap()); CPPUNIT_ASSERT_EQUAL(Color(0x605741), aBitmap.GetPixelColor(0, 0)); } @@ -1816,7 +1816,7 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testMirroredGraphic) xShape->getPropertyValue(u"FillBitmap"_ustr) >>= xGraphic; CPPUNIT_ASSERT(xGraphic.is()); Graphic aGraphic(xGraphic); - BitmapEx aBitmap(aGraphic.GetBitmapEx()); + Bitmap aBitmap(aGraphic.GetBitmap()); CPPUNIT_ASSERT_EQUAL(Color(0x4f4955), aBitmap.GetPixelColor(0, 0)); } @@ -1831,7 +1831,7 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf134210CropPosition) xShape->getPropertyValue(u"FillBitmap"_ustr) >>= xGraphic; CPPUNIT_ASSERT(xGraphic.is()); Graphic aGraphic(xGraphic); - BitmapEx aBitmap(aGraphic.GetBitmapEx()); + Bitmap aBitmap(aGraphic.GetBitmap()); CPPUNIT_ASSERT_EQUAL(Color(0x81d41a), aBitmap.GetPixelColor(0, 0)); } @@ -1844,7 +1844,7 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testGreysScaleGraphic) xShape->getPropertyValue(u"FillBitmap"_ustr) >>= xGraphic; CPPUNIT_ASSERT(xGraphic.is()); Graphic aGraphic(xGraphic); - BitmapEx aBitmap(aGraphic.GetBitmapEx()); + Bitmap aBitmap(aGraphic.GetBitmap()); CPPUNIT_ASSERT_EQUAL(Color(0x3c3c3c), aBitmap.GetPixelColor(0, 0)); } @@ -1932,7 +1932,7 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf112209) CPPUNIT_ASSERT(xGraphic.is()); Graphic aGraphic(xGraphic); - BitmapEx aBitmap(aGraphic.GetBitmapEx()); + Bitmap aBitmap(aGraphic.GetBitmap()); // Without the accompanying fix in place, this test would have failed with: // - Expected: Color: R:132 G:132 B:132 A:0 @@ -2000,7 +2000,7 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf89928BlackWhiteThreshold) CPPUNIT_ASSERT(xGraphic.is()); Graphic aGraphic(xGraphic); - BitmapEx aBitmap(aGraphic.GetBitmapEx()); + Bitmap aBitmap(aGraphic.GetBitmap()); // Without the accompanying fix in place, this test would have failed with: // - Expected: Color: R:0 G:0 B:0 A:0 @@ -2016,7 +2016,7 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf89928BlackWhiteThreshold) CPPUNIT_ASSERT(xGraphic.is()); Graphic aGraphic(xGraphic); - BitmapEx aBitmap(aGraphic.GetBitmapEx()); + Bitmap aBitmap(aGraphic.GetBitmap()); CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xFFFFFF), aBitmap.GetPixelColor(0, 0)); } @@ -2138,7 +2138,7 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, test_srcRect_smallNegBound) uno::Reference<graphic::XGraphic> xGraphic( getShapeFromPage(0, 0)->getPropertyValue(u"FillBitmap"_ustr), uno::UNO_QUERY_THROW); - BitmapEx aBitmap(Graphic(xGraphic).GetBitmapEx()); + Bitmap aBitmap(Graphic(xGraphic).GetBitmap()); // Properly cropped bitmap should have black pixels close to left edge, near vertical center. // Before the fix, the gear was distorted, and this area was white. diff --git a/svx/qa/unit/XTableImportExportTest.cxx b/svx/qa/unit/XTableImportExportTest.cxx index a1d5673b096e..5cad8efbb9cd 100644 --- a/svx/qa/unit/XTableImportExportTest.cxx +++ b/svx/qa/unit/XTableImportExportTest.cxx @@ -72,7 +72,7 @@ CPPUNIT_TEST_FIXTURE(XTableImportExportTest, testImportExport) CPPUNIT_ASSERT(xGraphic.is()); Graphic aGraphic(xGraphic); CPPUNIT_ASSERT(!aGraphic.IsNone()); - Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap(); + Bitmap aBitmap = aGraphic.GetBitmap().CreateColorBitmap(); CPPUNIT_ASSERT_EQUAL(aChecksum, aBitmap.GetChecksum()); } } diff --git a/sw/qa/extras/htmlexport/htmlexport2.cxx b/sw/qa/extras/htmlexport/htmlexport2.cxx index 5f7cf0e715a2..afad233b166d 100644 --- a/sw/qa/extras/htmlexport/htmlexport2.cxx +++ b/sw/qa/extras/htmlexport/htmlexport2.cxx @@ -1293,7 +1293,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_161979) CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, GraphicFilter().ImportGraphic(graphic, aUrl)); // Check that only ~4% of pixels are not transparent (before the fix, it was completely black) - BitmapEx bitmap = graphic.GetBitmapEx(); + Bitmap bitmap = graphic.GetBitmap(); Size size = bitmap.GetSizePixel(); int numNonTransparent = 0; for (tools::Long y = 0; y < size.Height(); ++y) @@ -1313,7 +1313,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_161979) CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, GraphicFilter().ImportGraphic(graphic, aUrl)); // Check that some pixels are transparent (before the fix, it was completely black) - bitmap = graphic.GetBitmapEx(); + bitmap = graphic.GetBitmap(); size = bitmap.GetSizePixel(); numNonTransparent = 0; for (tools::Long y = 0; y < size.Height(); ++y) diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index f55c4e1fe627..0111c0a6f584 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -508,7 +508,7 @@ DECLARE_OOXMLEXPORT_TEST(testPictureWithSchemeColor, "picture-with-schemecolor.d uno::Reference<beans::XPropertySet> xImage(getShape(1), uno::UNO_QUERY); uno::Reference<graphic::XGraphic> xGraphic = getProperty<uno::Reference<graphic::XGraphic> >(xImage, u"Graphic"_ustr); Graphic aVclGraphic(xGraphic); - BitmapEx aBitmap(aVclGraphic.GetBitmapEx()); + Bitmap aBitmap(aVclGraphic.GetBitmap()); CPPUNIT_ASSERT_EQUAL(tools::Long(341), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(181), aBitmap.GetSizePixel().Height()); CPPUNIT_ASSERT_EQUAL(Color( 0xad, 0xc5, 0xdb ), aBitmap.GetPixelColor(120, 30)); @@ -746,7 +746,7 @@ DECLARE_OOXMLEXPORT_TEST(testMsoBrightnessContrast, "msobrightnesscontrast.docx" uno::Reference<graphic::XGraphic> graphic; imageProperties->getPropertyValue( u"Graphic"_ustr ) >>= graphic; Graphic aVclGraphic(graphic); - BitmapEx aBitmap(aVclGraphic.GetBitmapEx()); + Bitmap aBitmap(aVclGraphic.GetBitmap()); CPPUNIT_ASSERT_EQUAL(tools::Long(58), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(320), aBitmap.GetSizePixel().Height()); Color aColor(aBitmap.GetPixelColor(20, 30)); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index e22f053c4a81..0596168a4c53 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -765,7 +765,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf136841, "tdf136841.docx") uno::Reference<graphic::XGraphic> graphic; imageProperties->getPropertyValue( u"Graphic"_ustr ) >>= graphic; Graphic vclGraphic(graphic); - BitmapEx bitmap(vclGraphic.GetBitmapEx()); + Bitmap bitmap(vclGraphic.GetBitmap()); CPPUNIT_ASSERT_EQUAL( tools::Long(76), bitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL( tools::Long(76), bitmap.GetSizePixel().Height()); diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 2ed94c85d3f7..64a10cad9633 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -524,7 +524,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN777345) uno::Reference<document::XEmbeddedObjectSupplier2> xSupplier(getShape(1), uno::UNO_QUERY); uno::Reference<graphic::XGraphic> xGraphic = xSupplier->getReplacementGraphic(); Graphic aGraphic(xGraphic); - BitmapEx aBitmap = aGraphic.GetBitmapEx(); + Bitmap aBitmap = aGraphic.GetBitmap(); CPPUNIT_ASSERT_EQUAL( Size( 17, 16 ), aBitmap.GetSizePixel()); CPPUNIT_ASSERT_EQUAL( COL_BLACK, aBitmap.GetPixelColor( 0, 0 )); CPPUNIT_ASSERT_EQUAL( COL_BLACK, aBitmap.GetPixelColor( 16, 15 )); diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index 9e5daa6dab96..5abfb0022801 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -1224,7 +1224,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156078) Graphic exported; GraphicFilter::LoadGraphic(maTempFile.GetURL(), {}, exported); - Bitmap bmp = exported.GetBitmapEx().GetBitmap(); + Bitmap bmp = exported.GetBitmap().CreateColorBitmap(); BitmapScopedReadAccess pAccess(bmp); // "1" must export to the top right corner; check its pixels diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx index 7703142d19a1..c8b5c22c7f31 100644 --- a/sw/qa/extras/uiwriter/uiwriter8.cxx +++ b/sw/qa/extras/uiwriter/uiwriter8.cxx @@ -2530,7 +2530,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf133477) TypeSerializer aSerializer(aStream); aSerializer.readGraphic(aGraphic); - BitmapEx aBitmap = aGraphic.GetBitmapEx(); + Bitmap aBitmap = aGraphic.GetBitmap(); CPPUNIT_ASSERT_EQUAL(Color(0, 102, 204), aBitmap.GetPixelColor(1, 1)); } diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 16eff873137a..7255d90393d2 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -463,7 +463,7 @@ DECLARE_WW8EXPORT_TEST(testMsoBrightnessContrast, "msobrightnesscontrast.doc") uno::Reference<graphic::XGraphic> graphic; imageProperties->getPropertyValue( u"Graphic"_ustr ) >>= graphic; Graphic vclGraphic(graphic); - BitmapEx bitmap(vclGraphic.GetBitmapEx()); + Bitmap bitmap(vclGraphic.GetBitmap()); CPPUNIT_ASSERT_EQUAL( tools::Long(58), bitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL( tools::Long(320), bitmap.GetSizePixel().Height()); CPPUNIT_ASSERT_EQUAL( Color(206,206,206), bitmap.GetPixelColor(16,27)); diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx index 303fb4d1cf1f..46cd2135b947 100644 --- a/vcl/inc/impgraph.hxx +++ b/vcl/inc/impgraph.hxx @@ -129,8 +129,7 @@ private: bool isAvailable() const; bool makeAvailable(); - BitmapEx getBitmapEx(const GraphicConversionParameters& rParameters) const; - /// Gives direct access to the contained BitmapEx. + /// Gives direct access to the contained Bitmap. const Bitmap& getBitmapRef() const; Animation getAnimation() const; const GDIMetaFile& getGDIMetaFile() const; diff --git a/vcl/qa/cppunit/BitmapFilterTest.cxx b/vcl/qa/cppunit/BitmapFilterTest.cxx index 851e348017ae..eff09c98eea8 100644 --- a/vcl/qa/cppunit/BitmapFilterTest.cxx +++ b/vcl/qa/cppunit/BitmapFilterTest.cxx @@ -73,7 +73,7 @@ private: return m_directories.getURLFromSrc(u"vcl/qa/cppunit/data/") + sFileName; } - BitmapEx loadBitmap(std::u16string_view sFileName) + Bitmap loadBitmap(std::u16string_view sFileName) { Graphic aGraphic; const OUString aURL(getFullUrl(sFileName)); @@ -81,7 +81,7 @@ private: GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); ErrCode aResult = rFilter.ImportGraphic(aGraphic, aURL, aFileStream); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, aResult); - return aGraphic.GetBitmapEx(); + return aGraphic.GetBitmap(); } template <class BitmapT> // handle both Bitmap and BitmapEx @@ -173,15 +173,13 @@ void BitmapFilterTest::testBlurCorrectness() void BitmapFilterTest::testBasicMorphology() { - const BitmapEx aOrigBitmap = loadBitmap(u"testBasicMorphology.png"); - const BitmapEx aRefBitmapDilated1 = loadBitmap(u"testBasicMorphologyDilated1.png"); - const BitmapEx aRefBitmapDilated1Eroded1 - = loadBitmap(u"testBasicMorphologyDilated1Eroded1.png"); - const BitmapEx aRefBitmapDilated2 = loadBitmap(u"testBasicMorphologyDilated2.png"); - const BitmapEx aRefBitmapDilated2Eroded1 - = loadBitmap(u"testBasicMorphologyDilated2Eroded1.png"); - - BitmapEx aTransformBitmap = aOrigBitmap; + const Bitmap aOrigBitmap = loadBitmap(u"testBasicMorphology.png"); + const Bitmap aRefBitmapDilated1 = loadBitmap(u"testBasicMorphologyDilated1.png"); + const Bitmap aRefBitmapDilated1Eroded1 = loadBitmap(u"testBasicMorphologyDilated1Eroded1.png"); + const Bitmap aRefBitmapDilated2 = loadBitmap(u"testBasicMorphologyDilated2.png"); + const Bitmap aRefBitmapDilated2Eroded1 = loadBitmap(u"testBasicMorphologyDilated2Eroded1.png"); + + Bitmap aTransformBitmap = aOrigBitmap; BitmapFilter::Filter(aTransformBitmap, BitmapDilateFilter(1)); if (constWriteResultBitmap) savePNG(u"~/Dilated1.png"_ustr, aTransformBitmap); diff --git a/vcl/qa/cppunit/BmpFilterTest.cxx b/vcl/qa/cppunit/BmpFilterTest.cxx index f591c39d93a9..edf15895ab95 100644 --- a/vcl/qa/cppunit/BmpFilterTest.cxx +++ b/vcl/qa/cppunit/BmpFilterTest.cxx @@ -32,7 +32,7 @@ CPPUNIT_TEST_FIXTURE(BmpFilterTest, testBMP_RGB_888) SvFileStream aFileStream(getFullUrl(u"BMP_R8G8B8.bmp"), StreamMode::READ); Graphic aGraphic; CPPUNIT_ASSERT(BmpReader(aFileStream, aGraphic)); - auto aBitmap = aGraphic.GetBitmapEx(); + auto aBitmap = aGraphic.GetBitmap(); CPPUNIT_ASSERT_EQUAL(tools::Long(10), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(10), aBitmap.GetSizePixel().Height()); CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N24_BPP, aBitmap.getPixelFormat()); @@ -47,7 +47,7 @@ CPPUNIT_TEST_FIXTURE(BmpFilterTest, testBMP_RGB_565) SvFileStream aFileStream(getFullUrl(u"BMP_R5G6B5.bmp"), StreamMode::READ); Graphic aGraphic; CPPUNIT_ASSERT(BmpReader(aFileStream, aGraphic)); - auto aBitmap = aGraphic.GetBitmapEx(); + auto aBitmap = aGraphic.GetBitmap(); CPPUNIT_ASSERT_EQUAL(tools::Long(10), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(10), aBitmap.GetSizePixel().Height()); CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N24_BPP, aBitmap.getPixelFormat()); @@ -65,7 +65,7 @@ CPPUNIT_TEST_FIXTURE(BmpFilterTest, testBMP_32_ARGB_8888) SvFileStream aFileStream(getFullUrl(u"BMP_A8R8G8B8.bmp"), StreamMode::READ); Graphic aGraphic; CPPUNIT_ASSERT(BmpReader(aFileStream, aGraphic)); - auto aBitmap = aGraphic.GetBitmapEx(); + auto aBitmap = aGraphic.GetBitmap(); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Height()); @@ -80,7 +80,7 @@ CPPUNIT_TEST_FIXTURE(BmpFilterTest, testBMP_Paint_24_RGB_888) SvFileStream aFileStream(getFullUrl(u"BMP_Paint_24bit.bmp"), StreamMode::READ); Graphic aGraphic; CPPUNIT_ASSERT(BmpReader(aFileStream, aGraphic)); - auto aBitmap = aGraphic.GetBitmapEx(); + auto aBitmap = aGraphic.GetBitmap(); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Height()); CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N24_BPP, aBitmap.getPixelFormat()); @@ -96,7 +96,7 @@ CPPUNIT_TEST_FIXTURE(BmpFilterTest, testBMP_Index_1BPP) SvFileStream aFileStream(getFullUrl(u"BMP_Paint_1bit.bmp"), StreamMode::READ); Graphic aGraphic; CPPUNIT_ASSERT(BmpReader(aFileStream, aGraphic)); - auto aBitmap = aGraphic.GetBitmapEx(); + auto aBitmap = aGraphic.GetBitmap(); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Height()); CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, aBitmap.getPixelFormat()); @@ -112,7 +112,7 @@ CPPUNIT_TEST_FIXTURE(BmpFilterTest, testBMP_Index_4BPP) SvFileStream aFileStream(getFullUrl(u"BMP_Paint_4bit.bmp"), StreamMode::READ); Graphic aGraphic; CPPUNIT_ASSERT(BmpReader(aFileStream, aGraphic)); - auto aBitmap = aGraphic.GetBitmapEx(); + auto aBitmap = aGraphic.GetBitmap(); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Height()); CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, aBitmap.getPixelFormat()); @@ -128,7 +128,7 @@ CPPUNIT_TEST_FIXTURE(BmpFilterTest, testBMP_Index_8BPP) SvFileStream aFileStream(getFullUrl(u"BMP_Paint_8bit.bmp"), StreamMode::READ); Graphic aGraphic; CPPUNIT_ASSERT(BmpReader(aFileStream, aGraphic)); - auto aBitmap = aGraphic.GetBitmapEx(); + auto aBitmap = aGraphic.GetBitmap(); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Height()); CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, aBitmap.getPixelFormat()); @@ -144,7 +144,7 @@ CPPUNIT_TEST_FIXTURE(BmpFilterTest, testBMP_Index_8BPP_RLE) SvFileStream aFileStream(getFullUrl(u"BMP_8bit_RLE.bmp"), StreamMode::READ); Graphic aGraphic; CPPUNIT_ASSERT(BmpReader(aFileStream, aGraphic)); - auto aBitmap = aGraphic.GetBitmapEx(); + auto aBitmap = aGraphic.GetBitmap(); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Height()); CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, aBitmap.getPixelFormat()); @@ -160,7 +160,7 @@ CPPUNIT_TEST_FIXTURE(BmpFilterTest, testBMP_V4) SvFileStream aFileStream(getFullUrl(u"BMP_RLE.bmp"), StreamMode::READ); Graphic aGraphic; CPPUNIT_ASSERT(BmpReader(aFileStream, aGraphic)); - auto aBitmap = aGraphic.GetBitmapEx(); + auto aBitmap = aGraphic.GetBitmap(); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Height()); CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, aBitmap.getPixelFormat()); @@ -176,7 +176,7 @@ CPPUNIT_TEST_FIXTURE(BmpFilterTest, testBMP_V3) SvFileStream aFileStream(getFullUrl(u"BMP_RLE_V3.bmp"), StreamMode::READ); Graphic aGraphic; CPPUNIT_ASSERT(BmpReader(aFileStream, aGraphic)); - auto aBitmap = aGraphic.GetBitmapEx(); + auto aBitmap = aGraphic.GetBitmap(); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Height()); CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, aBitmap.getPixelFormat()); @@ -192,7 +192,7 @@ CPPUNIT_TEST_FIXTURE(BmpFilterTest, testBMP_V2) SvFileStream aFileStream(getFullUrl(u"BMP_RLE_V2.bmp"), StreamMode::READ); Graphic aGraphic; CPPUNIT_ASSERT(BmpReader(aFileStream, aGraphic)); - auto aBitmap = aGraphic.GetBitmapEx(); + auto aBitmap = aGraphic.GetBitmap(); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Height()); CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, aBitmap.getPixelFormat()); @@ -208,7 +208,7 @@ CPPUNIT_TEST_FIXTURE(BmpFilterTest, testTdf73523) SvFileStream aFileStream(getFullUrl(u"tdf73523.bmp"), StreamMode::READ); Graphic aGraphic; CPPUNIT_ASSERT(BmpReader(aFileStream, aGraphic)); - auto aBitmap = aGraphic.GetBitmapEx(); + auto aBitmap = aGraphic.GetBitmap(); // Without the accompanying fix in place, this test would have failed with: // - Expected: c[80000000] // - Actual : c[00000000] diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx index 5d5252729f1c..dc655f77fced 100644 --- a/vcl/qa/cppunit/GraphicTest.cxx +++ b/vcl/qa/cppunit/GraphicTest.cxx @@ -97,7 +97,7 @@ bool checkBitmap(Graphic& rGraphic) { bool bResult = true; - Bitmap aBitmap(rGraphic.GetBitmapEx().GetBitmap()); + Bitmap aBitmap(rGraphic.GetBitmap().CreateColorBitmap()); { BitmapScopedReadAccess pReadAccess(aBitmap); for (tools::Long y = 0; y < rGraphic.GetSizePixel().Height(); y++) @@ -544,7 +544,7 @@ CPPUNIT_TEST_FIXTURE(GraphicTest, testSwappingGraphic_PNG_WithoutGfxLink) // Make sure to construct the Graphic from BitmapEx, so that we // don't have the GfxLink present. - Graphic aGraphic(makeUnloadedGraphic(u"png").GetBitmapEx()); + Graphic aGraphic(makeUnloadedGraphic(u"png").GetBitmap()); CPPUNIT_ASSERT_EQUAL(GraphicType::Bitmap, aGraphic.GetType()); CPPUNIT_ASSERT_EQUAL(true, aGraphic.makeAvailable()); @@ -659,7 +659,7 @@ CPPUNIT_TEST_FIXTURE(GraphicTest, testSwappingGraphicProperties_PNG_WithGfxLink) CPPUNIT_TEST_FIXTURE(GraphicTest, testSwappingGraphicProperties_PNG_WithoutGfxLink) { // Prepare Graphic from a PNG image - Graphic aGraphic(makeUnloadedGraphic(u"png").GetBitmapEx()); + Graphic aGraphic(makeUnloadedGraphic(u"png").GetBitmap()); CPPUNIT_ASSERT_EQUAL(GraphicType::Bitmap, aGraphic.GetType()); CPPUNIT_ASSERT_EQUAL(true, aGraphic.makeAvailable()); @@ -730,7 +730,7 @@ CPPUNIT_TEST_FIXTURE(GraphicTest, testSwappingVectorGraphic_SVG_WithGfxLink) CPPUNIT_ASSERT_EQUAL(sal_uInt32(223), aGraphic.GetGfxLink().GetDataSize()); // Remember checksum so we can compare after swapping back in again - BitmapChecksum aBitmapChecksumBeforeSwapping = aGraphic.GetBitmapEx().GetChecksum(); + BitmapChecksum aBitmapChecksumBeforeSwapping = aGraphic.GetBitmap().GetChecksum(); // Check we are not swapped out yet CPPUNIT_ASSERT_EQUAL(false, aGraphic.ImplGetImpGraphic()->isSwappedOut()); @@ -760,7 +760,7 @@ CPPUNIT_TEST_FIXTURE(GraphicTest, testSwappingVectorGraphic_SVG_WithGfxLink) CPPUNIT_ASSERT_EQUAL(false, aGraphic.ImplGetImpGraphic()->isSwappedOut()); // Compare that the checksum of the bitmap is still the same - CPPUNIT_ASSERT_EQUAL(aBitmapChecksumBeforeSwapping, aGraphic.GetBitmapEx().GetChecksum()); + CPPUNIT_ASSERT_EQUAL(aBitmapChecksumBeforeSwapping, aGraphic.GetBitmap().GetChecksum()); // Byte size shouldn't change CPPUNIT_ASSERT_EQUAL(rByteSize, aGraphic.GetSizeBytes()); @@ -789,7 +789,7 @@ CPPUNIT_TEST_FIXTURE(GraphicTest, testSwappingVectorGraphic_SVG_WithoutGfxLink) CPPUNIT_ASSERT_EQUAL(false, aGraphic.IsGfxLink()); - BitmapChecksum aBitmapChecksumBeforeSwapping = aGraphic.GetBitmapEx().GetChecksum(); + BitmapChecksum aBitmapChecksumBeforeSwapping = aGraphic.GetBitmap().GetChecksum(); CPPUNIT_ASSERT_EQUAL(false, aGraphic.ImplGetImpGraphic()->isSwappedOut()); @@ -838,7 +838,7 @@ CPPUNIT_TEST_FIXTURE(GraphicTest, testSwappingVectorGraphic_SVG_WithoutGfxLink) CPPUNIT_ASSERT_EQUAL(false, aGraphic.IsGfxLink()); - CPPUNIT_ASSERT_EQUAL(aBitmapChecksumBeforeSwapping, aGraphic.GetBitmapEx().GetChecksum()); + CPPUNIT_ASSERT_EQUAL(aBitmapChecksumBeforeSwapping, aGraphic.GetBitmap().GetChecksum()); // File shouldn't be available anymore CPPUNIT_ASSERT_EQUAL(static_cast<SvStream*>(nullptr), @@ -1079,7 +1079,7 @@ CPPUNIT_TEST_FIXTURE(GraphicTest, testSwappingAnimationGraphic_GIF_WithGfxLink) CPPUNIT_ASSERT_EQUAL(sal_uInt32(1515), aGraphic.GetGfxLink().GetDataSize()); // Remember checksum so we can compare after swapping back in again - BitmapChecksum aBitmapChecksumBeforeSwapping = aGraphic.GetBitmapEx().GetChecksum(); + BitmapChecksum aBitmapChecksumBeforeSwapping = aGraphic.GetBitmap().GetChecksum(); // Check we are not swapped out yet CPPUNIT_ASSERT_EQUAL(false, aGraphic.ImplGetImpGraphic()->isSwappedOut()); @@ -1109,7 +1109,7 @@ CPPUNIT_TEST_FIXTURE(GraphicTest, testSwappingAnimationGraphic_GIF_WithGfxLink) CPPUNIT_ASSERT_EQUAL(false, aGraphic.ImplGetImpGraphic()->isSwappedOut()); // Compare that the checksum of the bitmap is still the same - CPPUNIT_ASSERT_EQUAL(aBitmapChecksumBeforeSwapping, aGraphic.GetBitmapEx().GetChecksum()); + CPPUNIT_ASSERT_EQUAL(aBitmapChecksumBeforeSwapping, aGraphic.GetBitmap().GetChecksum()); // Byte size shouldn't change CPPUNIT_ASSERT_EQUAL(rByteSize, aGraphic.GetSizeBytes()); diff --git a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx index 5b259f5a9265..299c93d88e68 100644 --- a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx +++ b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx @@ -75,7 +75,7 @@ void BitmapRenderTest::testTdf104141() SvFileStream aFileStream(aURL, StreamMode::READ); ErrCode bResult = rFilter.ImportGraphic(aGraphic, aURL, aFileStream); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult); - BitmapEx aBitmap = aGraphic.GetBitmapEx(); + Bitmap aBitmap = aGraphic.GetBitmap(); pVDev->DrawBitmapEx(Point(20, 20), aBitmap); // Check drawing results: ensure that it contains transparent @@ -98,7 +98,7 @@ void BitmapRenderTest::testTdf113918() SvFileStream aFileStream(aURL, StreamMode::READ); ErrCode bResult = rFilter.ImportGraphic(aGraphic, aURL, aFileStream); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult); - BitmapEx aBitmap = aGraphic.GetBitmapEx(); + Bitmap aBitmap = aGraphic.GetBitmap(); pVDev->DrawBitmapEx(Point(0, 0), aBitmap); // Ensure that image is drawn with white background color from palette @@ -259,7 +259,7 @@ void BitmapRenderTest::testTdf116888() SvFileStream aFileStream(aURL, StreamMode::READ); ErrCode bResult = rFilter.ImportGraphic(aGraphic, aURL, aFileStream); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult); - Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap(); + Bitmap aBitmap = aGraphic.GetBitmap().CreateColorBitmap(); CPPUNIT_ASSERT(!aBitmap.IsEmpty()); aBitmap.Scale(0.8, 0.8); // This scaling discards mpUserData, BitmapScopedReadAccess pAccess(aBitmap); // forcing ReadTexture() here. diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx index 8bee95d45019..8ac8090b072a 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx @@ -128,7 +128,7 @@ void VclFiltersTest::checkExportImport(std::u16string_view aFilterShortName) Graphic aLoadedGraphic; mpGraphicFilter->ImportGraphic( aLoadedGraphic, u"", aStream ); - BitmapEx aLoadedBitmapEx = aLoadedGraphic.GetBitmapEx(); + Bitmap aLoadedBitmapEx = aLoadedGraphic.GetBitmap(); Size aSize = aLoadedBitmapEx.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(tools::Long(100), aSize.Width()); diff --git a/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx index 982889e1d03b..f9ebda83795c 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx @@ -108,7 +108,7 @@ void TiffFilterTest::testTdf115863() // - Actual : 0x8203(Error Area:Vcl Class:General Code:3) CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult); - Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap(); + Bitmap aBitmap = aGraphic.GetBitmap().CreateColorBitmap(); Size aSize = aBitmap.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(tools::Long(528), aSize.Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(618), aSize.Height()); @@ -159,7 +159,7 @@ void TiffFilterTest::testTdf74331() CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult); - Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap(); + Bitmap aBitmap = aGraphic.GetBitmap().CreateColorBitmap(); Size aSize = aBitmap.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(tools::Long(200), aSize.Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(200), aSize.Height()); @@ -218,7 +218,7 @@ void TiffFilterTest::testRoundtrip() ErrCode bResult = rFilter.ImportGraphic(aGraphic, u"none", aStream); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult); CPPUNIT_ASSERT_EQUAL(GfxLinkType::NativeTif, aGraphic.GetGfxLink().GetType()); - Bitmap aResultBitmap = aGraphic.GetBitmapEx().GetBitmap(); + Bitmap aResultBitmap = aGraphic.GetBitmap().CreateColorBitmap(); CPPUNIT_ASSERT_EQUAL(Size(2, 2), aResultBitmap.GetSizePixel()); { @@ -256,7 +256,7 @@ void TiffFilterTest::testRGB8bits() ErrCode bResult = rFilter.ImportGraphic(aGraphic, aURL, aFileStream); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult); - Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap(); + Bitmap aBitmap = aGraphic.GetBitmap().CreateColorBitmap(); Size aSize = aBitmap.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(tools::Long(10), aSize.Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(10), aSize.Height()); @@ -291,7 +291,7 @@ void TiffFilterTest::testRGB16bits() ErrCode bResult = rFilter.ImportGraphic(aGraphic, aURL, aFileStream); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult); - Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap(); + Bitmap aBitmap = aGraphic.GetBitmap().CreateColorBitmap(); Size aSize = aBitmap.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(tools::Long(10), aSize.Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(10), aSize.Height()); diff --git a/vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx index 8889442b8502..d44093da9365 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx @@ -117,12 +117,12 @@ void WebpFilterTest::testRoundtrip(bool lossy) ErrCode bResult = rFilter.ImportGraphic(aGraphic, u"none", aStream); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult); CPPUNIT_ASSERT_EQUAL(GfxLinkType::NativeWebp, aGraphic.GetGfxLink().GetType()); - BitmapEx aResultBitmap = aGraphic.GetBitmapEx(); + Bitmap aResultBitmap = aGraphic.GetBitmap(); CPPUNIT_ASSERT_EQUAL(Size(20, 20), aResultBitmap.GetSizePixel()); - CPPUNIT_ASSERT(aResultBitmap.IsAlpha()); + CPPUNIT_ASSERT(aResultBitmap.HasAlpha()); { - Bitmap tmpBitmap = aResultBitmap.GetBitmap(); + Bitmap tmpBitmap = aResultBitmap.CreateColorBitmap(); BitmapScopedReadAccess pAccess(tmpBitmap); // Note that x,y are swapped. CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(pAccess->GetPixel(0, 0))); @@ -138,7 +138,7 @@ void WebpFilterTest::testRoundtrip(bool lossy) CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, Color(pAccess->GetPixel(19, 0))); CPPUNIT_ASSERT_EQUAL(COL_BLUE, Color(pAccess->GetPixel(19, 19))); } - AlphaMask tmpAlpha = aResultBitmap.GetAlphaMask(); + AlphaMask tmpAlpha = aResultBitmap.CreateAlphaMask(); BitmapScopedReadAccess pAccessAlpha(tmpAlpha); CPPUNIT_ASSERT_EQUAL(sal_uInt8(255), pAccessAlpha->GetPixelIndex(0, 0)); CPPUNIT_ASSERT_EQUAL(sal_uInt8(255), pAccessAlpha->GetPixelIndex(0, 19)); @@ -174,12 +174,12 @@ void WebpFilterTest::testRead(std::u16string_view rName, bool lossy, bool alpha) ErrCode bResult = rFilter.ImportGraphic(aGraphic, u"none", aFileStream); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult); CPPUNIT_ASSERT_EQUAL(GfxLinkType::NativeWebp, aGraphic.GetGfxLink().GetType()); - BitmapEx aResultBitmap = aGraphic.GetBitmapEx(); + Bitmap aResultBitmap = aGraphic.GetBitmap(); CPPUNIT_ASSERT_EQUAL(Size(10, 10), aResultBitmap.GetSizePixel()); - CPPUNIT_ASSERT_EQUAL(alpha, aResultBitmap.IsAlpha()); + CPPUNIT_ASSERT_EQUAL(alpha, aResultBitmap.HasAlpha()); { - Bitmap tmpBitmap = aResultBitmap.GetBitmap(); + Bitmap tmpBitmap = aResultBitmap.CreateColorBitmap(); BitmapScopedReadAccess pAccess(tmpBitmap); // Note that x,y are swapped. if (lossy) @@ -189,7 +189,7 @@ void WebpFilterTest::testRead(std::u16string_view rName, bool lossy, bool alpha) CPPUNIT_ASSERT_EQUAL(COL_LIGHTBLUE, Color(pAccess->GetPixel(9, 9))); if (alpha) { - AlphaMask tmpAlpha = aResultBitmap.GetAlphaMask(); + AlphaMask tmpAlpha = aResultBitmap.CreateAlphaMask(); BitmapScopedReadAccess pAccessAlpha(tmpAlpha); CPPUNIT_ASSERT_EQUAL(sal_uInt8(255), pAccessAlpha->GetPixelIndex(0, 0)); CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), pAccessAlpha->GetPixelIndex(0, 9)); diff --git a/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx b/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx index f83d58d51d73..3cf92baf1fee 100644 --- a/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx +++ b/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx @@ -117,7 +117,7 @@ Graphic JpegReaderTest::loadJPG(const OUString& aURL) void JpegReaderTest::testReadRGB() { Graphic aGraphic = loadJPG(getFullUrl(u"JPEGTestRGB.jpeg")); - Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap(); + Bitmap aBitmap = aGraphic.GetBitmap().CreateColorBitmap(); Size aSize = aBitmap.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(tools::Long(12), aSize.Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(12), aSize.Height()); @@ -134,7 +134,7 @@ void JpegReaderTest::testReadRGB() void JpegReaderTest::testReadGray() { Graphic aGraphic = loadJPG(getFullUrl(u"JPEGTestGray.jpeg")); - Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap(); + Bitmap aBitmap = aGraphic.GetBitmap().CreateColorBitmap(); Size aSize = aBitmap.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(tools::Long(12), aSize.Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(12), aSize.Height()); @@ -154,7 +154,7 @@ void JpegReaderTest::testReadGray() void JpegReaderTest::testReadCMYK() { Graphic aGraphic = loadJPG(getFullUrl(u"JPEGTestCMYK.jpeg")); - Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap(); + Bitmap aBitmap = aGraphic.GetBitmap().CreateColorBitmap(); Size aSize = aBitmap.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(tools::Long(12), aSize.Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(12), aSize.Height()); @@ -171,7 +171,7 @@ void JpegReaderTest::testReadCMYK() void JpegReaderTest::testTdf138950() { Graphic aGraphic = loadJPG(getFullUrl(u"tdf138950.jpeg")); - Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap(); + Bitmap aBitmap = aGraphic.GetBitmap().CreateColorBitmap(); Size aSize = aBitmap.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(tools::Long(720), aSize.Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(1280), aSize.Height()); diff --git a/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx b/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx index 875be15e7e9d..1c0a936039f3 100644 --- a/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx +++ b/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx @@ -27,9 +27,9 @@ class JpegWriterTest : public test::BootstrapFixtureBase return m_directories.getURLFromSrc(gaDataUrl) + sFileName; } - BitmapEx load(const OUString& aURL); - BitmapEx roundtripJPG(const BitmapEx& bitmap); - BitmapEx roundtripJPG(const OUString& aURL); + Bitmap load(const OUString& aURL); + Bitmap roundtripJPG(const Bitmap& bitmap); + Bitmap roundtripJPG(const OUString& aURL); public: void testWrite8BitGrayscale(); @@ -41,19 +41,19 @@ public: CPPUNIT_TEST_SUITE_END(); }; -BitmapEx JpegWriterTest::load(const OUString& aURL) +Bitmap JpegWriterTest::load(const OUString& aURL) { GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); Graphic aGraphic; SvFileStream aFileStream(aURL, StreamMode::READ); ErrCode bResult = rFilter.ImportGraphic(aGraphic, aURL, aFileStream); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult); - return aGraphic.GetBitmapEx(); + return aGraphic.GetBitmap(); } -BitmapEx JpegWriterTest::roundtripJPG(const OUString& aURL) { return roundtripJPG(load(aURL)); } +Bitmap JpegWriterTest::roundtripJPG(const OUString& aURL) { return roundtripJPG(load(aURL)); } -BitmapEx JpegWriterTest::roundtripJPG(const BitmapEx& bitmap) +Bitmap JpegWriterTest::roundtripJPG(const Bitmap& bitmap) { // EXPORT JPEG SvMemoryStream aStream; @@ -73,12 +73,12 @@ BitmapEx JpegWriterTest::roundtripJPG(const BitmapEx& bitmap) sal_uInt16 importFormatJPG = rFilter.GetImportFormatNumberForShortName(JPG_SHORTNAME); bResult = rFilter.ImportGraphic(aImportGraphic, u"memory", aStream, importFormatJPG); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult); - return aImportGraphic.GetBitmapEx(); + return aImportGraphic.GetBitmap(); } void JpegWriterTest::testWrite8BitGrayscale() { - Bitmap bitmap = roundtripJPG(getFullUrl(u"8BitGrayscale.jpg")).GetBitmap(); + Bitmap bitmap = roundtripJPG(getFullUrl(u"8BitGrayscale.jpg")).CreateColorBitmap(); BitmapScopedReadAccess access(bitmap); const ScanlineFormat format = access->GetScanlineFormat(); // Check that it's still 8bit grayscale. @@ -94,7 +94,7 @@ void JpegWriterTest::testWrite8BitGrayscale() void JpegWriterTest::testWrite8BitNonGrayscale() { - Bitmap bitmap = roundtripJPG(getFullUrl(u"8BitNonGrayscale.gif")).GetBitmap(); + Bitmap bitmap = roundtripJPG(getFullUrl(u"8BitNonGrayscale.gif")).CreateColorBitmap(); BitmapScopedReadAccess access(bitmap); const ScanlineFormat format = access->GetScanlineFormat(); // Check that it's still 8bit grayscale. diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx index 636c55d4be2b..c237a6b3a27f 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx @@ -277,7 +277,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf121615) sal_uInt16 jpegFormat = rFilter.GetImportFormatNumberForShortName(JPG_SHORTNAME); CPPUNIT_ASSERT(jpegFormat != GRFILTER_FORMAT_NOTFOUND); CPPUNIT_ASSERT_EQUAL(jpegFormat, format); - BitmapEx aBitmap = aGraphic.GetBitmapEx(); + Bitmap aBitmap = aGraphic.GetBitmap(); CPPUNIT_ASSERT_EQUAL(tools::Long(200), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(300), aBitmap.GetSizePixel().Height()); CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, aBitmap.getPixelFormat()); @@ -387,7 +387,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf129085) sal_uInt16 jpegFormat = rFilter.GetImportFormatNumberForShortName(JPG_SHORTNAME); CPPUNIT_ASSERT(jpegFormat != GRFILTER_FORMAT_NOTFOUND); CPPUNIT_ASSERT_EQUAL(jpegFormat, format); - BitmapEx aBitmap = aGraphic.GetBitmapEx(); + Bitmap aBitmap = aGraphic.GetBitmap(); CPPUNIT_ASSERT_EQUAL(tools::Long(884), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(925), aBitmap.GetSizePixel().Height()); CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N24_BPP, aBitmap.getPixelFormat()); diff --git a/vcl/qa/cppunit/png/PngFilterTest.cxx b/vcl/qa/cppunit/png/PngFilterTest.cxx index 78de4d88c906..9bc4b03d4680 100644 --- a/vcl/qa/cppunit/png/PngFilterTest.cxx +++ b/vcl/qa/cppunit/png/PngFilterTest.cxx @@ -1975,10 +1975,10 @@ void PngFilterTest::testTdf153180MonochromeFilterPngExport() } // Apply the monochrome filter to the graphic but keep the alpha. - BitmapEx aBitmapEx(aGraphicOriginal.GetBitmapEx()); - AlphaMask aAlphaMask(aBitmapEx.GetAlphaMask()); + Bitmap aBitmap(aGraphicOriginal.GetBitmap()); + AlphaMask aAlphaMask(aBitmap.CreateAlphaMask()); - Bitmap aTmpBmp(aBitmapEx.GetBitmap()); + Bitmap aTmpBmp(aBitmap.CreateColorBitmap()); BitmapFilter::Filter(aTmpBmp, BitmapMonochromeFilter{ sal_uInt8{ 127 } }); Graphic aGraphicAfterFilter{ BitmapEx(aTmpBmp, aAlphaMask) }; @@ -1991,7 +1991,7 @@ void PngFilterTest::testTdf153180MonochromeFilterPngExport() { SvStream& rStream = *aTempFile.GetStream(StreamMode::WRITE); vcl::PngImageWriter aPngWriter(rStream); - bool bWriteSuccess = aPngWriter.write(aGraphicAfterFilter.GetBitmapEx()); + bool bWriteSuccess = aPngWriter.write(aGraphicAfterFilter.GetBitmap()); CPPUNIT_ASSERT_EQUAL(true, bWriteSuccess); aTempFile.CloseStream(); } diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index 93f297d84c54..0ac9a5f89e58 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -331,11 +331,6 @@ bool Graphic::IsEPS() const return mxImpGraphic->isEPS(); } -BitmapEx Graphic::GetBitmapEx(const GraphicConversionParameters& rParameters) const -{ - return mxImpGraphic->getBitmapEx(rParameters); -} - Bitmap Graphic::GetBitmap(const GraphicConversionParameters& rParameters) const { return mxImpGraphic->getBitmap(rParameters); diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 83682ff12278..7984b3f133e9 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -660,43 +660,6 @@ Bitmap ImpGraphic::getBitmap(const GraphicConversionParameters& rParameters) con return aRetBmp; } -BitmapEx ImpGraphic::getBitmapEx(const GraphicConversionParameters& rParameters) const -{ - ensureAvailable(); - - BitmapEx aBitmapEx; - - if (meType == GraphicType::Bitmap) - { - if (maVectorGraphicData) - updateBitmapFromVectorGraphic(rParameters.getSizePixel()); - - if (mpAnimationContainer) - aBitmapEx = mpAnimationContainer->maAnimation.GetBitmapEx(); - else if (mpBitmapContainer) - aBitmapEx = mpBitmapContainer->maBitmap; - else - aBitmapEx = maCachedBitmap; - - if (rParameters.getSizePixel().Width() || rParameters.getSizePixel().Height()) - aBitmapEx.Scale(rParameters.getSizePixel(), BmpScaleFlag::Fast); - } - else if (meType != GraphicType::Default && isSupportedGraphic()) - { - if (maCachedBitmap.IsEmpty()) - { - const ImpGraphic aMonoMask( maMetaFile.GetMonochromeMtf( COL_BLACK ) ); - - // use maBitmapEx as local buffer for rendered metafile - const_cast<ImpGraphic*>(this)->maCachedBitmap = Bitmap(BitmapEx(getBitmap(rParameters), aMonoMask.getBitmap(rParameters))); - } - - aBitmapEx = maCachedBitmap; - } - - return aBitmapEx; -} - Animation ImpGraphic::getAnimation() const { Animation aAnimation; @@ -794,7 +757,7 @@ Size ImpGraphic::getSizePixel() const if (isSwappedOut()) aSize = maSwapInfo.maSizePixel; else - aSize = getBitmapEx(GraphicConversionParameters()).GetSizePixel(); + aSize = getBitmap(GraphicConversionParameters()).GetSizePixel(); return aSize; }