external/skia/UnpackedTarball_skia.mk | 3 ++- external/skia/fast-png-write.patch.1 | 15 +++++++++++++++ vcl/skia/SkiaHelper.cxx | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-)
New commits: commit 121f5962fa03055f91d7e81b9ab41476d58278fe Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Mon Jan 4 16:11:53 2021 +0100 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Thu Jan 7 16:27:34 2021 +0100 faster debug dumping for Skia Write out the png images as quickly as possible, with still at least minimal compression. Without compression the debug images are way too big, but otherwise it's preferred that this is fast (especially when possibly dumping thousands of images). Skia's PNG code ignores the quality and hardcodes the libpng defaults, so patch Skia to explicitly handle the quality we want. It'd be also possible to use SkPngEncoder directly, but SkImage makes it non-trivial to get at the pixel data if it's on the GPU, and the internal getROPixels() invoked by encodeToData() also caches the content, so be lazy and patch Skia. Change-Id: I09cc61115246de4fc9d076953eb7fec8140c32cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108668 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/external/skia/UnpackedTarball_skia.mk b/external/skia/UnpackedTarball_skia.mk index 319b33716a96..946750730edb 100644 --- a/external/skia/UnpackedTarball_skia.mk +++ b/external/skia/UnpackedTarball_skia.mk @@ -36,7 +36,8 @@ skia_patches := \ c++20.patch.0 \ constexpr-debug-std-max.patch.1 \ swap-buffers-rect.patch.1 \ - ubsan.patch.0 + ubsan.patch.0 \ + fast-png-write.patch.1 \ $(eval $(call gb_UnpackedTarball_set_patchlevel,skia,1)) diff --git a/external/skia/fast-png-write.patch.1 b/external/skia/fast-png-write.patch.1 new file mode 100644 index 000000000000..f47a2af70460 --- /dev/null +++ b/external/skia/fast-png-write.patch.1 @@ -0,0 +1,15 @@ +diff --git a/src/images/SkImageEncoder.cpp b/src/images/SkImageEncoder.cpp +index a96a93e0fc..1c110afa58 100644 +--- a/src/images/SkImageEncoder.cpp ++++ b/src/images/SkImageEncoder.cpp +@@ -46,6 +46,10 @@ bool SkEncodeImage(SkWStream* dst, const SkPixmap& src, + } + case SkEncodedImageFormat::kPNG: { + SkPngEncoder::Options opts; ++ if (quality == 1) { ++ opts.fFilterFlags = SkPngEncoder::FilterFlag::kNone; ++ opts.fZLibLevel = 1; ++ } + return SkPngEncoder::Encode(dst, src, opts); + } + case SkEncodedImageFormat::kWEBP: { diff --git a/vcl/skia/SkiaHelper.cxx b/vcl/skia/SkiaHelper.cxx index 6d76d1dfce65..b2da1e4b1ef8 100644 --- a/vcl/skia/SkiaHelper.cxx +++ b/vcl/skia/SkiaHelper.cxx @@ -620,7 +620,7 @@ void dump(const sk_sp<SkSurface>& surface, const char* file) void dump(const sk_sp<SkImage>& image, const char* file) { - sk_sp<SkData> data = image->encodeToData(); + sk_sp<SkData> data = image->encodeToData(SkEncodedImageFormat::kPNG, 1); std::ofstream ostream(file, std::ios::binary); ostream.write(static_cast<const char*>(data->data()), data->size()); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits