Codechange: Use unique_ptr instead of raw pointer for string layouts. (#13128)

This commit is contained in:
Peter Nelson
2024-11-27 23:38:57 +00:00
committed by GitHub
parent cf7710fb61
commit fe0afef36f
9 changed files with 15 additions and 15 deletions

View File

@@ -148,7 +148,7 @@ static CTRunDelegateCallbacks _sprite_font_callback = {
&SpriteFontGetWidth
};
/* static */ ParagraphLayouter *CoreTextParagraphLayoutFactory::GetParagraphLayout(CharType *buff, CharType *buff_end, FontMap &fontMapping)
/* static */ std::unique_ptr<ParagraphLayouter> CoreTextParagraphLayoutFactory::GetParagraphLayout(CharType *buff, CharType *buff_end, FontMap &fontMapping)
{
if (!MacOSVersionIsAtLeast(10, 5, 0)) return nullptr;
@@ -209,7 +209,7 @@ static CTRunDelegateCallbacks _sprite_font_callback = {
/* Create and return typesetter for the string. */
CFAutoRelease<CTTypesetterRef> typesetter(CTTypesetterCreateWithAttributedString(str.get()));
return typesetter ? new CoreTextParagraphLayout(std::move(typesetter), buff, length, fontMapping) : nullptr;
return typesetter ? std::make_unique<CoreTextParagraphLayout>(std::move(typesetter), buff, length, fontMapping) : nullptr;
}
/* virtual */ std::unique_ptr<const ParagraphLayouter::Line> CoreTextParagraphLayout::NextLine(int max_width)