diff options
author | crupest <crupest@outlook.com> | 2019-06-27 17:02:58 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-06-27 17:02:58 +0800 |
commit | b53527fbe50a953ad0e3225cc812eb76b8a1f82d (patch) | |
tree | eb81cd14d0a165c47f841ad94835f8987109de7e /src/ui/render/text_render_object.cpp | |
parent | 8c5b05bcfce96495b4ffc4209ab8feda12597729 (diff) | |
download | cru-b53527fbe50a953ad0e3225cc812eb76b8a1f82d.tar.gz cru-b53527fbe50a953ad0e3225cc812eb76b8a1f82d.tar.bz2 cru-b53527fbe50a953ad0e3225cc812eb76b8a1f82d.zip |
...
Diffstat (limited to 'src/ui/render/text_render_object.cpp')
-rw-r--r-- | src/ui/render/text_render_object.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/ui/render/text_render_object.cpp b/src/ui/render/text_render_object.cpp index 849bff11..64a34b6c 100644 --- a/src/ui/render/text_render_object.cpp +++ b/src/ui/render/text_render_object.cpp @@ -9,9 +9,9 @@ namespace cru::ui::render { TextRenderObject::TextRenderObject( - std::shared_ptr<platform::graph::IBrush> brush, - std::shared_ptr<platform::graph::IFontDescriptor> font, - std::shared_ptr<platform::graph::IBrush> selection_brush) { + std::shared_ptr<platform::graph::Brush> brush, + std::shared_ptr<platform::graph::Font> font, + std::shared_ptr<platform::graph::Brush> selection_brush) { assert(brush); assert(font); assert(selection_brush); @@ -20,7 +20,7 @@ TextRenderObject::TextRenderObject( font.swap(font_); selection_brush.swap(selection_brush_); - const auto graph_factory = platform::graph::IGraphFactory::GetInstance(); + const auto graph_factory = platform::graph::GraphFactory::GetInstance(); text_layout_.reset(graph_factory->CreateTextLayout(font_, L"")); } @@ -32,22 +32,22 @@ void TextRenderObject::SetText(std::wstring new_text) { text_layout_->SetText(std::move(new_text)); } -std::shared_ptr<platform::graph::IFontDescriptor> TextRenderObject::GetFont() +std::shared_ptr<platform::graph::Font> TextRenderObject::GetFont() const { return text_layout_->GetFont(); } void TextRenderObject::SetFont( - std::shared_ptr<platform::graph::IFontDescriptor> font) { + std::shared_ptr<platform::graph::Font> font) { text_layout_->SetFont(std::move(font)); } -void TextRenderObject::Draw(platform::graph::IPainter* painter) { +void TextRenderObject::Draw(platform::graph::Painter* painter) { platform::graph::util::WithTransform( painter, platform::Matrix::Translation(GetMargin().left + GetPadding().left, GetMargin().top + GetPadding().top), - [this](platform::graph::IPainter* p) { + [this](platform::graph::Painter* p) { if (this->selection_range_.has_value()) { const auto&& rects = text_layout_->TextRangeRect(this->selection_range_.value()); |