summaryrefslogtreecommitdiff
path: root/vcl/workben
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-03-05 19:55:43 +0100
committerLuboš Luňák <l.lunak@collabora.com>2021-03-12 15:37:21 +0100
commite1d0846e060d2b3faedfe1a5877303037d8cf4d6 (patch)
treec232b6fcc14b77ff1022a3bc42277c9827324d17 /vcl/workben
parente286bd791bfaa00746ea143303761f76e0af1f0d (diff)
drop PNGReader and use only PngImageReader
PNGReader is a home-made PNG reader that does not use libpng, so it's more code, presumably less optimized and it apparently also doesn't always map colors properly. The only two features it has that PngImageReader doesn't are explicit chunk reading (used only for reading Microsoft's GIF in PNG, I implemented that for PngImageReader in a previous commit), and it loads paletted images as BitmapEx with a palette instead of converting to direct-color 24/32bpp or 8bpp-gray. The latter is even questional if nowadays that's feature or a misfeature, as it saves memory at the expense of speed. I can implement that if somebody misses it. I had to adjust some tests: - CVE-2016-0952-1.png - invalid CRC of the PNG header, neither Gimp nor Gwenview can display that, it should fail - afl-sample-Z_NEED_DICT.png - failure while decompressing data, but the loader considers that only a partially broken image since the header is correct, so it "passes" (like in Gimp or Gwenview) - SdImportTest::testTdf134210() and testPictureWithSchemeColor::Load_Verify_Reload_Verify() need the colors tested changed, because apparently gamma correction or something is now applied correctly, and it wasn't before (again checked the loaded images with Gimp) Change-Id: Id46f8d8a01256daf48ca64264b47c4e609183837 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112042 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/workben')
-rw-r--r--vcl/workben/fftester.cxx6
-rw-r--r--vcl/workben/pngfuzzer.cxx6
-rw-r--r--vcl/workben/vcldemo.cxx1
3 files changed, 6 insertions, 7 deletions
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index 640bd1f54832..7d165d5a5957 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -41,7 +41,7 @@
#include <vcl/dibtools.hxx>
#include <vcl/event.hxx>
#include <vcl/graphicfilter.hxx>
-#include <vcl/pngread.hxx>
+#include <vcl/filter/PngImageReader.hxx>
#include <vcl/svapp.hxx>
#include <vcl/wmf.hxx>
#include <vcl/wrkwin.hxx>
@@ -155,8 +155,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
else if (strcmp(argv[2], "png") == 0)
{
SvFileStream aFileStream(out, StreamMode::READ);
- vcl::PNGReader aReader(aFileStream);
- ret = static_cast<int>(!!aReader.Read());
+ vcl::PngImageReader aReader(aFileStream);
+ ret = static_cast<int>(!!aReader.read());
}
else if (strcmp(argv[2], "bmp") == 0)
{
diff --git a/vcl/workben/pngfuzzer.cxx b/vcl/workben/pngfuzzer.cxx
index 2a3357830007..e5e3c9e8a239 100644
--- a/vcl/workben/pngfuzzer.cxx
+++ b/vcl/workben/pngfuzzer.cxx
@@ -8,7 +8,7 @@
*/
#include <tools/stream.hxx>
-#include <vcl/pngread.hxx>
+#include <vcl/filter/PngImageReader.hxx>
#include "commonfuzzer.hxx"
#include <config_features.h>
@@ -48,8 +48,8 @@ extern "C" void* lo_get_custom_widget_func(const char*)
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ);
- vcl::PNGReader aReader(aStream);
- (void)aReader.Read();
+ vcl::PngImageReader aReader(aStream);
+ (void)aReader.read();
return 0;
}
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index e9df921c293e..e37ac96eba9b 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -39,7 +39,6 @@
#include <tools/urlobj.hxx>
#include <tools/stream.hxx>
#include <vcl/svapp.hxx>
-#include <vcl/pngread.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/virdev.hxx>
#include <vcl/graphicfilter.hxx>