From a4dafa3e2918f2cc28657145e6b0afe7bcf1ca7b Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 24 Oct 2021 18:59:07 +0800 Subject: ... --- include/cru/platform/graphics/util/Painter.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/cru/platform/graphics/util') diff --git a/include/cru/platform/graphics/util/Painter.hpp b/include/cru/platform/graphics/util/Painter.hpp index 90457cf4..2e0fbb51 100644 --- a/include/cru/platform/graphics/util/Painter.hpp +++ b/include/cru/platform/graphics/util/Painter.hpp @@ -10,8 +10,9 @@ void WithTransform(IPainter* painter, const Matrix& matrix, const Fn& action) { static_assert(std::is_invocable_v, "Action must can be be invoked with painter."); const auto old = painter->GetTransform(); - painter->SetTransform(matrix * old); + painter->PushState(); + painter->ConcatTransform(matrix); action(painter); - painter->SetTransform(old); + painter->PopState(); } } // namespace cru::platform::graphics::util -- cgit v1.2.3