Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
sktext::gpu::TextBlob Class Referencefinal

#include <TextBlob.h>

Inheritance diagram for sktext::gpu::TextBlob:
SkRefCnt SkRefCntBase

Classes

struct  Key
 

Public Member Functions

 SK_DECLARE_INTERNAL_LLIST_INTERFACE (TextBlob)
 
 TextBlob (SubRunAllocator &&alloc, SubRunContainerOwner subRuns, int totalMemorySize, SkColor initialLuminance)
 
 ~TextBlob () override
 
void operator delete (void *p)
 
void * operator new (size_t)
 
void * operator new (size_t, void *p)
 
const Keykey ()
 
void addKey (const Key &key)
 
bool canReuse (const SkPaint &paint, const SkMatrix &positionMatrix) const
 
const Keykey () const
 
size_t size () const
 
void draw (SkCanvas *, SkPoint drawOrigin, const SkPaint &paint, const AtlasDrawDelegate &)
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static sk_sp< TextBlobMake (const sktext::GlyphRunList &glyphRunList, const SkPaint &paint, const SkMatrix &positionMatrix, SkStrikeDeviceInfo strikeDeviceInfo, StrikeForGPUCacheInterface *strikeCache)
 

Friends

class TextBlobTools
 

Detailed Description

Definition at line 54 of file TextBlob.h.

Constructor & Destructor Documentation

◆ TextBlob()

sktext::gpu::TextBlob::TextBlob ( SubRunAllocator &&  alloc,
SubRunContainerOwner  subRuns,
int  totalMemorySize,
SkColor  initialLuminance 
)

Definition at line 246 of file TextBlob.cpp.

250 : fAlloc{std::move(alloc)}
251 , fSubRuns{std::move(subRuns)}
252 , fSize(totalMemorySize)
253 , fInitialLuminance{initialLuminance} { }

◆ ~TextBlob()

sktext::gpu::TextBlob::~TextBlob ( )
overridedefault

Member Function Documentation

◆ addKey()

void sktext::gpu::TextBlob::addKey ( const Key key)

Definition at line 215 of file TextBlob.cpp.

215 {
216 fKey = key;
217}
const Key & key()
Definition TextBlob.h:106

◆ canReuse()

bool sktext::gpu::TextBlob::canReuse ( const SkPaint paint,
const SkMatrix positionMatrix 
) const

Definition at line 219 of file TextBlob.cpp.

219 {
220 // A singular matrix will create a TextBlob with no SubRuns, but unknown glyphs can also
221 // cause empty runs. If there are no subRuns, then regenerate when the matrices don't match.
222 if (fSubRuns->isEmpty() && fSubRuns->initialPosition() != positionMatrix) {
223 return false;
224 }
225
226 // If we have LCD text then our canonical color will be set to transparent, in this case we have
227 // to regenerate the blob on any color change
228 // We use the grPaint to get any color filter effects
230 fInitialLuminance != SkPaintPriv::ComputeLuminanceColor(paint)) {
231 return false;
232 }
233
234 return fSubRuns->canReuse(paint, positionMatrix);
235}
constexpr SkColor SK_ColorTRANSPARENT
Definition SkColor.h:99
static SkColor ComputeLuminanceColor(const SkPaint &)
const Paint & paint

◆ draw()

void sktext::gpu::TextBlob::draw ( SkCanvas canvas,
SkPoint  drawOrigin,
const SkPaint paint,
const AtlasDrawDelegate atlasDelegate 
)

Definition at line 239 of file TextBlob.cpp.

242 {
243 fSubRuns->draw(canvas, drawOrigin, paint, this, atlasDelegate);
244}

◆ key() [1/2]

const Key & sktext::gpu::TextBlob::key ( )
inline

Definition at line 106 of file TextBlob.h.

106{ return fKey; }

◆ key() [2/2]

const TextBlob::Key & sktext::gpu::TextBlob::key ( ) const

Definition at line 237 of file TextBlob.cpp.

237{ return fKey; }

◆ Make()

sk_sp< TextBlob > sktext::gpu::TextBlob::Make ( const sktext::GlyphRunList glyphRunList,
const SkPaint paint,
const SkMatrix positionMatrix,
SkStrikeDeviceInfo  strikeDeviceInfo,
StrikeForGPUCacheInterface strikeCache 
)
static

Definition at line 194 of file TextBlob.cpp.

198 {
199 size_t subRunSizeHint = SubRunContainer::EstimateAllocSize(glyphRunList);
200 auto [initializer, totalMemoryAllocated, alloc] =
201 SubRunAllocator::AllocateClassMemoryAndArena<TextBlob>(subRunSizeHint);
202
203 auto container = SubRunContainer::MakeInAlloc(
204 glyphRunList, positionMatrix, paint,
205 strikeDeviceInfo, strikeCache, &alloc, SubRunContainer::kAddSubRuns, "TextBlob");
206
208 sk_sp<TextBlob> blob = sk_sp<TextBlob>(initializer.initialize(std::move(alloc),
209 std::move(container),
210 totalMemoryAllocated,
211 initialLuminance));
212 return blob;
213}
static struct Initializer initializer
uint32_t SkColor
Definition SkColor.h:37
static SubRunContainerOwner MakeInAlloc(const GlyphRunList &glyphRunList, const SkMatrix &positionMatrix, const SkPaint &runPaint, SkStrikeDeviceInfo strikeDeviceInfo, StrikeForGPUCacheInterface *strikeCache, sktext::gpu::SubRunAllocator *alloc, SubRunCreationBehavior creationBehavior, const char *tag)
static size_t EstimateAllocSize(const GlyphRunList &glyphRunList)

◆ operator delete()

void sktext::gpu::TextBlob::operator delete ( void *  p)

Definition at line 188 of file TextBlob.cpp.

188{ ::operator delete(p); }

◆ operator new() [1/2]

void * sktext::gpu::TextBlob::operator new ( size_t  )

Definition at line 189 of file TextBlob.cpp.

189{ SK_ABORT("All blobs are created by placement new."); }
#define SK_ABORT(message,...)
Definition SkAssert.h:70

◆ operator new() [2/2]

void * sktext::gpu::TextBlob::operator new ( size_t  ,
void *  p 
)

Definition at line 190 of file TextBlob.cpp.

190{ return p; }

◆ size()

size_t sktext::gpu::TextBlob::size ( ) const
inline

Definition at line 113 of file TextBlob.h.

113{ return SkTo<size_t>(fSize); }

◆ SK_DECLARE_INTERNAL_LLIST_INTERFACE()

sktext::gpu::TextBlob::SK_DECLARE_INTERNAL_LLIST_INTERFACE ( TextBlob  )

Friends And Related Symbol Documentation

◆ TextBlobTools

friend class TextBlobTools
friend

Definition at line 121 of file TextBlob.h.


The documentation for this class was generated from the following files: