diff options
-rw-r--r-- | include/vcl/graph.hxx | 1 | ||||
-rw-r--r-- | vcl/inc/graphic/Manager.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/impgraph.hxx | 1 | ||||
-rw-r--r-- | vcl/source/filter/ipdf/pdfread.cxx | 6 | ||||
-rw-r--r-- | vcl/source/gdi/graph.cxx | 5 | ||||
-rw-r--r-- | vcl/source/gdi/impgraph.cxx | 17 | ||||
-rw-r--r-- | vcl/source/graphic/Manager.cxx | 8 |
7 files changed, 36 insertions, 5 deletions
diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx index 86d885a326ac..79083bb5a224 100644 --- a/include/vcl/graph.hxx +++ b/include/vcl/graph.hxx @@ -89,6 +89,7 @@ public: SAL_DLLPRIVATE ImpGraphic* ImplGetImpGraphic() const { return mxImpGraphic.get(); } Graphic(); + Graphic(std::shared_ptr<GfxLink> const & rGfxLink, sal_Int32 nPageIndex = 0); Graphic( const GraphicExternalLink& rGraphicLink ); Graphic( const Graphic& rGraphic ); Graphic( Graphic&& rGraphic ) noexcept; diff --git a/vcl/inc/graphic/Manager.hxx b/vcl/inc/graphic/Manager.hxx index 098c8644ac61..4319620e21c4 100644 --- a/vcl/inc/graphic/Manager.hxx +++ b/vcl/inc/graphic/Manager.hxx @@ -17,6 +17,7 @@ #include <vcl/vectorgraphicdata.hxx> #include <vcl/timer.hxx> #include <vcl/GraphicExternalLink.hxx> +#include <vcl/gfxlink.hxx> #include <memory> #include <mutex> @@ -60,6 +61,8 @@ public: std::shared_ptr<ImpGraphic> copy(std::shared_ptr<ImpGraphic> const& pImpGraphic); std::shared_ptr<ImpGraphic> newInstance(); std::shared_ptr<ImpGraphic> newInstance(const BitmapEx& rBitmapEx); + std::shared_ptr<ImpGraphic> newInstance(std::shared_ptr<GfxLink> const& rLink, + sal_Int32 nPageIndex = 0); std::shared_ptr<ImpGraphic> newInstance(const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr); std::shared_ptr<ImpGraphic> newInstance(const Animation& rAnimation); diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx index 2ee0e9ef61ec..6287be0df1b1 100644 --- a/vcl/inc/impgraph.hxx +++ b/vcl/inc/impgraph.hxx @@ -90,6 +90,7 @@ public: ImpGraphic( const ImpGraphic& rImpGraphic ); ImpGraphic( ImpGraphic&& rImpGraphic ) noexcept; ImpGraphic( const GraphicExternalLink& rExternalLink); + ImpGraphic(std::shared_ptr<GfxLink> const& rGfxLink, sal_Int32 nPageIndex = 0); ImpGraphic( const BitmapEx& rBmpEx ); ImpGraphic(const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr); ImpGraphic( const Animation& rAnimation ); diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index 7a7d1c75aa38..f2730dbfe811 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -474,14 +474,10 @@ size_t ImportPDFUnloaded(const OUString& rURL, std::vector<PDFGraphicResult>& rG tools::Long nPageWidth = convertTwipToMm100(aPageSize.getX() * pointToTwipconversionRatio); tools::Long nPageHeight = convertTwipToMm100(aPageSize.getY() * pointToTwipconversionRatio); - auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>( - aDataContainer, VectorGraphicDataType::Pdf, nPageIndex); - // Create the Graphic with the VectorGraphicDataPtr and link the original PDF stream. // We swap out this Graphic as soon as possible, and a later swap in // actually renders the correct Bitmap on demand. - Graphic aGraphic(aVectorGraphicDataPtr); - aGraphic.SetGfxLink(pGfxLink); + Graphic aGraphic(pGfxLink, nPageIndex); auto pPage = pPdfDocument->openPage(nPageIndex); diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index 033e5576ce20..74a61e871e78 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -177,6 +177,11 @@ Graphic::Graphic(Graphic&& rGraphic) noexcept { } +Graphic::Graphic(std::shared_ptr<GfxLink> const & rGfxLink, sal_Int32 nPageIndex) + : mxImpGraphic(vcl::graphic::Manager::get().newInstance(rGfxLink, nPageIndex)) +{ +} + Graphic::Graphic(GraphicExternalLink const & rGraphicExternalLink) : mxImpGraphic(vcl::graphic::Manager::get().newInstance(rGraphicExternalLink)) { diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 5e53a900a60f..99fe4d8ca63a 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -131,6 +131,23 @@ ImpGraphic::ImpGraphic(ImpGraphic&& rImpGraphic) noexcept rImpGraphic.mbDummyContext = false; } +ImpGraphic::ImpGraphic(std::shared_ptr<GfxLink> const & rGfxLink, sal_Int32 nPageIndex) + : mpGfxLink(rGfxLink) + , meType(GraphicType::Bitmap) + , mnSizeBytes(0) + , mbSwapOut(true) + , mbDummyContext(false) + , maLastUsed (std::chrono::high_resolution_clock::now()) + , mbPrepared (false) +{ + maSwapInfo.mbIsTransparent = true; + maSwapInfo.mbIsAlpha = true; + maSwapInfo.mbIsEPS = false; + maSwapInfo.mbIsAnimated = false; + maSwapInfo.mnAnimationLoopCount = 0; + maSwapInfo.mnPageIndex = nPageIndex; +} + ImpGraphic::ImpGraphic(GraphicExternalLink const & rGraphicExternalLink) : meType ( GraphicType::Default ), mnSizeBytes ( 0 ), diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx index fafca90b5ad8..054a615ef812 100644 --- a/vcl/source/graphic/Manager.cxx +++ b/vcl/source/graphic/Manager.cxx @@ -203,6 +203,14 @@ std::shared_ptr<ImpGraphic> Manager::newInstance() return pReturn; } +std::shared_ptr<ImpGraphic> Manager::newInstance(std::shared_ptr<GfxLink> const& rGfxLink, + sal_Int32 nPageIndex) +{ + auto pReturn = std::make_shared<ImpGraphic>(rGfxLink, nPageIndex); + registerGraphic(pReturn); + return pReturn; +} + std::shared_ptr<ImpGraphic> Manager::newInstance(const BitmapEx& rBitmapEx) { auto pReturn = std::make_shared<ImpGraphic>(rBitmapEx); |