diff options
author | Michael Lutz <michi@icosahedron.de> | 2019-04-02 21:31:10 +0200 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2019-04-09 22:45:15 +0200 |
commit | baf9229931e4d5a3479892007e9bcc875bc9930b (patch) | |
tree | 5332e36f2427214f3cd63e11a69334692444e5ee /src/os/macosx | |
parent | 329bb526134aca214a914f25006c805de78ec851 (diff) | |
download | openttd-baf9229931e4d5a3479892007e9bcc875bc9930b.tar.xz |
Codechange: Replace AutoDeleteSmallVector with direct std::vector use in text layout code.
Diffstat (limited to 'src/os/macosx')
-rw-r--r-- | src/os/macosx/string_osx.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/os/macosx/string_osx.cpp b/src/os/macosx/string_osx.cpp index 55eac42f9..580be3520 100644 --- a/src/os/macosx/string_osx.cpp +++ b/src/os/macosx/string_osx.cpp @@ -111,7 +111,7 @@ public: this->cur_offset = 0; } - const Line *NextLine(int max_width) override; + std::unique_ptr<const Line> NextLine(int max_width) override; }; @@ -188,7 +188,7 @@ static CTRunDelegateCallbacks _sprite_font_callback = { return typesetter != NULL ? new CoreTextParagraphLayout(typesetter, buff, length, fontMapping) : NULL; } -/* virtual */ const CoreTextParagraphLayout::Line *CoreTextParagraphLayout::NextLine(int max_width) +/* virtual */ std::unique_ptr<const ParagraphLayouter::Line> CoreTextParagraphLayout::NextLine(int max_width) { if (this->cur_offset >= this->length) return NULL; @@ -200,7 +200,7 @@ static CTRunDelegateCallbacks _sprite_font_callback = { CTLineRef line = CTTypesetterCreateLine(this->typesetter, CFRangeMake(this->cur_offset, len)); this->cur_offset += len; - return line != NULL ? new CoreTextLine(line, this->font_map, this->text_buffer) : NULL; + return std::unique_ptr<const Line>(line != NULL ? new CoreTextLine(line, this->font_map, this->text_buffer) : NULL); } CoreTextParagraphLayout::CoreTextVisualRun::CoreTextVisualRun(CTRunRef run, Font *font, const CoreTextParagraphLayoutFactory::CharType *buff) : font(font) @@ -244,8 +244,8 @@ CoreTextParagraphLayout::CoreTextVisualRun::CoreTextVisualRun(CTRunRef run, Font int CoreTextParagraphLayout::CoreTextLine::GetLeading() const { int leading = 0; - for (const CoreTextVisualRun * const &run : *this) { - leading = max(leading, run->GetLeading()); + for (const auto &run : *this) { + leading = max(leading, run.GetLeading()); } return leading; @@ -260,8 +260,8 @@ int CoreTextParagraphLayout::CoreTextLine::GetWidth() const if (this->size() == 0) return 0; int total_width = 0; - for (const CoreTextVisualRun * const &run : *this) { - total_width += run->GetAdvance(); + for (const auto &run : *this) { + total_width += run.GetAdvance(); } return total_width; |