[Libreoffice-commits] core.git: vcl/source

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 7 15:28:58 UTC 2021


 vcl/source/filter/graphicfilter.cxx |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 85d072442f7445d13dfbbacd7985f6e1df38f57e
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Jan 5 16:41:22 2021 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu Jan 7 16:28:04 2021 +0100

    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 at collabora.com>

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;


More information about the Libreoffice-commits mailing list