summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2022-03-05 12:37:40 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-03-10 10:33:46 +0100
commit61c5101a95308fe20e684fa72457c867bd115216 (patch)
tree21b1b82d02d724e8ba02a25c432d067569df212c /vcl
parent57041f8214e77d707cf6a13825aed584d9b1e877 (diff)
tdf#136632: Use 'Save transparency' when exporting selected objects for PNG
To avoid some regression, consider that transparency should be enabled by default. So only remove transparency if it's required explicitely. + change QA test since "Translucent" property isn't a bool but a sal_Int32 In officecfg/registry/schema/org/openoffice/Office/Common.xcs: <prop oor:name="Translucent" oor:type="xs:int" oor:nillable="false"> Change-Id: I9bfb6aae8e2e8a31dee82f73a9165989129f222a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131057 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131061 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit 43356e4d9fe022f24265747cb4b0ae2fc3cd3236) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131133
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/filter/png/pngwrite.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/vcl/source/filter/png/pngwrite.cxx b/vcl/source/filter/png/pngwrite.cxx
index 0554a314e83c..e89cbba69a85 100644
--- a/vcl/source/filter/png/pngwrite.cxx
+++ b/vcl/source/filter/png/pngwrite.cxx
@@ -123,6 +123,7 @@ PNGWriterImpl::PNGWriterImpl(const BitmapEx& rBitmapEx,
Bitmap aBmp(aBitmapEx.GetBitmap());
mnMaxChunkSize = std::numeric_limits<sal_uInt32>::max();
+ bool bTranslucent = true;
if (pFilterData)
{
@@ -132,6 +133,13 @@ PNGWriterImpl::PNGWriterImpl(const BitmapEx& rBitmapEx,
rPropVal.Value >>= mnCompLevel;
else if (rPropVal.Name == "Interlaced")
rPropVal.Value >>= mnInterlaced;
+ else if (rPropVal.Name == "Translucent")
+ {
+ tools::Long nTmp = 0;
+ rPropVal.Value >>= nTmp;
+ if (!nTmp)
+ bTranslucent = false;
+ }
else if (rPropVal.Name == "MaxChunkSize")
{
sal_Int32 nVal = 0;
@@ -142,7 +150,7 @@ PNGWriterImpl::PNGWriterImpl(const BitmapEx& rBitmapEx,
}
mnBitsPerPixel = sal_uInt8(vcl::pixelFormatBitCount(aBmp.getPixelFormat()));
- if (aBitmapEx.IsAlpha())
+ if (aBitmapEx.IsAlpha() && bTranslucent)
{
if (mnBitsPerPixel <= 8)
{