aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/graphics/util/Painter.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/platform/graphics/util/Painter.hpp')
-rw-r--r--include/cru/platform/graphics/util/Painter.hpp5
1 files changed, 3 insertions, 2 deletions
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<decltype(action), IPainter*>,
"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