From baf9229931e4d5a3479892007e9bcc875bc9930b Mon Sep 17 00:00:00 2001 From: Michael Lutz Date: Tue, 2 Apr 2019 21:31:10 +0200 Subject: Codechange: Replace AutoDeleteSmallVector with direct std::vector use in text layout code. --- src/os/macosx/string_osx.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/os/macosx/string_osx.cpp') 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 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 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(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; -- cgit v1.2.3-54-g00ecf