diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2020-08-13 08:49:30 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2020-08-15 17:13:55 +0200 |
commit | 51599676667b2b6e81e51fc321a19033a3094773 (patch) | |
tree | c35dbbfd3f79a648f59bb38ad5c5c8de96f5112b /vcl | |
parent | f3872785bd182e47ef9530770fb635d7e79e3f59 (diff) |
remove constructor with plain Bitmap from Graphic, use BitmapEx
Change-Id: Ie429a10a8f54c6779d437ee4bc75a5ea0c427848
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100727
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/graphic/Manager.hxx | 1 | ||||
-rw-r--r-- | vcl/inc/impgraph.hxx | 6 | ||||
-rw-r--r-- | vcl/qa/cppunit/BackendTest.cxx | 2 | ||||
-rw-r--r-- | vcl/qa/cppunit/BitmapFilterTest.cxx | 4 | ||||
-rw-r--r-- | vcl/qa/cppunit/BitmapScaleTest.cxx | 16 | ||||
-rw-r--r-- | vcl/qa/cppunit/graphicfilter/filters-test.cxx | 2 | ||||
-rw-r--r-- | vcl/source/bitmap/bitmap.cxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/igif/gifread.cxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/ixpm/xpmread.cxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/jpeg/JpegReader.cxx | 6 | ||||
-rw-r--r-- | vcl/source/gdi/graph.cxx | 5 | ||||
-rw-r--r-- | vcl/source/gdi/impgraph.cxx | 11 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl2.cxx | 2 | ||||
-rw-r--r-- | vcl/source/graphic/GraphicObject2.cxx | 4 | ||||
-rw-r--r-- | vcl/source/graphic/Manager.cxx | 7 |
15 files changed, 22 insertions, 50 deletions
diff --git a/vcl/inc/graphic/Manager.hxx b/vcl/inc/graphic/Manager.hxx index 8b21f1c46105..73a6676e4d7b 100644 --- a/vcl/inc/graphic/Manager.hxx +++ b/vcl/inc/graphic/Manager.hxx @@ -58,7 +58,6 @@ public: std::shared_ptr<ImpGraphic> copy(std::shared_ptr<ImpGraphic> const& pImpGraphic); std::shared_ptr<ImpGraphic> newInstance(); - std::shared_ptr<ImpGraphic> newInstance(const Bitmap& rBitmap); std::shared_ptr<ImpGraphic> newInstance(const BitmapEx& rBitmapEx); std::shared_ptr<ImpGraphic> newInstance(const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr); diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx index 749a5b82a12e..8b3cc14b7f2d 100644 --- a/vcl/inc/impgraph.hxx +++ b/vcl/inc/impgraph.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_VCL_INC_IMPGRAPH_HXX -#define INCLUDED_VCL_INC_IMPGRAPH_HXX +#pragma once #include <vcl/dllapi.h> #include <vcl/GraphicExternalLink.hxx> @@ -83,7 +82,6 @@ public: ImpGraphic( const ImpGraphic& rImpGraphic ); ImpGraphic( ImpGraphic&& rImpGraphic ) noexcept; ImpGraphic( const GraphicExternalLink& rExternalLink); - ImpGraphic( const Bitmap& rBmp ); ImpGraphic( const BitmapEx& rBmpEx ); ImpGraphic(const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr); ImpGraphic( const Animation& rAnimation ); @@ -209,6 +207,4 @@ public: OUString getSwapFileURL(); }; -#endif // INCLUDED_VCL_INC_IMPGRAPH_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qa/cppunit/BackendTest.cxx b/vcl/qa/cppunit/BackendTest.cxx index 68ddebb4380b..7a9cf89fceaf 100644 --- a/vcl/qa/cppunit/BackendTest.cxx +++ b/vcl/qa/cppunit/BackendTest.cxx @@ -41,7 +41,7 @@ class BackendTest : public test::BootstrapFixture Bitmap aBitmap(rBitmap); aBitmap.Scale(Size(128, 128), BmpScaleFlag::Fast); SvFileStream aStream(rsFilename, StreamMode::WRITE | StreamMode::TRUNC); - GraphicFilter::GetGraphicFilter().compressAsPNG(aBitmap, aStream); + GraphicFilter::GetGraphicFilter().compressAsPNG(BitmapEx(aBitmap), aStream); } } diff --git a/vcl/qa/cppunit/BitmapFilterTest.cxx b/vcl/qa/cppunit/BitmapFilterTest.cxx index a519da24ed9b..12b32bc316f7 100644 --- a/vcl/qa/cppunit/BitmapFilterTest.cxx +++ b/vcl/qa/cppunit/BitmapFilterTest.cxx @@ -69,7 +69,7 @@ private: { SvFileStream aStream(sWhere, StreamMode::WRITE | StreamMode::TRUNC); GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); - rFilter.compressAsPNG(rBmp, aStream); + rFilter.compressAsPNG(BitmapEx(rBmp), aStream); } }; @@ -201,7 +201,7 @@ void BitmapFilterTest::testPerformance() std::unique_ptr<SvFileStream> pStream( new SvFileStream("~/BlurBigPerformance.png", StreamMode::WRITE | StreamMode::TRUNC)); GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); - rFilter.compressAsPNG(aResult, *pStream); + rFilter.compressAsPNG(BitmapEx(aResult), *pStream); pStream.reset(new SvFileStream("~/BlurBigPerformance.txt", StreamMode::WRITE)); pStream->WriteOString("Blur average time: "); diff --git a/vcl/qa/cppunit/BitmapScaleTest.cxx b/vcl/qa/cppunit/BitmapScaleTest.cxx index f73d54f6174d..277e42adbe1b 100644 --- a/vcl/qa/cppunit/BitmapScaleTest.cxx +++ b/vcl/qa/cppunit/BitmapScaleTest.cxx @@ -146,14 +146,14 @@ void BitmapScaleTest::testScale() { SvFileStream aStream("~/scale_before.png", StreamMode::WRITE | StreamMode::TRUNC); GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); - rFilter.compressAsPNG(bitmap, aStream); + rFilter.compressAsPNG(BitmapEx(bitmap), aStream); } CPPUNIT_ASSERT(bitmap.Scale(scaleSize.destSize, scaleMethod)); if (bExportBitmap) { SvFileStream aStream("~/scale_after.png", StreamMode::WRITE | StreamMode::TRUNC); GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); - rFilter.compressAsPNG(bitmap, aStream); + rFilter.compressAsPNG(BitmapEx(bitmap), aStream); } CPPUNIT_ASSERT_EQUAL(scaleSize.destSize, bitmap.GetSizePixel()); const int lastW = scaleSize.destSize.getWidth() - 1; @@ -215,7 +215,7 @@ void BitmapScaleTest::testScale2() { SvFileStream aStream("scale_before.png", StreamMode::WRITE | StreamMode::TRUNC); GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); - rFilter.compressAsPNG(aBitmap24Bit, aStream); + rFilter.compressAsPNG(BitmapEx(aBitmap24Bit), aStream); } // Scale - 65x65 @@ -228,7 +228,7 @@ void BitmapScaleTest::testScale2() { SvFileStream aStream("scale_after_65x65.png", StreamMode::WRITE | StreamMode::TRUNC); GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); - rFilter.compressAsPNG(aScaledBitmap, aStream); + rFilter.compressAsPNG(BitmapEx(aScaledBitmap), aStream); } CPPUNIT_ASSERT_EQUAL(static_cast<long>(65), aScaledBitmap.GetSizePixel().Width()); @@ -245,7 +245,7 @@ void BitmapScaleTest::testScale2() { SvFileStream aStream("scale_after_64x64.png", StreamMode::WRITE | StreamMode::TRUNC); GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); - rFilter.compressAsPNG(aScaledBitmap, aStream); + rFilter.compressAsPNG(BitmapEx(aScaledBitmap), aStream); } CPPUNIT_ASSERT_EQUAL(static_cast<long>(64), aScaledBitmap.GetSizePixel().Width()); @@ -262,7 +262,7 @@ void BitmapScaleTest::testScale2() { SvFileStream aStream("scale_after_63x63.png", StreamMode::WRITE | StreamMode::TRUNC); GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); - rFilter.compressAsPNG(aScaledBitmap, aStream); + rFilter.compressAsPNG(BitmapEx(aScaledBitmap), aStream); } CPPUNIT_ASSERT_EQUAL(static_cast<long>(63), aScaledBitmap.GetSizePixel().Width()); @@ -297,7 +297,7 @@ void BitmapScaleTest::testScaleSymmetry() { SvFileStream aStream("~/scale_before.png", StreamMode::WRITE | StreamMode::TRUNC); GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); - rFilter.compressAsPNG(aBitmap24Bit, aStream); + rFilter.compressAsPNG(BitmapEx(aBitmap24Bit), aStream); } aBitmap24Bit.Scale(2, 2, BmpScaleFlag::Fast); @@ -313,7 +313,7 @@ void BitmapScaleTest::testScaleSymmetry() { SvFileStream aStream("~/scale_after.png", StreamMode::WRITE | StreamMode::TRUNC); GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); - rFilter.compressAsPNG(aBitmap24Bit, aStream); + rFilter.compressAsPNG(BitmapEx(aBitmap24Bit), aStream); } } diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx index 26f743cfa311..bc745fc530f8 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx @@ -116,7 +116,7 @@ void VclFiltersTest::checkExportImport(const OUString& aFilterShortName) aFilterData[ 2 ].Value <<= sal_Int32(90); sal_uInt16 aFilterType = mpGraphicFilter->GetExportFormatNumberForShortName(aFilterShortName); - mpGraphicFilter->ExportGraphic( aBitmap, OUString(), aStream, aFilterType, &aFilterData ); + mpGraphicFilter->ExportGraphic(BitmapEx(aBitmap), OUString(), aStream, aFilterType, &aFilterData ); CPPUNIT_ASSERT(aStream.Tell() > 0); diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx index 242f4a3a958c..dfa50e29e592 100644 --- a/vcl/source/bitmap/bitmap.cxx +++ b/vcl/source/bitmap/bitmap.cxx @@ -124,7 +124,7 @@ void savePNG(const OUString& sWhere, const Bitmap& rBmp) { SvFileStream aStream(sWhere, StreamMode::WRITE | StreamMode::TRUNC); GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); - rFilter.compressAsPNG(rBmp, aStream); + rFilter.compressAsPNG(BitmapEx(rBmp), aStream); } } diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx index 045a6de0571e..f2ad9bd1132c 100644 --- a/vcl/source/filter/igif/gifread.cxx +++ b/vcl/source/filter/igif/gifread.cxx @@ -712,7 +712,7 @@ Graphic GIFReader::GetIntermediateGraphic() bStatus = bStatus && pAcc1; } else - aImGraphic = aBmp8; + aImGraphic = BitmapEx(aBmp8); pAcc8 = BitmapScopedWriteAccess(aBmp8); bStatus = bStatus && pAcc8; diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx index fa71bfa3cb75..1e47bfe9d765 100644 --- a/vcl/source/filter/ixpm/xpmread.cxx +++ b/vcl/source/filter/ixpm/xpmread.cxx @@ -254,7 +254,7 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic ) } else { - rGraphic = maBmp; + rGraphic = BitmapEx(maBmp); } eReadState = XPMREAD_OK; } diff --git a/vcl/source/filter/jpeg/JpegReader.cxx b/vcl/source/filter/jpeg/JpegReader.cxx index cd378f4a855f..0ea4ef493886 100644 --- a/vcl/source/filter/jpeg/JpegReader.cxx +++ b/vcl/source/filter/jpeg/JpegReader.cxx @@ -269,12 +269,12 @@ Graphic JPEGReader::CreateIntermediateGraphic(long nLines) } else { - aGraphic = *mpBitmap; + aGraphic = BitmapEx(*mpBitmap); } } else { - aGraphic = *mpBitmap; + aGraphic = BitmapEx(*mpBitmap); } mnLastLines = nLines; @@ -304,7 +304,7 @@ ReadState JPEGReader::Read( Graphic& rGraphic, GraphicFilterImportFlags nImportF else { if (!bUseExistingBitmap) - rGraphic = *mpBitmap; + rGraphic = BitmapEx(*mpBitmap); } bRet = true; diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index 05ad9657d8d9..b88aaf0e9f3f 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -182,11 +182,6 @@ Graphic::Graphic(GraphicExternalLink const & rGraphicExternalLink) { } -Graphic::Graphic(const Bitmap& rBmp) - : mxImpGraphic(vcl::graphic::Manager::get().newInstance(rBmp)) -{ -} - Graphic::Graphic(const BitmapEx& rBmpEx) : mxImpGraphic(vcl::graphic::Manager::get().newInstance(rBmpEx)) { diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 925ec4a34952..c40a344ba1da 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -186,17 +186,6 @@ ImpGraphic::ImpGraphic(GraphicExternalLink const & rGraphicExternalLink) : { } -ImpGraphic::ImpGraphic( const Bitmap& rBitmap ) : - maBitmapEx ( rBitmap ), - meType ( !rBitmap.IsEmpty() ? GraphicType::Bitmap : GraphicType::NONE ), - mnSizeBytes ( 0 ), - mbSwapOut ( false ), - mbDummyContext ( false ), - maLastUsed (std::chrono::high_resolution_clock::now()), - mbPrepared (false) -{ -} - ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) : maBitmapEx ( rBitmapEx ), meType ( !rBitmapEx.IsEmpty() ? GraphicType::Bitmap : GraphicType::NONE ), diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index c8e5847aaa4d..177a8772c304 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -204,7 +204,7 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz else aMask = aBitmapEx.GetMask(); } - Graphic aGraphic( aBitmapEx.GetBitmap() ); + Graphic aGraphic(BitmapEx(aBitmapEx.GetBitmap())); Sequence< PropertyValue > aFilterData( 2 ); aFilterData[ 0 ].Name = "Quality"; diff --git a/vcl/source/graphic/GraphicObject2.cxx b/vcl/source/graphic/GraphicObject2.cxx index dc60db55dd3f..d858b47b8f34 100644 --- a/vcl/source/graphic/GraphicObject2.cxx +++ b/vcl/source/graphic/GraphicObject2.cxx @@ -308,9 +308,9 @@ bool GraphicObject::ImplDrawTiled( OutputDevice* pOut, const tools::Rectangle& r GraphicObject aAlphaGraphic; if( GetGraphic().IsAlpha() ) - aAlphaGraphic.SetGraphic( GetGraphic().GetBitmapEx().GetAlpha().GetBitmap() ); + aAlphaGraphic.SetGraphic(BitmapEx(GetGraphic().GetBitmapEx().GetAlpha().GetBitmap())); else - aAlphaGraphic.SetGraphic( GetGraphic().GetBitmapEx().GetMask() ); + aAlphaGraphic.SetGraphic(BitmapEx(GetGraphic().GetBitmapEx().GetMask())); if( aAlphaGraphic.ImplRenderTempTile( *aVDev, nNumTilesInCacheX, nNumTilesInCacheY, rSizePixel, pAttr ) ) diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx index 65e81fc1e605..7a25f8e41b04 100644 --- a/vcl/source/graphic/Manager.cxx +++ b/vcl/source/graphic/Manager.cxx @@ -178,13 +178,6 @@ std::shared_ptr<ImpGraphic> Manager::newInstance() return pReturn; } -std::shared_ptr<ImpGraphic> Manager::newInstance(const Bitmap& rBitmap) -{ - auto pReturn = std::make_shared<ImpGraphic>(rBitmap); - registerGraphic(pReturn, "Bitmap"); - return pReturn; -} - std::shared_ptr<ImpGraphic> Manager::newInstance(const BitmapEx& rBitmapEx) { auto pReturn = std::make_shared<ImpGraphic>(rBitmapEx); |