summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-04-27 17:10:06 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-04-28 06:45:26 +0200
commit1b85a555d3ee618b542dce414687c97f934b8b56 (patch)
treeaa6c8545fa1e7d08e6409fe8f0325e4921e1a51b /sd
parentafe99617707c92460e66486c0057ef327e8aa017 (diff)
tdf#155048: forward AntiAliasing to drawinglayer also in temporary case
Commit 444bf8710d5da7b584fbcb94693e4ed8d2e29297 (Update handling of AntiAliasing settings and processor2d, 2022-11-08) made respective changes so that SvtOptionsDrawinglayer::SetAntiAliasing forwards the setting to drawinglayer. However, it only happened in non-temporary case, which is fixed now. Change-Id: I66f5630dde759e3a3aa305ef38f60c8e24e6330e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151109 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/PNGExportTests.cxx66
-rw-r--r--sd/qa/unit/data/odg/diagonalLine.fodg39
2 files changed, 105 insertions, 0 deletions
diff --git a/sd/qa/unit/PNGExportTests.cxx b/sd/qa/unit/PNGExportTests.cxx
index dcbe54054bd6..b3863c8b9622 100644
--- a/sd/qa/unit/PNGExportTests.cxx
+++ b/sd/qa/unit/PNGExportTests.cxx
@@ -461,4 +461,70 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf99729)
nonwhitecounts[1]);
}
+CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf155048)
+{
+ loadFromURL(u"odg/diagonalLine.fodg");
+
+ auto xGraphicExporter = drawing::GraphicExportFilter::create(getComponentContext());
+ CPPUNIT_ASSERT(xGraphicExporter);
+
+ auto xSupplier = mxComponent.queryThrow<css::drawing::XDrawPagesSupplier>();
+ auto xPage = xSupplier->getDrawPages()->getByIndex(0).queryThrow<css::lang::XComponent>();
+ xGraphicExporter->setSourceDocument(xPage);
+
+ // 1. AA disabled
+ {
+ css::uno::Sequence<css::beans::PropertyValue> aFilterData{
+ comphelper::makePropertyValue("PixelWidth", sal_Int32(200)),
+ comphelper::makePropertyValue("PixelHeight", sal_Int32(200)),
+ comphelper::makePropertyValue("AntiAliasing", false),
+ };
+
+ css::uno::Sequence<css::beans::PropertyValue> aDescriptor{
+ comphelper::makePropertyValue("URL", maTempFile.GetURL()),
+ comphelper::makePropertyValue("FilterName", OUString("PNG")),
+ comphelper::makePropertyValue("FilterData", aFilterData)
+ };
+
+ xGraphicExporter->filter(aDescriptor);
+
+ BitmapEx bmp = vcl::PngImageReader(*maTempFile.GetStream(StreamMode::READ)).read();
+ std::set<Color> foundColors;
+ for (tools::Long x = 0; x < bmp.GetSizePixel().Width(); ++x)
+ for (tools::Long y = 0; y < bmp.GetSizePixel().Height(); ++y)
+ foundColors.insert(bmp.GetPixelColor(x, y));
+
+ // There must be only two colors (white and blue) in the bitmap generated without AA
+ CPPUNIT_ASSERT_EQUAL(size_t(2), foundColors.size());
+ maTempFile.CloseStream();
+ }
+
+ // 2. AA enabled
+ {
+ css::uno::Sequence<css::beans::PropertyValue> aFilterData{
+ comphelper::makePropertyValue("PixelWidth", sal_Int32(200)),
+ comphelper::makePropertyValue("PixelHeight", sal_Int32(200)),
+ comphelper::makePropertyValue("AntiAliasing", true),
+ };
+
+ css::uno::Sequence<css::beans::PropertyValue> aDescriptor{
+ comphelper::makePropertyValue("URL", maTempFile.GetURL()),
+ comphelper::makePropertyValue("FilterName", OUString("PNG")),
+ comphelper::makePropertyValue("FilterData", aFilterData)
+ };
+
+ xGraphicExporter->filter(aDescriptor);
+
+ BitmapEx bmp = vcl::PngImageReader(*maTempFile.GetStream(StreamMode::READ)).read();
+ std::set<Color> foundColors;
+ for (tools::Long x = 0; x < bmp.GetSizePixel().Width(); ++x)
+ for (tools::Long y = 0; y < bmp.GetSizePixel().Height(); ++y)
+ foundColors.insert(bmp.GetPixelColor(x, y));
+
+ // With AA, the number of colors will be greater - it is 19 on my system
+ CPPUNIT_ASSERT_GREATER(size_t(2), foundColors.size());
+ maTempFile.CloseStream();
+ }
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/qa/unit/data/odg/diagonalLine.fodg b/sd/qa/unit/data/odg/diagonalLine.fodg
new file mode 100644
index 000000000000..f6f8edec46bc
--- /dev/null
+++ b/sd/qa/unit/data/odg/diagonalLine.fodg
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.graphics">
+ <office:styles>
+ <draw:marker draw:name="Arrowheads_20_1" draw:display-name="Arrowheads 1" svg:viewBox="0 0 20 20" svg:d="M0 20l10-20 10 20z"/>
+ <style:style style:name="standard" style:family="graphic">
+ <style:graphic-properties draw:stroke="solid" svg:stroke-width="0cm" svg:stroke-color="#3465a4" draw:marker-start-width="0.2cm" draw:marker-start-center="false" draw:marker-end-width="0.2cm" draw:marker-end-center="false" draw:fill="none"/>
+ </style:style>
+ </office:styles>
+ <office:automatic-styles>
+ <style:page-layout style:name="PM0">
+ <style:page-layout-properties fo:margin-top="1cm" fo:margin-bottom="1cm" fo:margin-left="1cm" fo:margin-right="1cm" fo:page-width="5cm" fo:page-height="5cm" style:print-orientation="portrait"/>
+ </style:page-layout>
+ <style:style style:name="dp1" style:family="drawing-page">
+ <style:drawing-page-properties draw:background-size="border" draw:fill="none"/>
+ </style:style>
+ <style:style style:name="dp2" style:family="drawing-page"/>
+ <style:style style:name="gr1" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties svg:stroke-width="0cm" draw:marker-end="Arrowheads_20_1" draw:fill="none" draw:textarea-vertical-align="middle"/>
+ </style:style>
+ </office:automatic-styles>
+ <office:master-styles>
+ <draw:layer-set>
+ <draw:layer draw:name="layout"/>
+ <draw:layer draw:name="background"/>
+ <draw:layer draw:name="backgroundobjects"/>
+ <draw:layer draw:name="controls"/>
+ <draw:layer draw:name="measurelines"/>
+ </draw:layer-set>
+ <style:master-page style:name="Default" style:page-layout-name="PM0" draw:style-name="dp1"/>
+ </office:master-styles>
+ <office:body>
+ <office:drawing>
+ <draw:page draw:name="page1" draw:style-name="dp2" draw:master-page-name="Default">
+ <draw:line draw:style-name="gr1" draw:layer="layout" svg:x1="1cm" svg:y1="4cm" svg:x2="4cm" svg:y2="1cm"/>
+ </draw:page>
+ </office:drawing>
+ </office:body>
+</office:document> \ No newline at end of file