diff --git a/DesktopEditor/graphics/GraphicsRenderer.cpp b/DesktopEditor/graphics/GraphicsRenderer.cpp index 0444d5dab2..40d535d391 100644 --- a/DesktopEditor/graphics/GraphicsRenderer.cpp +++ b/DesktopEditor/graphics/GraphicsRenderer.cpp @@ -622,6 +622,12 @@ HRESULT CGraphicsRenderer::BrushRect(const INT& val, const double& left, const d m_oBrush.Rect.Height = (float)height; return S_OK; } +HRESULT CGraphicsRenderer::get_BrushRect(Aggplus::RectF& rect, bool& rectable) const +{ + rectable = m_oBrush.Rectable; + rect = m_oBrush.Rect; + return S_OK; +} HRESULT CGraphicsRenderer::BrushBounds(const double& left, const double& top, const double& width, const double& height) { m_oBrush.Bounds.left = left; diff --git a/DesktopEditor/graphics/GraphicsRenderer.h b/DesktopEditor/graphics/GraphicsRenderer.h index b847070872..37cdc73fb3 100644 --- a/DesktopEditor/graphics/GraphicsRenderer.h +++ b/DesktopEditor/graphics/GraphicsRenderer.h @@ -190,6 +190,7 @@ public: virtual HRESULT get_BrushTransform(Aggplus::CMatrix& oMatrix); virtual HRESULT put_BrushTransform(const Aggplus::CMatrix& oMatrix); virtual HRESULT BrushRect(const INT& val, const double& left, const double& top, const double& width, const double& height); + virtual HRESULT get_BrushRect(Aggplus::RectF& rect, bool& rectable) const; virtual HRESULT BrushBounds(const double& left, const double& top, const double& width, const double& height); virtual HRESULT put_BrushGradientColors(LONG* lColors, double* pPositions, LONG nCount); diff --git a/DesktopEditor/graphics/IRenderer.h b/DesktopEditor/graphics/IRenderer.h index 019fc78a61..4f9e9fdef5 100644 --- a/DesktopEditor/graphics/IRenderer.h +++ b/DesktopEditor/graphics/IRenderer.h @@ -243,6 +243,7 @@ public: virtual HRESULT get_BrushLinearAngle(double* dAngle) = 0; virtual HRESULT put_BrushLinearAngle(const double& dAngle) = 0; virtual HRESULT BrushRect(const INT& val, const double& left, const double& top, const double& width, const double& height) = 0; + virtual HRESULT get_BrushRect(Aggplus::RectF& rect, bool& rectable) const = 0; virtual HRESULT BrushBounds(const double& left, const double& top, const double& width, const double& height) = 0; virtual HRESULT put_BrushGradientColors(LONG* lColors, double* pPositions, LONG nCount) = 0; diff --git a/DesktopEditor/graphics/MetafileToRenderer.cpp b/DesktopEditor/graphics/MetafileToRenderer.cpp index 5ac2f47317..d3b74d631a 100644 --- a/DesktopEditor/graphics/MetafileToRenderer.cpp +++ b/DesktopEditor/graphics/MetafileToRenderer.cpp @@ -664,9 +664,20 @@ namespace NSOnlineOfficeBinToPdf } case ctPathCommandOffset: { + isClip = true; + double m1 = oReader.ReadDouble(); double m2 = oReader.ReadDouble(); - isClip = true; + + Aggplus::RectF rect; + bool rectable; + pRenderer->get_BrushRect(rect, rectable); + if (rectable) + { + rect.Offset(m1, m2); + pRenderer->BrushRect(true, rect.X, rect.Y, rect.Width, rect.Height); + } + clipPath = path.Trsanslate(m1, m2); } case ctDrawPath: diff --git a/DesktopEditor/graphics/aggplustypes.h b/DesktopEditor/graphics/aggplustypes.h index 74b6f83e09..fc10bd1033 100644 --- a/DesktopEditor/graphics/aggplustypes.h +++ b/DesktopEditor/graphics/aggplustypes.h @@ -212,6 +212,19 @@ public: void Offset(const PointF_T& point) { Offset(point.X, point.Y); } void Offset(T dx, T dy) { X += dx; Y += dy; } + RectF_T& operator=(const RectF_T& other) + { + if (this == &other) + return *this; + + X = other.X; + Y = other.Y; + Width = other.Width; + Height = other.Height; + + return *this; + }; + public: T X, Y, Width, Height; };