From e69911a8b161b81ce3f7b209175766da2b7b3d4b Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 12 Dec 2019 19:53:17 +0800 Subject: ... --- include/cru/platform/graph/util/painter.hpp | 17 +++++++++++++++++ include/cru/platform/graph/util/painter_util.hpp | 18 ------------------ 2 files changed, 17 insertions(+), 18 deletions(-) create mode 100644 include/cru/platform/graph/util/painter.hpp delete mode 100644 include/cru/platform/graph/util/painter_util.hpp (limited to 'include/cru/platform/graph/util') diff --git a/include/cru/platform/graph/util/painter.hpp b/include/cru/platform/graph/util/painter.hpp new file mode 100644 index 00000000..72d96bc1 --- /dev/null +++ b/include/cru/platform/graph/util/painter.hpp @@ -0,0 +1,17 @@ +#pragma once +#include "../painter.hpp" + +#include +#include + +namespace cru::platform::graph::util { +template +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(old * matrix); + action(painter); + painter->SetTransform(old); +} +} // namespace cru::platform::graph::util diff --git a/include/cru/platform/graph/util/painter_util.hpp b/include/cru/platform/graph/util/painter_util.hpp deleted file mode 100644 index 7a655a34..00000000 --- a/include/cru/platform/graph/util/painter_util.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once -#include "../painter.hpp" - -#include -#include - -namespace cru::platform::graph::util { -template -inline void WithTransform(Painter* 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(old * matrix); - action(painter); - painter->SetTransform(old); -} -} // namespace cru::platform::util -- cgit v1.2.3