From 17281e8202d58ee54064a29d8e7de43cc94aa76d Mon Sep 17 00:00:00 2001 From: Zolnai Tamás Date: Fri, 17 Oct 2014 10:06:10 +0200 Subject: All image cleanup related change in one commit for perf test Change-Id: I5baac12f97ea7fa36293844331ca548b7bc2cdfd Always call ImplAfterDataChange() when data is changed Call it inside ImplAssignGraphicData() which assign GraphicObject members using Graphic's data. With that ImplAfterDataChange() method also called in constructors. It's important to call ImplAfterDataChange(), because this will trigger the auto swaping mechanism. Change-Id: I45af91f8df2fb5b0143fcc5eb05e82e4d408d0bc Avoid using null pointer as a special indicator When ImpGraphic::ImplSwapOut() is called with null pointer it was assumed that it is becase the graphic is a link and so we don't need to swap out it actually (we can load it anytime using the link), only clear the graphic's internal data. The problem with that it can happen that ImplSwapOut() is called with null pointer accidentally on a non-link graphic object which leads to that we loose the graphic. Seems more robust to use an explicit indicator (GRFMGR_AUTOSWAPSTREAM_LINK) for links swapout. indicator Change-Id: Icf31524a192c7866278ba6a13eb85648aa69f554 Remove manual SwapOut() call in ODF export We have a good auto swapout mechanism which will prevent excessive memory use. Change-Id: I362f51c724ac31704561abe8b961910f5d490f04 MS export: don't need to manually swapout images after swapin them We have some good auto mechanisms for that. Change-Id: I487dbf4a5fc69c7563dfbc5c21f9ebdb05ba6b9e DOC import: avoid manual swapout call. No reason to swapout the image directly after the import because it will be used for rendering just a second later. Change-Id: I78c8ef9225c55f306182dc5efd7bcaf0e88521c0 Make SetSwapState() an internal method So we can be sure it is always called when user data changed. Change-Id: If107907afffb85a7a57817f5807847a5c028416c Swap in graphic by SwGrfNode and not manually It's a Writer specific problem, that images lost during export because of not swapped in graphic data. Other components (Impress, Calc...) use SdrGrafObj to get the graphic and SdrGrafObj calls swap in before retrun with the graphic. Change-Id: I7398d8e3f6535199b10de048acd58543bdb42531 Avoid an image loss situation of auto swapping Before an image data is used GraphicObject should be swapped in. When a GraphicObject is swapped in auto swapping mechanism is triggered which can swap out some of the images. We should avoid to swap out the same image on which the swap in method was called before because the caller code assumes that the image data is there. Change-Id: Ia4addc370742aea5fbf185cf87e3c062a5ebf5be Assign graphic data also during auto swap in Change-Id: I09b8d11027f4a1e8470b81677388d4a573b372a6 Ignore the swapped in graphic, but use its size Change-Id: I75f17ab5e55119965fcede2b220979cefc1e26ab Remove these useless static bool variables. Change-Id: I7a8ad7814231f129d5d1146ceb36eb2c22b2aff1 More useless static bool variables. Change-Id: If09aa23768f73bbf659966e4e5aac82dca83d1b6 Paint background images always via drawinglayer Painting via GraphicObject is obsolete. See fdo#68927 where the problem was the quality of svg graphics, it seems a good idea to extend this improvement to all graphic type. Change-Id: I57a26d4fcfea8e4f666504a90281365e8a9a7e1d Remove unused IsInSwap() method Change-Id: Ib295bd71b5cf16fd75d04818dfd415ff24cb2655 Printing: remove an other manual swap out call Change-Id: I2b6d6eaa072d9948eb5734e978d68d3bc37701b2 SvxGraphicObject: remove more manual swap out calls Tested with importing large *.rtf and *.docx test documents with lots of images -> auto swapp out works. Change-Id: Ib040edaa89c9bcb966c58b75f0392e6d9f7a165e SdrUndoDelObj: one more manual swap out call This thing seems a good optimization to me, but it would be good to hide all of this swapping thing inside GraphicObject class, to make our code more robust (e.g. no image loss because of missing manual swap in / swap out call). Auto swapping mechanism will take care of that, anyway. Change-Id: I933dafd95597ffff038dc6aeb0a64fcaa3941bd8 Remove duplicated swapping methods Change-Id: I0e61aeb0705ed13872d252ee1594f9ab4aab4f8a ForceSwap{In,Out}Objects methods are unused now They are called only by themselves recuirsively, but not from outside. Change-Id: I1cde392c95bbc60ac7937d0bf3cd4b0fd062568b More unused swapping related methods / member of SdrPage Change-Id: I4a979dd09418df4526409d9026d6abb98c6bf954 Make GetTwipSize() call SwapIn() by itself in case of invalid size Change-Id: I5bc6cf097e61d65007dde531af4a213b19e8ca5b More replacements of manual swapping with SwGrfNode::GetGrf()/GetGrfObj() Change-Id: Ie56584c03af8a6d3ea8f8d4294f5492a841933b7 Be explicit here when to swap out as a link Change-Id: I70dd00d5f82c5f4f622805e1d6ee1dfc30900b31 Remove unused Graphic member of SwOLENode Change-Id: Iaff7e86a8e11e9befc6feacdafd3a78a1971bbcd Swapping Graphic is a privilage of GraphicObject. This means more things: * Graphic won't swap out itself, so those classes which uses Graphic without GraphicObject won't need to deal with swapping. * When a Graphic is queried from GraphicObject the caller won't need to deal with swapping, because GraphicObject swaps it in before return. * GraphicObject will swap in the Graphic always when a swapping dependent data is queried (e.g. whole graphic, transformed graphic or AnimationNotifyHdl) Change-Id: I2bf6e37291ec94146f10aac4a35084682437ed16 Why to have this compromise, do that what we say the users we do. Change-Id: Ia599644ff1f7591ac84bdca988883eaf5860297e Make SwGrfNode swapping methods private Change the filter test accordingly. Conflicts: sw/CppunitTest_sw_globalfilter.mk sw/qa/extras/globalfilter/globalfilter.cxx Change-Id: Ide3043f2f245c097a7b4c07ba2e0713510296b3e Remove some useless swapping call inside SwGrfNode Change-Id: I4cd2677197c7a6cff71e2966c2b2dd2285032c07 Make SdrGrafObj swapping methods private. Plus remove some useless call of them. Change the tests accordingly. Conflicts: sc/qa/unit/data/ods/document_with_two_images.ods sc/qa/unit/subsequent_export-test.cxx sd/qa/unit/export-tests.cxx Change-Id: I47a50b5734d799ac02ee7221c95f82415afb9497 Optimize ImplCheckSizeOfSwappedInGraphics() a bit Store used size as a member so we don't need to recalculate it all the time and no need to use a size map. Change-Id: I1f929c5d3a56f545cef123bda087ecaf8ca0be4a Avoid DelStreamName because it can lead to image loss. See also: f811e628411bda29a76ebb1f72eb107ce67d27f0 The problem is that more images can have the same stream name so we can't decide here when to remove one stream name. Better to leak in the storage as to loose images (actually we already leak here, so) Change-Id: I2c2afe87e024c2521fe22d62126b567931604101 Set back these lines, later it can be useful Removed in: 9dc3b49c891fb9fe45c24de4b7e1e88fe400afe0 Change-Id: Id8cee4e17d214ca0eaa5cd11dc25849e5f68851e Logically dead code related to embedded stream name in SwGrfNode\SdrGrafObj See also: 286e2f5c6ec829bc0987b1be7016699f7ef03e5e Since embedded URL exists until the first swap in these lines are not needed anymore. Change-Id: Ie6bf8efe7808cf42f20f7b4b3f8cb927555c0ea8 Remove now useless setTextEmbeddedGraphicURL() Since this commit: 286e2f5c6ec829bc0987b1be7016699f7ef03e5e it's not necessary to update the package URL. Change-Id: I25c829e9bc0c666838baf19cd60f19938ebb430c --- oox/source/export/drawingml.cxx | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'oox') diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 0629f2c45d33..6b0e4dc73ff0 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -866,19 +866,6 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia ) GraphicType aType = rGraphic.GetType(); if ( aType == GRAPHIC_BITMAP || aType == GRAPHIC_GDIMETAFILE) { - bool bSwapped = rGraphic.IsSwapOut(); - - //Warn rather than just happily swap in because of the comments - //in the sw export filters about needing to go through the - //hairy SwGrfNode::SwapIn which we would subvert by swapping in - //without it knowing about it, so while those ones are fixed we - //probably have to assume that we should ideally be presented - //here with already swapped in graphics. - SAL_WARN_IF(bSwapped, "oox", "attempted to output swapped out graphic"); - - if (bSwapped) - const_cast(rGraphic).SwapIn(); - if ( aType == GRAPHIC_BITMAP ) { GraphicConverter::Export( aStream, rGraphic, CVT_PNG ); @@ -891,9 +878,6 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia ) sMediaType = "image/x-emf"; pExtension = ".emf"; } - - if (bSwapped) - const_cast(rGraphic).SwapOut(); } else { -- cgit v1.2.3