LibGfx: Add fast_is<T> optimization for Typeface and TypefaceSkia

This commit is contained in:
Andreas Kling 2025-09-21 14:13:59 +02:00 committed by Andreas Kling
parent bc368110ab
commit 4eca3781c7
2 changed files with 10 additions and 0 deletions

View File

@ -55,6 +55,11 @@ public:
hb_face_t* harfbuzz_typeface() const;
template<typename T>
bool fast_is() const = delete;
virtual bool is_skia() const { return false; }
protected:
Typeface();

View File

@ -36,6 +36,8 @@ private:
explicit TypefaceSkia(NonnullOwnPtr<Impl>, ReadonlyBytes, int ttc_index = 0);
virtual bool is_skia() const override { return true; }
ReadonlyBytes m_buffer;
unsigned m_ttc_index { 0 };
@ -57,4 +59,7 @@ private:
void populate_glyph_page(GlyphPage&, size_t page_index) const;
};
template<>
inline bool Typeface::fast_is<TypefaceSkia>() const { return is_skia(); }
}