[Libreoffice-commits] core.git: drawinglayer/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jan 17 06:55:55 UTC 2019


 drawinglayer/source/tools/emfpbrush.hxx      |    1 -
 drawinglayer/source/tools/emfphelperdata.cxx |   21 ++++++++-------------
 drawinglayer/source/tools/emfphelperdata.hxx |    3 ---
 drawinglayer/source/tools/emfpregion.cxx     |   16 +++++++---------
 4 files changed, 15 insertions(+), 26 deletions(-)

New commits:
commit e3ccc09417731e61d3d35ed4cc1a7436e05f5325
Author:     Bartosz Kosiorek <gang65 at poczta.onet.pl>
AuthorDate: Tue Jan 15 15:11:28 2019 +0100
Commit:     Bartosz Kosiorek <gang65 at poczta.onet.pl>
CommitDate: Thu Jan 17 07:55:29 2019 +0100

    tdf#122557 EMF+ Implement proper rotation support of DrawImage
    
    Change-Id: I2c32a47fac06b2026d61a0f369e6d569c9f57502
    Reviewed-on: https://gerrit.libreoffice.org/66392
    Tested-by: Jenkins
    Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>

diff --git a/drawinglayer/source/tools/emfpbrush.hxx b/drawinglayer/source/tools/emfpbrush.hxx
index b73507817de7..283ff304abf3 100644
--- a/drawinglayer/source/tools/emfpbrush.hxx
+++ b/drawinglayer/source/tools/emfpbrush.hxx
@@ -22,7 +22,6 @@
 
 #include "emfphelperdata.hxx"
 #include <tools/color.hxx>
-#include <basegfx/polygon/b2dpolypolygon.hxx>
 
 namespace emfplushelper
 {
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index 5c86d69f1282..03f23451c492 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -36,6 +36,7 @@
 #include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
 #include <drawinglayer/primitive2d/transformprimitive2d.hxx>
 #include <drawinglayer/attribute/fontattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <basegfx/polygon/b2dpolygonclipper.hxx>
 #include <basegfx/polygon/b2dpolygontools.hxx>
@@ -336,12 +337,6 @@ namespace emfplushelper
         return maMapTransform * ::basegfx::B2DPoint(ix, iy);
     }
 
-    ::basegfx::B2DSize EmfPlusHelperData::MapSize(double iwidth, double iheight) const
-    {
-        // map in one step using complete MapTransform (see mappingChanged)
-        return maMapTransform * ::basegfx::B2DSize(iwidth, iheight);
-    }
-
     Color EmfPlusHelperData::EMFPGetBrushColorOrARGBColor(const sal_uInt16 flags, const sal_uInt32 brushIndexOrColor) const {
         Color color;
         if (flags & 0x8000) // we use a color
@@ -1224,11 +1219,10 @@ namespace emfplushelper
                                     ReadPoint(rMS, x2, y2, flags); // upper-right
                                     ReadPoint(rMS, x3, y3, flags); // lower-left
 
-                                    SAL_INFO("drawinglayer", "EMF+\t destination points: " << x1 << "," << y1 << " " << x2 << "," << y2 << " " << x3 << "," << y3);
-                                    SAL_INFO("drawinglayer", "EMF+\t destination rectangle: " << x1 << "," << y1 << " " << x2 - x1 << "x" << y3 - y1);
+                                    SAL_INFO("drawinglayer", "EMF+\t destination points: P1:" << x1 << "," << y1 << " P2:" << x2 << "," << y2 << " P3:" << x3 << "," << y3);
 
-                                    aDstPoint = Map(x1, y1);
-                                    aDstSize = MapSize(x2 - x1, y3 - y1);
+                                    aDstPoint = ::basegfx::B2DPoint(x1, y1);
+                                    aDstSize = ::basegfx::B2DSize(x2 - x1, y3 - y1);
                                 }
                                 else
                                 {
@@ -1241,12 +1235,12 @@ namespace emfplushelper
                                 float dx, dy, dw, dh;
                                 ReadRectangle(rMS, dx, dy, dw, dh, bool(flags & 0x4000));
                                 SAL_INFO("drawinglayer", "EMF+\t destination rectangle: " << dx << "," << dy << " " << dw << "x" << dh);
-                                aDstPoint = Map(dx, dy);
-                                aDstSize = MapSize(dw, dh);
+                                aDstPoint = ::basegfx::B2DPoint(dx, dy);
+                                aDstSize = ::basegfx::B2DSize(dw, dh);
                             }
 
                             // create correct transform matrix
