mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Codechange: Return read-only span instead of vector from layout run functions.
This commit is contained in:
parent
6bf214af6e
commit
bbbf2b5282
@ -96,10 +96,10 @@ public:
|
||||
virtual ~VisualRun() = default;
|
||||
virtual const Font *GetFont() const = 0;
|
||||
virtual int GetGlyphCount() const = 0;
|
||||
virtual const std::vector<GlyphID> &GetGlyphs() const = 0;
|
||||
virtual const std::vector<Point> &GetPositions() const = 0;
|
||||
virtual std::span<const GlyphID> GetGlyphs() const = 0;
|
||||
virtual std::span<const Point> GetPositions() const = 0;
|
||||
virtual int GetLeading() const = 0;
|
||||
virtual const std::vector<int> &GetGlyphToCharMap() const = 0;
|
||||
virtual std::span<const int> GetGlyphToCharMap() const = 0;
|
||||
};
|
||||
|
||||
/** A single line worth of VisualRuns. */
|
||||
|
@ -49,10 +49,10 @@ public:
|
||||
FallbackVisualRun(Font *font, const char32_t *chars, int glyph_count, int char_offset, int x);
|
||||
const Font *GetFont() const override { return this->font; }
|
||||
int GetGlyphCount() const override { return static_cast<int>(this->glyphs.size()); }
|
||||
const std::vector<GlyphID> &GetGlyphs() const override { return this->glyphs; }
|
||||
const std::vector<Point> &GetPositions() const override { return this->positions; }
|
||||
std::span<const GlyphID> GetGlyphs() const override { return this->glyphs; }
|
||||
std::span<const Point> GetPositions() const override { return this->positions; }
|
||||
int GetLeading() const override { return this->GetFont()->fc->GetHeight(); }
|
||||
const std::vector<int> &GetGlyphToCharMap() const override { return this->glyph_to_char; }
|
||||
std::span<const int> GetGlyphToCharMap() const override { return this->glyph_to_char; }
|
||||
};
|
||||
|
||||
/** A single line worth of VisualRuns. */
|
||||
|
@ -71,9 +71,9 @@ public:
|
||||
public:
|
||||
ICUVisualRun(const ICURun &run, int x);
|
||||
|
||||
const std::vector<GlyphID> &GetGlyphs() const override { return this->glyphs; }
|
||||
const std::vector<Point> &GetPositions() const override { return this->positions; }
|
||||
const std::vector<int> &GetGlyphToCharMap() const override { return this->glyph_to_char; }
|
||||
std::span<const GlyphID> GetGlyphs() const override { return this->glyphs; }
|
||||
std::span<const Point> GetPositions() const override { return this->positions; }
|
||||
std::span<const int> GetGlyphToCharMap() const override { return this->glyph_to_char; }
|
||||
|
||||
const Font *GetFont() const override { return this->font; }
|
||||
int GetLeading() const override { return this->font->fc->GetHeight(); }
|
||||
|
@ -81,9 +81,9 @@ public:
|
||||
CoreTextVisualRun(CTRunRef run, Font *font, const CoreTextParagraphLayoutFactory::CharType *buff);
|
||||
CoreTextVisualRun(CoreTextVisualRun &&other) = default;
|
||||
|
||||
const std::vector<GlyphID> &GetGlyphs() const override { return this->glyphs; }
|
||||
const std::vector<Point> &GetPositions() const override { return this->positions; }
|
||||
const std::vector<int> &GetGlyphToCharMap() const override { return this->glyph_to_char; }
|
||||
std::span<const GlyphID> GetGlyphs() const override { return this->glyphs; }
|
||||
std::span<const Point> GetPositions() const override { return this->positions; }
|
||||
std::span<const int> GetGlyphToCharMap() const override { return this->glyph_to_char; }
|
||||
|
||||
const Font *GetFont() const override { return this->font; }
|
||||
int GetLeading() const override { return this->font->fc->GetHeight(); }
|
||||
|
@ -88,9 +88,9 @@ public:
|
||||
UniscribeVisualRun(const UniscribeRun &range, int x);
|
||||
UniscribeVisualRun(UniscribeVisualRun &&other) noexcept;
|
||||
|
||||
const std::vector<GlyphID> &GetGlyphs() const override { return this->glyphs; }
|
||||
const std::vector<Point> &GetPositions() const override { return this->positions; }
|
||||
const std::vector<int> &GetGlyphToCharMap() const override;
|
||||
std::span<const GlyphID> GetGlyphs() const override { return this->glyphs; }
|
||||
std::span<const Point> GetPositions() const override { return this->positions; }
|
||||
std::span<const int> GetGlyphToCharMap() const override;
|
||||
|
||||
const Font *GetFont() const override { return this->font; }
|
||||
int GetLeading() const override { return this->font->fc->GetHeight(); }
|
||||
@ -493,7 +493,7 @@ UniscribeParagraphLayout::UniscribeVisualRun::UniscribeVisualRun(UniscribeVisual
|
||||
{
|
||||
}
|
||||
|
||||
const std::vector<int> &UniscribeParagraphLayout::UniscribeVisualRun::GetGlyphToCharMap() const
|
||||
std::span<const int> UniscribeParagraphLayout::UniscribeVisualRun::GetGlyphToCharMap() const
|
||||
{
|
||||
if (this->glyph_to_char.empty()) {
|
||||
this->glyph_to_char.resize(this->GetGlyphCount());
|
||||
|
Loading…
Reference in New Issue
Block a user