vcl/source/treelist/iconview.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 86630bc0245654533a1f6e6713c39dd401a15bb4
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sat Jun 3 16:31:24 2023 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sat Jun 3 21:24:08 2023 +0200

    perf: use lighter weight png generation for iconview
    
    before:
    
    |--9.50%--JSDialogNotifyIdle::Invoke
    |          |
    |          |--9.33%--JSDialogNotifyIdle::generateWidgetUpdate
    |          |          IconView::DumpAsPropertyTree
    |          |          lcl_DumpEntryAndSiblings (inlined)
    |          |          |
    |          |          |--8.99%--extractPngString (inlined)
    |          |          |          |
    |          |          |          |--8.21%--GraphicConverter::Export
    |          |          |          |          Link<ConvertData&, bool>::Call 
(inlined)
    |          |          |          |          GraphicFilter::FilterCallback
    |          |          |          |          GraphicFilter::ExportGraphic
    
    after:
    
    |--7.50%--JSDialogNotifyIdle::Invoke
    |          JSDialogNotifyIdle::generateWidgetUpdate
    |          IconView::DumpAsPropertyTree
    |          lcl_DumpEntryAndSiblings (inlined)
    |          |
    |          |--7.16%--extractPngString (inlined)
    |          |          |
    |          |          |--6.84%--vcl::pngWrite
    
    Change-Id: Iae34c8bde3e0bbd075252de356f64557fd80c9ad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152578
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx
index b390fe52682a..568e1070545d 100644
--- a/vcl/source/treelist/iconview.cxx
+++ b/vcl/source/treelist/iconview.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <vcl/filter/PngImageWriter.hxx>
 #include <vcl/toolkit/treelistentry.hxx>
 #include <vcl/toolkit/viewdataentry.hxx>
 #include <iconview.hxx>
@@ -28,6 +29,7 @@
 #include <tools/stream.hxx>
 #include <vcl/cvtgrf.hxx>
 #include <comphelper/base64.hxx>
+#include <comphelper/propertyvalue.hxx>
 
 namespace
 {
@@ -258,7 +260,13 @@ static OString extractPngString(const SvLBoxContextBmp* 
pBmpItem)
 {
     BitmapEx aImage = pBmpItem->GetBitmap1().GetBitmapEx();
     SvMemoryStream aOStm(65535, 65535);
-    if (GraphicConverter::Export(aOStm, aImage, ConvertDataFormat::PNG) == 
ERRCODE_NONE)
+    // Use fastest compression "1"
+    css::uno::Sequence<css::beans::PropertyValue> aFilterData{
+        comphelper::makePropertyValue("Compression", sal_Int32(1)),
+    };
+    vcl::PngImageWriter aPNGWriter(aOStm);
+    aPNGWriter.setParameters(aFilterData);
+    if (aPNGWriter.write(aImage))
     {
         css::uno::Sequence<sal_Int8> aSeq(static_cast<sal_Int8 
const*>(aOStm.GetData()),
                                           aOStm.Tell());

Reply via email to