-                            basegfx::B2DHomMatrix aTransformMatrix = basegfx::utils::createScaleTranslateB2DHomMatrix(
+                            const basegfx::B2DHomMatrix aTransformMatrix = maMapTransform * basegfx::utils::createScaleTranslateB2DHomMatrix(
                                 aDstSize.getX(),
                                 aDstSize.getY(),
                                 aDstPoint.getX(),
@@ -1266,6 +1260,7 @@ namespace emfplushelper
                                 else
                                 {
                                     SAL_WARN("drawinglayer", "EMF+\t warning: empty bitmap");
+                                    break;
                                 }
                             }
                             else if (image.type == ImageDataTypeMetafile)
diff --git a/drawinglayer/source/tools/emfphelperdata.hxx b/drawinglayer/source/tools/emfphelperdata.hxx
index d63301f50f5f..7499544b6330 100644
--- a/drawinglayer/source/tools/emfphelperdata.hxx
+++ b/drawinglayer/source/tools/emfphelperdata.hxx
@@ -24,8 +24,6 @@
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <tools/stream.hxx>
 #include <basegfx/point/b2dpoint.hxx>
-#include <basegfx/vector/b2dsize.hxx>
-#include <basegfx/color/bcolor.hxx>
 #include <map>
 
 // predefines
@@ -204,7 +202,6 @@ namespace emfplushelper
 
         // mappers
         ::basegfx::B2DPoint Map(double ix, double iy) const;
-        ::basegfx::B2DSize MapSize(double iwidth, double iheight) const;
 
         // readers
         static void ReadRectangle(SvStream& s, float& x, float& y, float &width, float& height, bool bCompressed = false);
diff --git a/drawinglayer/source/tools/emfpregion.cxx b/drawinglayer/source/tools/emfpregion.cxx
index 559e77db6e08..0ea13792c3b1 100644
--- a/drawinglayer/source/tools/emfpregion.cxx
+++ b/drawinglayer/source/tools/emfpregion.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <basegfx/point/b2dpoint.hxx>
-#include <basegfx/vector/b2dsize.hxx>
 #include <basegfx/range/b2drectangle.hxx>
 #include <basegfx/polygon/b2dpolygon.hxx>
 #include <basegfx/polygon/b2dpolygontools.hxx>
@@ -70,16 +69,15 @@ namespace emfplushelper
             SAL_INFO("drawinglayer", "EMF+\t\t RegionNodeDataTypeRect x:" << dx << ", y:" << dy <<
                      ", width:" << dw << ", height:" << dh);
 
-            ::basegfx::B2DPoint mappedPoint(rR.Map(dx, dy));
-            ::basegfx::B2DSize mappedSize(rR.MapSize(dw, dh));
-
-            ::basegfx::B2DPolyPolygon polyPolygon(
+            const ::basegfx::B2DPoint mappedStartPoint(rR.Map(dx, dy));
+            const ::basegfx::B2DPoint mappedEndPoint(rR.Map(dx + dw, dy + dh));
+            const ::basegfx::B2DPolyPolygon polyPolygon(
                     ::basegfx::utils::createPolygonFromRect(
                         ::basegfx::B2DRectangle(
-                            mappedPoint.getX(),
-                            mappedPoint.getY(),
-                            mappedPoint.getX() + mappedSize.getX(),
-                            mappedPoint.getY() + mappedSize.getY())));
+                            mappedStartPoint.getX(),
+                            mappedStartPoint.getY(),
+                            mappedEndPoint.getX(),
+                            mappedEndPoint.getY())));
             polygon = polyPolygon;
             break;
         }


More information about the Libreoffice-commits mailing list