emfio/qa/cppunit/emf/EmfImportTest.cxx |    9 +++++----
 emfio/source/reader/emfreader.cxx      |    3 ++-
 2 files changed, 7 insertions(+), 5 deletions(-)

New commits:
commit cd410d0f384b64cba3d5387943173ae045cae07f
Author:     Bartosz Kosiorek <[email protected]>
AuthorDate: Fri Aug 29 22:35:19 2025 +0200
Commit:     Bartosz Kosiorek <[email protected]>
CommitDate: Sun Aug 31 04:49:40 2025 +0200

    tdf#103859 EMF Fix size of the corners in ROUNDRECT record
    
    After EMF_ROUNDRECT rendering comparison of Office 365 and
    Libreoffice, it appears that radius of corners in LO is twice too large.
    EMF_ROUNDRECT implementation has to be aligned and
    conversion from ellipse width and height to ellipse vertical
    and horizontal radius have been applied (values was divided by 2).
    
    After apply this patch the ROUNDRECT looks identical as in Office.
    
    The issue is also visible in previous version of LO (24.2.7).
    
    Change-Id: I861fcd0e8d8a39d946215cc08ecc95403cd23fad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190391
    Reviewed-by: Bartosz Kosiorek <[email protected]>
    Tested-by: Jenkins

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 15876a2b7365..37c42d4c2126 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -1564,14 +1564,15 @@ CPPUNIT_TEST_FIXTURE(Test, testRoundRect)
                        u"100,100 4100,100 4100,2100 100,2100");
     assertXPath(pDocument, aXPathPrefix + "polygonstroke[1]/line", "color", 
u"#ff0000");
 
-    assertXPath(pDocument, aXPathPrefix + "polypolygoncolor[2]/polypolygon", 
"path",
-                u"m100 2700c0-230 380-500 700-500h2590c310 0 700 270 700 
500v990c0 220-390 500-700 "
-                u"500h-2590c-320 0-700-280-700-500z");
+    assertXPath(
+        pDocument, aXPathPrefix + "polypolygoncolor[2]/polypolygon", "path",
+        u"m100 2450c0-120 190-250 350-250h3290c150 0 350 130 350 250v1490c0 
110-200 250-350 "
+        u"250h-3290c-160 0-350-140-350-250z");
     assertXPath(pDocument, aXPathPrefix + "polypolygoncolor[2]", "color", 
u"#ffffff");
 
     assertXPathContent(
         pDocument, aXPathPrefix + "polygonstroke[2]/polygon",
-        u"100,2700 800,2200 3390,2200 4090,2700 4090,3690 3390,4190 800,4190 
100,3690");
+        u"100,2450 450,2200 3740,2200 4090,2450 4090,3940 3740,4190 450,4190 
100,3940");
     assertXPath(pDocument, aXPathPrefix + "polygonstroke[2]/line", "color", 
u"#ff0000");
 }
 
diff --git a/emfio/source/reader/emfreader.cxx 
b/emfio/source/reader/emfreader.cxx
index ee8d1b756f0b..a5003f792f13 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -1353,7 +1353,8 @@ namespace emfio
                         
mpInputStream->ReadInt32(nX32).ReadInt32(nY32).ReadInt32(nx32).ReadInt32(ny32).ReadUInt32(nW).ReadUInt32(nH);
                         SAL_INFO("emfio", "             Rectangle position: " 
<< nX32 << ":" << nY32 << ", " << nx32 << ":" << ny32);
                         SAL_INFO("emfio", "             Ellipse Width: " << nW 
<< ", Height" << nH);
-                        tools::Polygon aRoundRectPoly(ReadRectangle(nX32, 
nY32, nx32, ny32), nW, nH);
+                        // Convert from ellipse width and height to ellipse 
vertical and horizontal radius
+                        tools::Polygon aRoundRectPoly(ReadRectangle(nX32, 
nY32, nx32, ny32), nW >> 1, nH >> 1);
                         DrawPolygon(std::move(aRoundRectPoly), mbRecordPath);
                     }
                     break;

Reply via email to