Kaydet (Commit) e3ccc094 authored tarafından Bartosz Kosiorek's avatar Bartosz Kosiorek

tdf#122557 EMF+ Implement proper rotation support of DrawImage

Change-Id: I2c32a47fac06b2026d61a0f369e6d569c9f57502
Reviewed-on: https://gerrit.libreoffice.org/66392
Tested-by: Jenkins
Reviewed-by: 's avatarBartosz Kosiorek <gang65@poczta.onet.pl>
üst 29728788
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "emfphelperdata.hxx" #include "emfphelperdata.hxx"
#include <tools/color.hxx> #include <tools/color.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
namespace emfplushelper namespace emfplushelper
{ {
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx> #include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx>
#include <drawinglayer/attribute/fontattribute.hxx> #include <drawinglayer/attribute/fontattribute.hxx>
#include <basegfx/color/bcolor.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <basegfx/polygon/b2dpolygonclipper.hxx> #include <basegfx/polygon/b2dpolygonclipper.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolygontools.hxx>
...@@ -336,12 +337,6 @@ namespace emfplushelper ...@@ -336,12 +337,6 @@ namespace emfplushelper
return maMapTransform * ::basegfx::B2DPoint(ix, iy); 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 EmfPlusHelperData::EMFPGetBrushColorOrARGBColor(const sal_uInt16 flags, const sal_uInt32 brushIndexOrColor) const {
Color color; Color color;
if (flags & 0x8000) // we use a color if (flags & 0x8000) // we use a color
...@@ -1224,11 +1219,10 @@ namespace emfplushelper ...@@ -1224,11 +1219,10 @@ namespace emfplushelper
ReadPoint(rMS, x2, y2, flags); // upper-right ReadPoint(rMS, x2, y2, flags); // upper-right
ReadPoint(rMS, x3, y3, flags); // lower-left 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 points: P1:" << x1 << "," << y1 << " P2:" << x2 << "," << y2 << " P3:" << x3 << "," << y3);
SAL_INFO("drawinglayer", "EMF+\t destination rectangle: " << x1 << "," << y1 << " " << x2 - x1 << "x" << y3 - y1);
aDstPoint = Map(x1, y1); aDstPoint = ::basegfx::B2DPoint(x1, y1);
aDstSize = MapSize(x2 - x1, y3 - y1); aDstSize = ::basegfx::B2DSize(x2 - x1, y3 - y1);
} }
else else
{ {
...@@ -1241,12 +1235,12 @@ namespace emfplushelper ...@@ -1241,12 +1235,12 @@ namespace emfplushelper
float dx, dy, dw, dh; float dx, dy, dw, dh;
ReadRectangle(rMS, dx, dy, dw, dh, bool(flags & 0x4000)); ReadRectangle(rMS, dx, dy, dw, dh, bool(flags & 0x4000));
SAL_INFO("drawinglayer", "EMF+\t destination rectangle: " << dx << "," << dy << " " << dw << "x" << dh); SAL_INFO("drawinglayer", "EMF+\t destination rectangle: " << dx << "," << dy << " " << dw << "x" << dh);
aDstPoint = Map(dx, dy); aDstPoint = ::basegfx::B2DPoint(dx, dy);
aDstSize = MapSize(dw, dh); aDstSize = ::basegfx::B2DSize(dw, dh);
} }
// create correct transform matrix // create correct transform matrix
basegfx::B2DHomMatrix aTransformMatrix = basegfx::utils::createScaleTranslateB2DHomMatrix( const basegfx::B2DHomMatrix aTransformMatrix = maMapTransform * basegfx::utils::createScaleTranslateB2DHomMatrix(
aDstSize.getX(), aDstSize.getX(),
aDstSize.getY(), aDstSize.getY(),
aDstPoint.getX(), aDstPoint.getX(),
...@@ -1266,6 +1260,7 @@ namespace emfplushelper ...@@ -1266,6 +1260,7 @@ namespace emfplushelper
else else
{ {
SAL_WARN("drawinglayer", "EMF+\t warning: empty bitmap"); SAL_WARN("drawinglayer", "EMF+\t warning: empty bitmap");
break;
} }
} }
else if (image.type == ImageDataTypeMetafile) else if (image.type == ImageDataTypeMetafile)
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/matrix/b2dhommatrix.hxx>
#include <tools/stream.hxx> #include <tools/stream.hxx>
#include <basegfx/point/b2dpoint.hxx> #include <basegfx/point/b2dpoint.hxx>
#include <basegfx/vector/b2dsize.hxx>
#include <basegfx/color/bcolor.hxx>
#include <map> #include <map>
// predefines // predefines
...@@ -204,7 +202,6 @@ namespace emfplushelper ...@@ -204,7 +202,6 @@ namespace emfplushelper
// mappers // mappers
::basegfx::B2DPoint Map(double ix, double iy) const; ::basegfx::B2DPoint Map(double ix, double iy) const;
::basegfx::B2DSize MapSize(double iwidth, double iheight) const;
// readers // readers
static void ReadRectangle(SvStream& s, float& x, float& y, float &width, float& height, bool bCompressed = false); static void ReadRectangle(SvStream& s, float& x, float& y, float &width, float& height, bool bCompressed = false);
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
*/ */
#include <basegfx/point/b2dpoint.hxx> #include <basegfx/point/b2dpoint.hxx>
#include <basegfx/vector/b2dsize.hxx>
#include <basegfx/range/b2drectangle.hxx> #include <basegfx/range/b2drectangle.hxx>
#include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolygontools.hxx>
...@@ -70,16 +69,15 @@ namespace emfplushelper ...@@ -70,16 +69,15 @@ namespace emfplushelper
SAL_INFO("drawinglayer", "EMF+\t\t RegionNodeDataTypeRect x:" << dx << ", y:" << dy << SAL_INFO("drawinglayer", "EMF+\t\t RegionNodeDataTypeRect x:" << dx << ", y:" << dy <<
", width:" << dw << ", height:" << dh); ", width:" << dw << ", height:" << dh);
::basegfx::B2DPoint mappedPoint(rR.Map(dx, dy)); const ::basegfx::B2DPoint mappedStartPoint(rR.Map(dx, dy));
::basegfx::B2DSize mappedSize(rR.MapSize(dw, dh)); const ::basegfx::B2DPoint mappedEndPoint(rR.Map(dx + dw, dy + dh));
const ::basegfx::B2DPolyPolygon polyPolygon(
::basegfx::B2DPolyPolygon polyPolygon(
::basegfx::utils::createPolygonFromRect( ::basegfx::utils::createPolygonFromRect(
::basegfx::B2DRectangle( ::basegfx::B2DRectangle(
mappedPoint.getX(), mappedStartPoint.getX(),
mappedPoint.getY(), mappedStartPoint.getY(),
mappedPoint.getX() + mappedSize.getX(), mappedEndPoint.getX(),
mappedPoint.getY() + mappedSize.getY()))); mappedEndPoint.getY())));
polygon = polyPolygon; polygon = polyPolygon;
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment