Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
sktext::gpu::SlugImpl Class Referencefinal

#include <SlugImpl.h>

Inheritance diagram for sktext::gpu::SlugImpl:
sktext::gpu::Slug SkRefCnt SkRefCntBase

Public Member Functions

 SlugImpl (SubRunAllocator &&alloc, gpu::SubRunContainerOwner subRuns, SkRect sourceBounds, SkPoint origin)
 
 ~SlugImpl () override=default
 
void doFlatten (SkWriteBuffer &buffer) const override
 
SkRect sourceBounds () const override
 
SkRect sourceBoundsWithOrigin () const override
 
const SkMatrixinitialPositionMatrix () const
 
SkPoint origin () const
 
const gpu::SubRunContainerOwnersubRuns () const
 
void operator delete (void *p)
 
void * operator new (size_t)
 
void * operator new (size_t, void *p)
 
- Public Member Functions inherited from sktext::gpu::Slug
sk_sp< SkDataserialize () const
 
size_t serialize (void *buffer, size_t size) const
 
void draw (SkCanvas *canvas, const SkPaint &paint) const
 
virtual SkRect sourceBounds () const =0
 
virtual SkRect sourceBoundsWithOrigin () const =0
 
virtual void doFlatten (SkWriteBuffer &) const =0
 
uint32_t uniqueID () const
 
- 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< SlugImplMake (const SkMatrix &viewMatrix, const sktext::GlyphRunList &glyphRunList, const SkPaint &paint, SkStrikeDeviceInfo strikeDeviceInfo, sktext::StrikeForGPUCacheInterface *strikeCache)
 
static sk_sp< SlugMakeFromBuffer (SkReadBuffer &buffer, const SkStrikeClient *client)
 
- Static Public Member Functions inherited from sktext::gpu::Slug
static sk_sp< SlugConvertBlob (SkCanvas *canvas, const SkTextBlob &blob, SkPoint origin, const SkPaint &paint)
 
static sk_sp< SlugDeserialize (const void *data, size_t size, const SkStrikeClient *client=nullptr)
 
static sk_sp< SlugMakeFromBuffer (SkReadBuffer &buffer)
 
static void AddDeserialProcs (SkDeserialProcs *procs, const SkStrikeClient *client=nullptr)
 

Detailed Description

Definition at line 34 of file SlugImpl.h.

Constructor & Destructor Documentation

◆ SlugImpl()

sktext::gpu::SlugImpl::SlugImpl ( SubRunAllocator &&  alloc,
gpu::SubRunContainerOwner  subRuns,
SkRect  sourceBounds,
SkPoint  origin 
)

Definition at line 30 of file SlugImpl.cpp.

34 : fAlloc {std::move(alloc)}
35 , fSubRuns(std::move(subRuns))
36 , fSourceBounds{sourceBounds}
37 , fOrigin{origin} {}
const gpu::SubRunContainerOwner & subRuns() const
Definition: SlugImpl.h:57
SkRect sourceBounds() const override
Definition: SlugImpl.h:51
SkPoint origin() const
Definition: SlugImpl.h:55

◆ ~SlugImpl()

sktext::gpu::SlugImpl::~SlugImpl ( )
overridedefault

Member Function Documentation

◆ doFlatten()

void sktext::gpu::SlugImpl::doFlatten ( SkWriteBuffer buffer) const
overridevirtual

Implements sktext::gpu::Slug.

Definition at line 39 of file SlugImpl.cpp.

39 {
40 buffer.writeRect(fSourceBounds);
41 buffer.writePoint(fOrigin);
42 fSubRuns->flattenAllocSizeHint(buffer);
43 fSubRuns->flattenRuns(buffer);
44}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126

◆ initialPositionMatrix()

const SkMatrix & sktext::gpu::SlugImpl::initialPositionMatrix ( ) const
inline

Definition at line 54 of file SlugImpl.h.

54{ return fSubRuns->initialPosition(); }

◆ Make()

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

Definition at line 74 of file SlugImpl.cpp.

