summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-01-05 16:41:22 +0100
committerLuboš Luňák <l.lunak@collabora.com>2021-01-07 16:28:04 +0100
commit85d072442f7445d13dfbbacd7985f6e1df38f57e (patch)
treed7faaaa10570220e590ad8a46741ad6cf0b7a70c
parent121f5962fa03055f91d7e81b9ab41476d58278fe (diff)
do not process ImpGraphic twice
Graphic objects share those, and it's ImpGraphic that actually does all the work, so it's enough to process each one once. Change-Id: I771a68e04bf5e1d866ae32973a3096e8d4a82445 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108813 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r--vcl/source/filter/graphicfilter.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 684bb9c02731..635fc88e4627 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1160,7 +1160,12 @@ void GraphicFilter::MakeGraphicsAvailableThreaded(std::vector<Graphic*>& graphic
if(!graphic->isAvailable() && graphic->IsGfxLink()
&& graphic->GetSharedGfxLink()->GetType() == GfxLinkType::NativeJpg
&& graphic->GetSharedGfxLink()->GetDataSize() != 0 )
- toLoad.push_back( graphic );
+ {
+ // Graphic objects share internal ImpGraphic, do not process any of those twice.
+ const auto predicate = [graphic](Graphic* item) { return item->ImplGetImpGraphic() == graphic->ImplGetImpGraphic(); };
+ if( std::find_if(toLoad.begin(), toLoad.end(), predicate ) == toLoad.end())
+ toLoad.push_back( graphic );
+ }
}
if( toLoad.empty())
return;