summaryrefslogtreecommitdiff
path: root/emfio
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2023-04-23 01:37:20 +0200
committerBartosz Kosiorek <gang65@poczta.onet.pl>2023-04-23 17:42:21 +0200
commitce008fa9d8f2752bdfeaeff763aafc774a4b4fb2 (patch)
treeaf5f328a19cda9bd346710a4539a8964dbcb18e5 /emfio
parent2b87376d7e8cc9d5973a8ccd4c9fdf398ebbd2a0 (diff)
tdf#154789 EMF+ Performance boost of the EmfPlusRecordTypeDrawBeziers
There is several benefits of such performance optimization: 1. We are drawing single curve instead of hundreds of small curves. In the loop we are creating single Polygon and outside of the loop we are invoking EMFPPlusDrawPolygon drawing method only once. As https://bugs.documentfoundation.org/attachment.cgi?id=186725 image is using single EmfPlusRecordTypeDrawBeziers EMF+ record with hundreds of curves, with using single EMFPPlusDrawPolygon call, there is no lnger need for individual line creation (e.g. line color, weight, line caps, line joints, line dashes, etc.) - The PDF export performance without optimizations of the https://bugs.documentfoundation.org/attachment.cgi?id=186725: time ./instdir/program/soffice --headless --convert-to "pdf:writer_pdf_Export" --outdir ~ ~/Pobrane/problem.docx real 24m18,471s user 2m56,004s sys 1m37,816 - The PDF export performance with optimizations: real 0m37,527s user 0m37,004s sys 0m0,531s - With Libreoffice 7.5.2 from Ubuntu 22.04, the conversion was crashed. 2. The PDF export for document: https://bugs.documentfoundation.org/attachment.cgi?id=186725 was not working correctly for me. The original image is containing chart. Without optimization, the exported chart was empty. Current export is working correctly, and graph is visible. 3. The standard opening of the document from https://bugs.documentfoundation.org/attachment.cgi?id=186725 is now much faster. The zooming in, move image operations are also noticible faster. Change-Id: Ic77d4c20a462587bb5da4a4df757e30c5ca04fc9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150821 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'emfio')
-rw-r--r--emfio/qa/cppunit/emf/EmfImportTest.cxx28
-rw-r--r--emfio/qa/cppunit/emf/data/TestEmfPlusDrawBeziers.emfbin0 -> 9836 bytes
2 files changed, 28 insertions, 0 deletions
diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index b315a2f69ae4..5f8ad7e18044 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -283,6 +283,34 @@ CPPUNIT_TEST_FIXTURE(Test, testDrawStringWithBrush)
"TIMES NEW ROMAN");
}
+CPPUNIT_TEST_FIXTURE(Test, testEmfPlusDrawBeziers)
+{
+ // tdf#107019 tdf#154789 EMF+ records: DrawBeziers
+ // Check if DrawBeziers is displayed correctly and text is rotated
+ Primitive2DSequence aSequence
+ = parseEmf(u"emfio/qa/cppunit/emf/data/TestEmfPlusDrawBeziers.emf");
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
+ drawinglayer::Primitive2dXmlDump dumper;
+ xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
+ CPPUNIT_ASSERT(pDocument);
+
+ assertXPath(pDocument, aXPathPrefix + "polypolygoncolor", 4);
+ assertXPath(pDocument, aXPathPrefix + "polypolygoncolor[1]", "color", "#000000");
+
+ assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow", 9);
+ assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow[9]/line", "color", "#00ff00");
+
+ assertXPath(pDocument, aXPathPrefix + "transform", 5);
+ assertXPath(pDocument, aXPathPrefix + "transform[1]/textsimpleportion", "fontcolor", "#000000");
+ assertXPath(pDocument, aXPathPrefix + "transform[1]/textsimpleportion", "text", "% Efficiency");
+ assertXPath(pDocument, aXPathPrefix + "transform[1]", "xy11", "0");
+ assertXPath(pDocument, aXPathPrefix + "transform[1]", "xy12", "4");
+ assertXPath(pDocument, aXPathPrefix + "transform[1]", "xy13", "800");
+ assertXPath(pDocument, aXPathPrefix + "transform[1]", "xy21", "-4");
+ assertXPath(pDocument, aXPathPrefix + "transform[1]", "xy22", "0");
+ assertXPath(pDocument, aXPathPrefix + "transform[1]", "xy23", "3195");
+}
+
CPPUNIT_TEST_FIXTURE(Test, testDrawLine)
{
// EMF+ with records: DrawLine
diff --git a/emfio/qa/cppunit/emf/data/TestEmfPlusDrawBeziers.emf b/emfio/qa/cppunit/emf/data/TestEmfPlusDrawBeziers.emf
new file mode 100644
index 000000000000..11f07412168d
--- /dev/null
+++ b/emfio/qa/cppunit/emf/data/TestEmfPlusDrawBeziers.emf
Binary files differ