diff --git a/Common/Gfx/Canvas.h b/Common/Gfx/Canvas.h index 262179e7..66755c5f 100644 --- a/Common/Gfx/Canvas.h +++ b/Common/Gfx/Canvas.h @@ -57,6 +57,12 @@ public: virtual bool IsTransparentPixel(int x, int y) = 0; + // TODO: Implement proper solution. + virtual void SetTransform(const Gdiplus::Matrix& matrix) {} + virtual void ResetTransform() {} + virtual void RotateTransform(float angle) {} + virtual void TranslateTransform(float dx, float dy) {} + virtual void SetAntiAliasing(bool enable) = 0; virtual void SetTextAntiAliasing(bool enable) = 0; diff --git a/Common/Gfx/CanvasGDIP.cpp b/Common/Gfx/CanvasGDIP.cpp index e6c07d60..8e9a90cf 100644 --- a/Common/Gfx/CanvasGDIP.cpp +++ b/Common/Gfx/CanvasGDIP.cpp @@ -128,6 +128,26 @@ bool CanvasGDIP::IsTransparentPixel(int x, int y) return false; } +void CanvasGDIP::SetTransform(const Gdiplus::Matrix& matrix) +{ + m_Graphics->SetTransform(&matrix); +} + +void CanvasGDIP::ResetTransform() +{ + m_Graphics->ResetTransform(); +} + +void CanvasGDIP::RotateTransform(float angle) +{ + m_Graphics->RotateTransform(angle); +} + +void CanvasGDIP::TranslateTransform(float dx, float dy) +{ + m_Graphics->TranslateTransform(dx, dy); +} + void CanvasGDIP::SetAntiAliasing(bool enable) { m_Graphics->SetSmoothingMode( diff --git a/Common/Gfx/CanvasGDIP.h b/Common/Gfx/CanvasGDIP.h index 6723f948..beff575c 100644 --- a/Common/Gfx/CanvasGDIP.h +++ b/Common/Gfx/CanvasGDIP.h @@ -48,6 +48,11 @@ public: virtual bool IsTransparentPixel(int x, int y) override; + virtual void SetTransform(const Gdiplus::Matrix& matrix) override; + virtual void ResetTransform() override; + virtual void RotateTransform(float angle) override; + virtual void TranslateTransform(float dx, float dy) override; + virtual void SetAntiAliasing(bool enable) override; virtual void SetTextAntiAliasing(bool enable) override; diff --git a/Library/MeterString.cpp b/Library/MeterString.cpp index efbe0bc8..8bd89e03 100644 --- a/Library/MeterString.cpp +++ b/Library/MeterString.cpp @@ -542,10 +542,9 @@ bool CMeterString::DrawString(Gfx::Canvas& canvas, RectF* rect) if (m_Angle != 0.0f) { - // TODO FIXME - //graphics.TranslateTransform((Gdiplus::REAL)CMeter::GetX(), y); - //graphics.RotateTransform(CONVERT_TO_DEGREES(m_Angle)); - //graphics.TranslateTransform(-(Gdiplus::REAL)CMeter::GetX(), -y); + canvas.TranslateTransform((Gdiplus::REAL)CMeter::GetX(), y); + canvas.RotateTransform(CONVERT_TO_DEGREES(m_Angle)); + canvas.TranslateTransform(-(Gdiplus::REAL)CMeter::GetX(), -y); } if (m_Effect != EFFECT_NONE) @@ -576,8 +575,7 @@ bool CMeterString::DrawString(Gfx::Canvas& canvas, RectF* rect) if (m_Angle != 0.0f) { - // TODO FIXME - //graphics.ResetTransform(); + canvas.ResetTransform(); } } diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index bad036c0..3d481c2c 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -2527,13 +2527,9 @@ void CMeterWindow::Redraw() const Matrix* matrix = (*j)->GetTransformationMatrix(); if (matrix && !matrix->IsIdentity()) { - // TODO FIXME: Change the world matrix - //m_Canvas->GetGraphics().SetTransform(matrix); - + m_Canvas->SetTransform(*matrix); (*j)->Draw(*m_Canvas); - - // TODO FIXME: Set back to identity matrix - //m_Canvas->GetGraphics().ResetTransform(); + m_Canvas->ResetTransform(); } else {