vcl/qa/cppunit/GraphicTest.cxx | 9 +++++++++ vcl/source/filter/png/PngImageReader.cxx | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
New commits: commit cbf98d15ebfdeb61d5b797b21442761c76cb5f02 Author: Luboš Luňák <[email protected]> AuthorDate: Mon Apr 19 12:09:02 2021 +0200 Commit: Luboš Luňák <[email protected]> CommitDate: Mon Apr 19 16:50:51 2021 +0200 do not overwrite bitmap if using existing one for png loading A mistake from b94a2dc95dce8c67ddb9f01f7bd91da2a5759d9c. Change-Id: I2abdb2ed3473823a7f045b051457cdf0f7a348f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114262 Tested-by: Jenkins Reviewed-by: Luboš Luňák <[email protected]> diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx index d323a6cf5869..0f670a4fee36 100644 --- a/vcl/qa/cppunit/GraphicTest.cxx +++ b/vcl/qa/cppunit/GraphicTest.cxx @@ -1239,12 +1239,21 @@ void GraphicTest::testAvailableThreaded() Graphic pngGraphic1 = importUnloadedGraphic(u"TypeDetectionExample.png"); Graphic pngGraphic2 = importUnloadedGraphic(u"testBasicMorphology.png"); std::vector<Graphic*> graphics = { &jpgGraphic1, &jpgGraphic2, &pngGraphic1, &pngGraphic2 }; + std::vector<Size> sizes; for (auto& graphic : graphics) + { CPPUNIT_ASSERT(!graphic->isAvailable()); + sizes.push_back(graphic->GetSizePixel()); + } GraphicFilter& graphicFilter = GraphicFilter::GetGraphicFilter(); graphicFilter.MakeGraphicsAvailableThreaded(graphics); + int i = 0; for (auto& graphic : graphics) + { CPPUNIT_ASSERT(graphic->isAvailable()); + CPPUNIT_ASSERT_EQUAL(sizes[i], graphic->GetSizePixel()); + ++i; + } } } // namespace diff --git a/vcl/source/filter/png/PngImageReader.cxx b/vcl/source/filter/png/PngImageReader.cxx index ff2d8b0a47a0..6631c238629e 100644 --- a/vcl/source/filter/png/PngImageReader.cxx +++ b/vcl/source/filter/png/PngImageReader.cxx @@ -477,7 +477,8 @@ bool ImportPNG(SvStream& rInputStream, Graphic& rGraphic, GraphicFilterImportFla BitmapEx bitmap; if (reader(rInputStream, bitmap, nImportFlags, pAccess, pAlphaAccess)) { - rGraphic = bitmap; + if (!(nImportFlags & GraphicFilterImportFlags::UseExistingBitmap)) + rGraphic = bitmap; return true; } return false; _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
