diff options
author | crupest <crupest@outlook.com> | 2019-04-01 18:08:58 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-04-01 18:08:58 +0800 |
commit | de00126c6aeba189a50296df455dd516e21e4176 (patch) | |
tree | 3d89a8a36a3603096d4371230c2d071f91e9e986 /src/ui/render/flex_layout_render_object.cpp | |
parent | 055a3cde0cd19c896f3e498b774078654555c065 (diff) | |
download | cru-de00126c6aeba189a50296df455dd516e21e4176.tar.gz cru-de00126c6aeba189a50296df455dd516e21e4176.tar.bz2 cru-de00126c6aeba189a50296df455dd516e21e4176.zip |
...
Diffstat (limited to 'src/ui/render/flex_layout_render_object.cpp')
-rw-r--r-- | src/ui/render/flex_layout_render_object.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/ui/render/flex_layout_render_object.cpp b/src/ui/render/flex_layout_render_object.cpp index e4d327f1..0e2e8ff7 100644 --- a/src/ui/render/flex_layout_render_object.cpp +++ b/src/ui/render/flex_layout_render_object.cpp @@ -1,12 +1,15 @@ -#include "flex_layout_render_object.hpp" +#include "cru/ui/render/flex_layout_render_object.hpp" + +#include "cru/platform/debug.hpp" +#include "cru/platform/painter_util.hpp" #include <algorithm> +#include <cassert> #include <functional> -#include "cru_debug.hpp" -#include "graph/graph_util.hpp" - namespace cru::ui::render { +using namespace platform; + FlexChildLayoutData* FlexLayoutRenderObject::GetChildLayoutData(int position) { assert(position >= 0 && position < child_layout_data_.size()); // Position out of bound. @@ -14,12 +17,11 @@ FlexChildLayoutData* FlexLayoutRenderObject::GetChildLayoutData(int position) { return &child_layout_data_[position]; } -void FlexLayoutRenderObject::Draw(ID2D1RenderTarget* render_target) { +void FlexLayoutRenderObject::Draw(platform::Painter* painter) { for (const auto child : GetChildren()) { auto offset = child->GetOffset(); - graph::WithTransform(render_target, - D2D1::Matrix3x2F::Translation(offset.x, offset.y), - [child](auto rt) { child->Draw(rt); }); + util::WithTransform(painter, Matrix::Translation(offset.x, offset.y), + [child](auto rt) { child->Draw(rt); }); } } @@ -171,7 +173,7 @@ void FlexLayoutRenderObject::OnLayoutContent(const Rect& content_rect) { case Alignment::End: return start_point + total_length - content_length; default: - UnreachableCode(); + return 0; } }; |