diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2022-03-05 12:37:40 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-03-07 10:47:41 +0100 |
commit | 43356e4d9fe022f24265747cb4b0ae2fc3cd3236 (patch) | |
tree | f22220016e67e34101a33944d87bec6171a22912 /vcl/source | |
parent | 55f3708c1a03e9e16879dec94793553b7fe25811 (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>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/filter/png/pngwrite.cxx | 10 |
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) { |