diff options
author | crupest <crupest@outlook.com> | 2019-05-24 23:45:58 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-05-24 23:45:58 +0800 |
commit | b6db663269201fa14a6a4aa1b9042645a9e8f859 (patch) | |
tree | 1984e2c2784fb9623d4c20fbdd6fc650792e133c /src/win/graph/win_text_layout.cpp | |
parent | b9df1bcaea0c19b2e29479cdb1ad5a39e23c4ee7 (diff) | |
download | cru-b6db663269201fa14a6a4aa1b9042645a9e8f859.tar.gz cru-b6db663269201fa14a6a4aa1b9042645a9e8f859.tar.bz2 cru-b6db663269201fa14a6a4aa1b9042645a9e8f859.zip |
...
Diffstat (limited to 'src/win/graph/win_text_layout.cpp')
-rw-r--r-- | src/win/graph/win_text_layout.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/win/graph/win_text_layout.cpp b/src/win/graph/win_text_layout.cpp index 0506320a..997309ad 100644 --- a/src/win/graph/win_text_layout.cpp +++ b/src/win/graph/win_text_layout.cpp @@ -1,23 +1,23 @@ #include "cru/win/graph/win_text_layout.hpp" #include "cru/win/exception.hpp" -#include "cru/win/graph/graph_manager.hpp" #include "cru/win/graph/win_font.hpp" +#include "cru/win/graph/win_native_factory.hpp" #include <cassert> #include <utility> namespace cru::win::graph { -WinTextLayout::WinTextLayout(GraphManager* graph_manager, +WinTextLayout::WinTextLayout(IWinNativeFactory* factory, std::shared_ptr<WinFontDescriptor> font, std::wstring text) { - assert(graph_manager); + assert(factory); assert(font); - graph_manager_ = graph_manager; + factory_ = factory; text_.swap(text); font_descriptor_.swap(font); - ThrowIfFailed(graph_manager_->GetDWriteFactory()->CreateTextLayout( + ThrowIfFailed(factory->GetDWriteFactory()->CreateTextLayout( text_.c_str(), static_cast<UINT32>(text_.size()), font_descriptor_->GetDWriteTextFormat(), max_width_, max_height_, &text_layout_)); @@ -27,22 +27,22 @@ std::wstring WinTextLayout::GetText() { return text_; } void WinTextLayout::SetText(std::wstring new_text) { text_.swap(new_text); - ThrowIfFailed(graph_manager_->GetDWriteFactory()->CreateTextLayout( + ThrowIfFailed(factory_->GetDWriteFactory()->CreateTextLayout( text_.c_str(), static_cast<UINT32>(text_.size()), font_descriptor_->GetDWriteTextFormat(), max_width_, max_height_, &text_layout_)); } -std::shared_ptr<platform::graph::FontDescriptor> WinTextLayout::GetFont() { +std::shared_ptr<platform::graph::IFontDescriptor> WinTextLayout::GetFont() { return font_descriptor_; } void WinTextLayout::SetFont( - std::shared_ptr<platform::graph::FontDescriptor> font) { + std::shared_ptr<platform::graph::IFontDescriptor> font) { auto f = std::dynamic_pointer_cast<WinFontDescriptor>(font); assert(f); f.swap(font_descriptor_); - ThrowIfFailed(graph_manager_->GetDWriteFactory()->CreateTextLayout( + ThrowIfFailed(factory_->GetDWriteFactory()->CreateTextLayout( text_.c_str(), static_cast<UINT32>(text_.size()), font_descriptor_->GetDWriteTextFormat(), max_width_, max_height_, &text_layout_)); |