summaryrefslogtreecommitdiff
path: root/svx/source/xml
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-04-14 15:13:05 +0900
committerTomaž Vajngerl <quikee@gmail.com>2018-04-20 09:15:22 +0200
commit7b355669c6ddeab2e6cec692d6afdff41c61d0fb (patch)
tree46c55326bccfa68a2bb5fad6d637e0f4576c8d68 /svx/source/xml
parent663fd3d6e1f93ec989dc289e688d5dbfe434cbca (diff)
Function to load graphic swapped out (loaded on demand)
When a document is loaded it takes a lot of time and memory to load the graphic that are in the documet, so avoid that and just store the compressed graphic into a temporary file (handeled by GfxLink) and load when we really need to show the graphic. GraphicObject cached some attributes from Graphic, but this attributes now aren't available immediately so this attributes are removed form GraphicObject and now delegate to the Graphic itself. GetSizeBytes attribute however was removed as it is only used in some tests. GfxLink initial values were moved to the constructor and are not set in the header file anymore (as it is the recommended way to do it). The SdImportTest::testDocumentLayout failed as it looks like the dump sometimes didn't include the width and height of the null bitmap (which is set to 32x32) of the FillBitmap in some situations, but then in other situations it did include this attributes. With this change the width and height are always included for the FillBitmap which looks like it is more correct. Change-Id: Ia1218f93b1735402b7828404f65660e2d4acf32f Reviewed-on: https://gerrit.libreoffice.org/53016 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx/source/xml')
-rw-r--r--svx/source/xml/xmlgrhlp.cxx15
1 files changed, 10 insertions, 5 deletions
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index e420cc103274..971402aea6b0 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -493,15 +493,20 @@ OUString SvXMLGraphicHelper::ImplGetGraphicMimeType( const OUString& rFileName )
Graphic SvXMLGraphicHelper::ImplReadGraphic( const OUString& rPictureStorageName,
const OUString& rPictureStreamName )
{
- Graphic aGraphic;
+ Graphic aReturnGraphic;
SvxGraphicHelperStream_Impl aStream( ImplGetGraphicStream( rPictureStorageName, rPictureStreamName ) );
- if( aStream.xStream.is() )
+ if (aStream.xStream.is())
{
- std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream( aStream.xStream ));
- GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, "", *pStream );
+ GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();
+ std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(aStream.xStream));
+ Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(*pStream);
+ if (aGraphic)
+ aReturnGraphic = aGraphic;
+ else
+ rGraphicFilter.ImportGraphic(aReturnGraphic, "", *pStream);
}
- return aGraphic;
+ return aReturnGraphic;
}
void SvXMLGraphicHelper::Init( const uno::Reference < embed::XStorage >& rXMLStorage,