[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - emfio/qa emfio/source
Bartosz Kosiorek (via logerrit)
logerrit at kemper.freedesktop.org
Thu May 6 16:04:06 UTC 2021
emfio/qa/cppunit/emf/EmfImportTest.cxx | 24 +++++++++++-
emfio/qa/cppunit/emf/data/TestEllipseWithSelectClipPath.emf |binary
emfio/source/reader/emfreader.cxx | 8 +++-
3 files changed, 29 insertions(+), 3 deletions(-)
New commits:
commit eb1ec67f9a479148044f3869afe461e0f4533f22
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
AuthorDate: Tue May 4 13:37:40 2021 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu May 6 18:03:33 2021 +0200
tdf#142004 tdf#141982 EMF Import: Add rotation and path support for EMR_ELLIPSE
Previous implementation of EMR_ELLIPSE, doesn't support rotation
and EMR_ELLIPSE was not work with EMR_BEGINPATH, EMR_ENDPATH and EMR_ABORTPATH
The EMR_BEGINPATH opens path bracket construction.
Once path bracket construction is open, an application can begin specifying records to
define the points that lie in the path. Path bracket construction MUST be closed by an
EMR_ABORTPATH or EMR_ENDPATH record.
With this patch all these issue was resolved for EMR_ELLIPSE
Change-Id: I6d352e0ff0326dd788d43272bf1330fa6c777df4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115101
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>
(cherry picked from commit 761fdaf26dc9ed7cd0d25a7630576e7800813e2f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115194
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 2ab03251f54e..095ff57f4c0b 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -51,6 +51,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools, public unotest:
void TestTextMapMode();
void TestEnglishMapMode();
void TestRectangleWithModifyWorldTransform();
+ void TestEllipseWithSelectClipPath();
void TestDrawPolyLine16WithClip();
void TestFillRegion();
void TestCreatePen();
@@ -72,6 +73,7 @@ public:
CPPUNIT_TEST(TestTextMapMode);
CPPUNIT_TEST(TestEnglishMapMode);
CPPUNIT_TEST(TestRectangleWithModifyWorldTransform);
+ CPPUNIT_TEST(TestEllipseWithSelectClipPath);
CPPUNIT_TEST(TestDrawPolyLine16WithClip);
CPPUNIT_TEST(TestFillRegion);
CPPUNIT_TEST(TestCreatePen);
@@ -312,7 +314,6 @@ void Test::TestEnglishMapMode()
assertXPathContent(pDocument, "/primitive2D/metafile/transform/mask/polygonhairline[3]/polygon", "12699,1058 16933,1058 16933,2118 15346,2118 15346,6349 14287,6349 14287,2118 12699,2118");
}
-
void Test::TestRectangleWithModifyWorldTransform()
{
// Check import of EMF image with records: EXTCREATEPEN, SELECTOBJECT, MODIFYWORLDTRANSFORM, RECTANGLE
@@ -331,6 +332,26 @@ void Test::TestRectangleWithModifyWorldTransform()
assertXPathContent(pDocument, "/primitive2D/metafile/transform/polygonstroke[1]/polygon", "1042,417 1960,946 2313,1556 1395,1028");
}
+void Test::TestEllipseWithSelectClipPath()
+{
+ // EMF import test with records: RECTANGLE, BEGINPATH, ENDPATH, ELLIPSE
+ Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/emf/data/TestEllipseWithSelectClipPath.emf");
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
+ drawinglayer::Primitive2dXmlDump dumper;
+ xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
+ CPPUNIT_ASSERT (pDocument);
+
+ assertXPath(pDocument, "/primitive2D/metafile/transform/group/mask/polypolygon", 1);
+ assertXPath(pDocument, "/primitive2D/metafile/transform/group/mask/polypolygon[1]", "path", "m2790 705-106-106-106-70-318-106-424-70h-706l-35 35-247 35h-142l-318 106-105 70-106 106v141l106 106 105 70 318 106 424 71h706l424-71 318-106 106-70 106-106");
+
+ assertXPath(pDocument, "/primitive2D/metafile/transform/group/mask/polypolygoncolor", 1);
+ assertXPath(pDocument, "/primitive2D/metafile/transform/group/mask/polypolygoncolor[1]", "color", "#ffff00");
+ assertXPath(pDocument, "/primitive2D/metafile/transform/group/mask/polypolygoncolor[1]/polypolygon[1]", "path", "m353 353h2472v1057h-2472z");
+
+ assertXPath(pDocument, "/primitive2D/metafile/transform/group/mask/polygonstroke", 1);
+ assertXPathContent(pDocument, "/primitive2D/metafile/transform/group/mask/polygonstroke[1]/polygon", "353,353 2825,353 2825,1410 353,1410");
+}
+
void Test::TestDrawPolyLine16WithClip()
{
// Check import of EMF image with records:
@@ -356,7 +377,6 @@ void Test::TestDrawPolyLine16WithClip()
assertXPath(pDocument, "/primitive2D/metafile/transform/mask/group[1]/mask/polypolygon", "path", "m2646 0v1322h1323v1322h-1323v1322h-1323v-1322h-1323v-1322h1323v-1322");
assertXPathContent(pDocument, "/primitive2D/metafile/transform/mask/group[1]/mask/polygonstroke/polygon", "0,793 3969,4230");
-
}
void Test::TestFillRegion()
diff --git a/emfio/qa/cppunit/emf/data/TestEllipseWithSelectClipPath.emf b/emfio/qa/cppunit/emf/data/TestEllipseWithSelectClipPath.emf
new file mode 100644
index 000000000000..ed0d52401238
Binary files /dev/null and b/emfio/qa/cppunit/emf/data/TestEllipseWithSelectClipPath.emf differ
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index a5f16af4142b..4691eff85410 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -1318,7 +1318,13 @@ namespace emfio
case EMR_ELLIPSE :
{
mpInputStream->ReadInt32( nX32 ).ReadInt32( nY32 ).ReadInt32( nx32 ).ReadInt32( ny32 );
- DrawEllipse( ReadRectangle( nX32, nY32, nx32, ny32 ) );
+ SAL_INFO("emfio", "\t\t Rectangle, left: " << nX32 << ", top: " << nY32 << ", right: " << nx32 << ", bottom: " << ny32);
+ tools::Long dw = (nx32 - nX32) / 2;
+ tools::Long dh = (ny32 - nY32) / 2;
+ Point aCenter( nX32 + dw, nY32 + dh );
+ tools::Polygon aPoly( aCenter, dw, dh );
+ aPoly.Optimize( PolyOptimizeFlags::EDGES );
+ DrawPolygon( aPoly, mbRecordPath );
}
break;
More information about the Libreoffice-commits
mailing list