summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-04-19 12:09:02 +0200
committerLuboš Luňák <l.lunak@collabora.com>2021-04-19 16:50:51 +0200
commitcbf98d15ebfdeb61d5b797b21442761c76cb5f02 (patch)
tree001e1ac0c64c3b31f0562b2598dd7a33b69032e0 /vcl
parent6a0a0a4d78bb8850bf4a304b83784d3822895efe (diff)
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 <l.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qa/cppunit/GraphicTest.cxx9
-rw-r--r--vcl/source/filter/png/PngImageReader.cxx3
2 files changed, 11 insertions, 1 deletions
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;