Flutter Engine
The Flutter Engine
Static Public Member Functions | List of all members
SkRemoteGlyphCacheTest Class Reference

Static Public Member Functions

static sk_sp< SkTextBlobMakeNormalBlob (SkPaint *paint, sk_sp< SkTypeface > serverTf, bool asPaths, SkScalar textSize, sk_sp< SkTypeface > clientTf=nullptr)
 

Detailed Description

Definition at line 986 of file SkRemoteGlyphCacheTest.cpp.

Member Function Documentation

◆ MakeNormalBlob()

static sk_sp< SkTextBlob > SkRemoteGlyphCacheTest::MakeNormalBlob ( SkPaint paint,
sk_sp< SkTypeface serverTf,
bool  asPaths,
SkScalar  textSize,
sk_sp< SkTypeface clientTf = nullptr 
)
inlinestatic

Definition at line 988 of file SkRemoteGlyphCacheTest.cpp.

990 {
992 font.setTypeface(serverTf);
993 font.setSize(textSize);
994
995 const char* text = "Hel lo";
996 if (asPaths) {
997 font.setupForAsPaths(paint);
998 } else {
999 SkFont font2(font);
1000 font2.setupForAsPaths(paint);
1001 }
1002 auto blob = SkTextBlob::MakeFromText(text, strlen(text), font);
1003 if (clientTf == nullptr) return blob;
1004
1005 SkSerialProcs s_procs;
1006 s_procs.fTypefaceProc = [](SkTypeface*, void* ctx) -> sk_sp<SkData> {
1007 return SkData::MakeUninitialized(1u);
1008 };
1009 auto serialized = blob->serialize(s_procs);
1010
1011 SkDeserialProcs d_procs;
1012 d_procs.fTypefaceCtx = &clientTf;
1013 d_procs.fTypefaceProc = [](const void* data, size_t length, void* ctx) -> sk_sp<SkTypeface> {
1014 return *(static_cast<sk_sp<SkTypeface>*>(ctx));
1015 };
1016 return SkTextBlob::Deserialize(serialized->data(), serialized->size(), d_procs);
1017 }
static sk_sp< SkData > MakeUninitialized(size_t length)
Definition: SkData.cpp:116
Definition: SkFont.h:35
static sk_sp< SkTextBlob > MakeFromText(const void *text, size_t byteLength, const SkFont &font, SkTextEncoding encoding=SkTextEncoding::kUTF8)
Definition: SkTextBlob.cpp:788
static sk_sp< SkTextBlob > Deserialize(const void *data, size_t size, const SkDeserialProcs &procs)
Definition: SkTextBlob.cpp:855
const Paint & paint
Definition: color_source.cc:38
size_t length
std::u16string text
SkFont DefaultFont()
font
Font Metadata and Metrics.
SkDeserialTypefaceProc fTypefaceProc
SkSerialTypefaceProc fTypefaceProc
Definition: SkSerialProcs.h:93
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

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