78 {
79 size_t subRunSizeHint = gpu::SubRunContainer::EstimateAllocSize(glyphRunList);
80 auto [initializer, _, alloc] =
81 SubRunAllocator::AllocateClassMemoryAndArena<SlugImpl>(subRunSizeHint);
82
83 const SkMatrix positionMatrix = position_matrix(viewMatrix, glyphRunList.origin());
84
86 positionMatrix,
87 paint,
88 strikeDeviceInfo,
89 strikeCache,
90 &alloc,
92 "Make Slug");
93
94 sk_sp<SlugImpl> slug = sk_sp<SlugImpl>(initializer.initialize(std::move(alloc),
95 std::move(subRuns),
96 glyphRunList.sourceBounds(),
97 glyphRunList.origin()));
98
99 // There is nothing to draw here. This is particularly a problem with RSX form blobs where a
100 // single space becomes a run with no glyphs.
101 if (slug->fSubRuns->isEmpty()) { return nullptr; }
102
103 return slug;
104}
static struct Initializer initializer
SkRect sourceBounds() const
Definition: GlyphRun.h:115
SkPoint origin() const
Definition: GlyphRun.h:114
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)
const Paint & paint
Definition: color_source.cc:38
SkMatrix position_matrix(const SkMatrix &drawMatrix, SkPoint drawOrigin)
Definition: SlugImpl.cpp:69

◆ MakeFromBuffer()

sk_sp< Slug > sktext::gpu::SlugImpl::MakeFromBuffer ( SkReadBuffer buffer,
const SkStrikeClient client 
)
static

Definition at line 46 of file SlugImpl.cpp.

46 {
47 SkRect sourceBounds = buffer.readRect();
48 if (!buffer.validate(!sourceBounds.isEmpty())) {
49 return nullptr;
50 }
51 SkPoint origin = buffer.readPoint();
53
54 auto [initializer, _, alloc] =
55 SubRunAllocator::AllocateClassMemoryAndArena<SlugImpl>(allocSizeHint);
56
59
60 // Something went wrong while reading.
61 if (!buffer.isValid()) {
62 return nullptr;
63 }
64
65 return sk_sp<SlugImpl>(
66 initializer.initialize(std::move(alloc), std::move(container), sourceBounds, origin));
67}
static SubRunContainerOwner MakeFromBufferInAlloc(SkReadBuffer &buffer, const SkStrikeClient *client, SubRunAllocator *alloc)
static int AllocSizeHintFromBuffer(SkReadBuffer &buffer)
std::unique_ptr< SubRunContainer, SubRunAllocator::Destroyer > SubRunContainerOwner
bool isEmpty() const
Definition: SkRect.h:693

◆ operator delete()

void sktext::gpu::SlugImpl::operator delete ( void *  p)
inline

Definition at line 61 of file SlugImpl.h.

61{ ::operator delete(p); }

◆ operator new() [1/2]

void * sktext::gpu::SlugImpl::operator new ( size_t  )
inline

Definition at line 62 of file SlugImpl.h.

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

◆ operator new() [2/2]

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

Definition at line 63 of file SlugImpl.h.

63{ return p; }

◆ origin()

SkPoint sktext::gpu::SlugImpl::origin ( ) const
inline

Definition at line 55 of file SlugImpl.h.

55{ return fOrigin; }

◆ sourceBounds()

SkRect sktext::gpu::SlugImpl::sourceBounds ( ) const
inlineoverridevirtual

Implements sktext::gpu::Slug.

Definition at line 51 of file SlugImpl.h.

51{ return fSourceBounds; }

◆ sourceBoundsWithOrigin()

SkRect sktext::gpu::SlugImpl::sourceBoundsWithOrigin ( ) const
inlineoverridevirtual

Implements sktext::gpu::Slug.

Definition at line 52 of file SlugImpl.h.

52{ return fSourceBounds.makeOffset(fOrigin); }
constexpr SkRect makeOffset(float dx, float dy) const
Definition: SkRect.h:965

◆ subRuns()

const gpu::SubRunContainerOwner & sktext::gpu::SlugImpl::subRuns ( ) const
inline

Definition at line 57 of file SlugImpl.h.

57{ return fSubRuns; }

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