aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/graphics/util
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-10-24 18:59:07 +0800
committercrupest <crupest@outlook.com>2021-10-24 18:59:07 +0800
commita4dafa3e2918f2cc28657145e6b0afe7bcf1ca7b (patch)
tree9ba8b9c960fdc830c272042e6b595e0a20e3bfb2 /include/cru/platform/graphics/util
parent3e84cf013b31c52405a76b8e8778a5991d096290 (diff)
downloadcru-a4dafa3e2918f2cc28657145e6b0afe7bcf1ca7b.tar.gz
cru-a4dafa3e2918f2cc28657145e6b0afe7bcf1ca7b.tar.bz2
cru-a4dafa3e2918f2cc28657145e6b0afe7bcf1ca7b.zip
...
Diffstat (limited to 'include/cru/platform/graphics/util')
-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