summaryrefslogtreecommitdiff
path: root/emfio
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2023-04-23 01:37:20 +0200
committerAndras Timar <andras.timar@collabora.com>2023-05-13 20:05:24 +0200
commit8e7f4aae4d150cca5db9e2dbe539e41a7d8ad875 (patch)
tree7d5f41e7f665d1d154265bdd5e53043af65d01bb /emfio
parentfb73c157bab6ad737a3610d6edcf6c310bc13477 (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. 4. Implementation is according to [MS-EMFPLUS] documentation of the EmfPlusDrawBeziers, which states: "The ending coordinate of one Bezier curve is the starting coordinate of the next. The control points are used for producing the Bezier effect." 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> (cherry picked from commit ce008fa9d8f2752bdfeaeff763aafc774a4b4fb2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150788 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'emfio')
-rw-r--r--emfio/qa/cppunit/emf/EmfImportTest.cxx30
-rw-r--r--emfio/qa/cppunit/emf/data/TestEmfPlusDrawBeziers.emfbin0 -> 9836 bytes
2 files changed, 30 insertions, 0 deletions
diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index e858fd7afc4d..930e4f0961dc 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -47,6 +47,7 @@ class Test : public UnoApiXmlTest
void TestDrawStringAlign();
void TestDrawStringTransparent();
void TestDrawStringWithBrush();
+ void TestEmfPlusDrawBeziers();
void TestDrawLine();
void TestDrawLineWithCaps();
void TestDrawLineWithDash();
@@ -101,6 +102,7 @@ public:
CPPUNIT_TEST(TestDrawStringAlign);
CPPUNIT_TEST(TestDrawStringTransparent);
CPPUNIT_TEST(TestDrawStringWithBrush);
+ CPPUNIT_TEST(TestEmfPlusDrawBeziers);
CPPUNIT_TEST(TestDrawLine);
CPPUNIT_TEST(TestDrawLineWithCaps);
CPPUNIT_TEST(TestDrawLineWithDash);
@@ -376,6 +378,34 @@ void Test::TestDrawStringWithBrush()
"TIMES NEW ROMAN");
}
+void 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");
+}
+
void 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