summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2023-06-03 16:31:24 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-06-03 21:24:08 +0200
commit86630bc0245654533a1f6e6713c39dd401a15bb4 (patch)
tree033ba74e4d69ace598ef285fd7d937b006eb8fcc
parent4f69e1b07c12ebd8c3655f3205bff143d1ee1a1b (diff)
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.mcnamara@collabora.com>
-rw-r--r--vcl/source/treelist/iconview.cxx10
1 files changed, 9 insertions, 1 deletions
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());