From 4ea8be24492f58564ff1b1efe9f7c4673078bcbc Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 2 Apr 2019 21:01:16 +0800 Subject: ... --- include/cru/platform/painter_util.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'include/cru/platform/painter_util.hpp') diff --git a/include/cru/platform/painter_util.hpp b/include/cru/platform/painter_util.hpp index fed0c487..5711d099 100644 --- a/include/cru/platform/painter_util.hpp +++ b/include/cru/platform/painter_util.hpp @@ -2,13 +2,17 @@ #include "painter.hpp" #include +#include namespace cru::platform::util { +template inline void WithTransform(Painter* painter, const Matrix& matrix, - const std::function& action) { + const Fn& action) { + static_assert(std::is_invocable_v, + "Action must can be be invoked with painter."); const auto old = painter->GetTransform(); painter->SetTransform(old * matrix); action(painter); painter->SetTransform(old); } -} +} // namespace cru::platform::util -- cgit v1.2.3