From e1d0846e060d2b3faedfe1a5877303037d8cf4d6 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Fri, 5 Mar 2021 19:55:43 +0100 Subject: drop PNGReader and use only PngImageReader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Luboš Luňák --- sfx2/source/control/recentdocsview.cxx | 6 +++--- sfx2/source/control/thumbnailview.cxx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index d137d366837c..ca822d0c3487 100644 --- a/sfx2/source/control/recentdocsview.cxx +++ b/sfx2/source/control/recentdocsview.cxx @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -264,8 +264,8 @@ void RecentDocsView::Reload() comphelper::Base64::decode(aDecoded, aBase64); SvMemoryStream aStream(aDecoded.getArray(), aDecoded.getLength(), StreamMode::READ); - vcl::PNGReader aReader(aStream); - aThumbnail = aReader.Read(); + vcl::PngImageReader aReader(aStream); + aThumbnail = aReader.read(); } else { INetURLObject aUrl(aURL); diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index 071e73f54c9c..f9624027755e 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include @@ -138,8 +138,8 @@ BitmapEx ThumbnailView::readThumbnail(const OUString &msURL) { std::unique_ptr pStream ( ::utl::UcbStreamHelper::CreateStream (xIStream)); - vcl::PNGReader aReader (*pStream); - aThumbnail = aReader.Read (); + vcl::PngImageReader aReader (*pStream); + aThumbnail = aReader.read (); } // Note that the preview is returned without scaling it to the desired -- cgit