diff --git a/DesktopEditor/graphics/Graphics.cpp b/DesktopEditor/graphics/Graphics.cpp index 1c973929de..47b47932aa 100644 --- a/DesktopEditor/graphics/Graphics.cpp +++ b/DesktopEditor/graphics/Graphics.cpp @@ -38,6 +38,8 @@ namespace Aggplus #if defined (_LINUX) || defined (_QT) m_bSwapRGB = true; #endif + + m_dDpiTile = -1; } CGraphics::CGraphics(int dwWidth, int dwHeight, int stride, BYTE* pBuffer) : m_dwConfigFlags(0) @@ -67,6 +69,8 @@ namespace Aggplus #if defined (_LINUX) || defined (_QT) m_bSwapRGB = true; #endif + + m_dDpiTile = -1; } CGraphics::CGraphics(CImage* pImage) : m_dwConfigFlags(0) @@ -101,6 +105,8 @@ namespace Aggplus #if defined (_LINUX) || defined (_QT) m_bSwapRGB = true; #endif + + m_dDpiTile = -1; } CGraphics::~CGraphics() @@ -852,6 +858,15 @@ namespace Aggplus brushMatrix.Scale(dScaleX, dScaleY, Aggplus::MatrixOrderAppend); } + + if (ptxBrush->GetWrapMode() != Aggplus::WrapModeClamp && m_dDpiTile > 1) + { + double dScaleX = m_dDpiX / m_dDpiTile; + double dScaleY = m_dDpiY / m_dDpiTile; + + brushMatrix.Scale(dScaleX, dScaleY, Aggplus::MatrixOrderAppend); + } + brushMatrix.Translate(x, y, Aggplus::MatrixOrderAppend); brushMatrix.Multiply(&m_oFullTransform, MatrixOrderAppend); ptxBrush->SetTransform(&brushMatrix); @@ -1553,7 +1568,7 @@ namespace Aggplus agg::trans_affine coords = m_oCoordTransform.m_agg_mtx; coords.invert(); - mtx_Work.multiply(coords); + mtx_Work.premultiply(coords); //mtx_Work.multiply(m_oFullTransform.m_agg_mtx); mtx_Work.invert(); diff --git a/DesktopEditor/graphics/Graphics.h b/DesktopEditor/graphics/Graphics.h index 155539a916..39b567a920 100644 --- a/DesktopEditor/graphics/Graphics.h +++ b/DesktopEditor/graphics/Graphics.h @@ -202,6 +202,8 @@ public: // for RGBA painting bool m_bSwapRGB; + double m_dDpiTile; + public: CGraphics(); diff --git a/DesktopEditor/graphics/GraphicsRenderer.h b/DesktopEditor/graphics/GraphicsRenderer.h index 9494011424..61e812ab05 100644 --- a/DesktopEditor/graphics/GraphicsRenderer.h +++ b/DesktopEditor/graphics/GraphicsRenderer.h @@ -72,6 +72,7 @@ public: void SaveBrush(NSStructures::CBrush& oBrush) { oBrush = m_oBrush; } void RestoreBrush(const NSStructures::CBrush& oBrush) { m_oBrush = oBrush; } void SetSwapRGB(bool bValue){ if (m_pRenderer) m_pRenderer->m_bSwapRGB = bValue; } + void SetTileImageDpi(const double& dDpi) { if (m_pRenderer) m_pRenderer->m_dDpiTile = dDpi; } public: // тип рендерера-----------------------------------------------------------------------------