Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
SkScalerContextProxy Class Reference

#include <SkTypeface_remote.h>

Inheritance diagram for SkScalerContextProxy:
SkScalerContext

Public Member Functions

 SkScalerContextProxy (sk_sp< SkTypeface > tf, const SkScalerContextEffects &effects, const SkDescriptor *desc, sk_sp< SkStrikeClient::DiscardableHandleManager > manager)
 
- Public Member Functions inherited from SkScalerContext
 SkScalerContext (sk_sp< SkTypeface >, const SkScalerContextEffects &, const SkDescriptor *)
 
virtual ~SkScalerContext ()
 
SkTypefacegetTypeface () const
 
SkMask::Format getMaskFormat () const
 
bool isSubpixel () const
 
bool isLinearMetrics () const
 
bool isVertical () const
 
SkGlyph makeGlyph (SkPackedGlyphID, SkArenaAlloc *)
 
void getImage (const SkGlyph &)
 
void getPath (SkGlyph &, SkArenaAlloc *)
 
sk_sp< SkDrawablegetDrawable (SkGlyph &)
 
void getFontMetrics (SkFontMetrics *)
 
const SkScalerContextRecgetRec () const
 
SkScalerContextEffects getEffects () const
 
SkAxisAlignment computeAxisAlignmentForHText () const
 

Protected Member Functions

GlyphMetrics generateMetrics (const SkGlyph &, SkArenaAlloc *) override
 
void generateImage (const SkGlyph &, void *) override
 
bool generatePath (const SkGlyph &glyph, SkPath *path) override
 
sk_sp< SkDrawablegenerateDrawable (const SkGlyph &) override
 
void generateFontMetrics (SkFontMetrics *metrics) override
 
SkTypefaceProxygetProxyTypeface () const
 
- Protected Member Functions inherited from SkScalerContext
virtual GlyphMetrics generateMetrics (const SkGlyph &, SkArenaAlloc *)=0
 
virtual void generateImage (const SkGlyph &glyph, void *imageBuffer)=0
 
virtual bool generatePath (const SkGlyph &, SkPath *)=0
 
virtual sk_sp< SkDrawablegenerateDrawable (const SkGlyph &)
 
virtual void generateFontMetrics (SkFontMetrics *)=0
 
void forceGenerateImageFromPath ()
 
void forceOffGenerateImageFromPath ()
 

Additional Inherited Members

- Public Types inherited from SkScalerContext
enum  Flags {
  kFrameAndFill_Flag = 0x0001 , kUnused = 0x0002 , kEmbeddedBitmapText_Flag = 0x0004 , kEmbolden_Flag = 0x0008 ,
  kSubpixelPositioning_Flag = 0x0010 , kForceAutohinting_Flag = 0x0020 , kHinting_Shift = 7 , kHintingBit1_Flag = 0x0080 ,
  kHintingBit2_Flag = 0x0100 , kLCD_Vertical_Flag = 0x0200 , kLCD_BGROrder_Flag = 0x0400 , kGenA8FromLCD_Flag = 0x0800 ,
  kLinearMetrics_Flag = 0x1000 , kBaselineSnap_Flag = 0x2000 , kNeedsForegroundColor_Flag = 0x4000
}
 
enum  { kHinting_Mask = kHintingBit1_Flag | kHintingBit2_Flag }
 
- Static Public Member Functions inherited from SkScalerContext
static size_t GetGammaLUTSize (SkScalar contrast, SkScalar deviceGamma, int *width, int *height)
 
static bool GetGammaLUTData (SkScalar contrast, SkScalar deviceGamma, uint8_t *data)
 
static void MakeRecAndEffects (const SkFont &font, const SkPaint &paint, const SkSurfaceProps &surfaceProps, SkScalerContextFlags scalerContextFlags, const SkMatrix &deviceMatrix, SkScalerContextRec *rec, SkScalerContextEffects *effects)
 
static void MakeRecAndEffectsFromFont (const SkFont &font, SkScalerContextRec *rec, SkScalerContextEffects *effects)
 
static std::unique_ptr< SkScalerContextMakeEmpty (sk_sp< SkTypeface > typeface, const SkScalerContextEffects &effects, const SkDescriptor *desc)
 
static SkDescriptorAutoDescriptorGivenRecAndEffects (const SkScalerContextRec &rec, const SkScalerContextEffects &effects, SkAutoDescriptor *ad)
 
static std::unique_ptr< SkDescriptorDescriptorGivenRecAndEffects (const SkScalerContextRec &rec, const SkScalerContextEffects &effects)
 
static void DescriptorBufferGiveRec (const SkScalerContextRec &rec, void *buffer)
 
static bool CheckBufferSizeForRec (const SkScalerContextRec &rec, const SkScalerContextEffects &effects, size_t size)
 
static SkMaskGamma::PreBlend GetMaskPreBlend (const SkScalerContextRec &rec)
 
static SkDescriptorCreateDescriptorAndEffectsUsingPaint (const SkFont &, const SkPaint &, const SkSurfaceProps &, SkScalerContextFlags scalerContextFlags, const SkMatrix &deviceMatrix, SkAutoDescriptor *ad, SkScalerContextEffects *effects)
 
- Static Protected Member Functions inherited from SkScalerContext
static void GenerateMetricsFromPath (SkGlyph *glyph, const SkPath &path, SkMask::Format format, bool verticalLCD, bool a8FromLCD, bool hairline)
 
static void SaturateGlyphBounds (SkGlyph *glyph, SkRect &&)
 
static void SaturateGlyphBounds (SkGlyph *glyph, SkIRect const &)
 
static void GenerateImageFromPath (SkMaskBuilder &dst, const SkPath &path, const SkMaskGamma::PreBlend &maskPreBlend, bool doBGR, bool verticalLCD, bool a8FromLCD, bool hairline)
 
- Protected Attributes inherited from SkScalerContext
SkScalerContextRec fRec
 
const SkMaskGamma::PreBlend fPreBlend
 

Detailed Description

Definition at line 39 of file SkTypeface_remote.h.

Constructor & Destructor Documentation

◆ SkScalerContextProxy()

SkScalerContextProxy::SkScalerContextProxy ( sk_sp< SkTypeface tf,
const SkScalerContextEffects effects,
const SkDescriptor desc,
sk_sp< SkStrikeClient::DiscardableHandleManager manager 
)

Definition at line 27 of file SkTypeface_remote.cpp.

31 : SkScalerContext{std::move(tf), effects, desc}
32 , fDiscardableManager{std::move(manager)} {}
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font manager
Definition: switches.h:218

Member Function Documentation

◆ generateDrawable()

sk_sp< SkDrawable > SkScalerContextProxy::generateDrawable ( const SkGlyph )
overrideprotectedvirtual

Returns the drawable for the glyph (if any).

The generated drawable will be lifetime scoped to the lifetime of this scaler context. This means the drawable may refer to the scaler context and associated font data.

The drawable does not need to be flattenable (e.g. implement getFactory and getTypeName). Any necessary serialization will be done with makePictureSnapshot.

Reimplemented from SkScalerContext.

Definition at line 71 of file SkTypeface_remote.cpp.

71 {
72 TRACE_EVENT1("skia", "generateDrawable", "rec", TRACE_STR_COPY(this->getRec().dump().c_str()));
73 if (this->getProxyTypeface()->isLogging()) {
74 SkDebugf("GlyphCacheMiss generateDrawable: %s\n", this->getRec().dump().c_str());
75 }
76
77 fDiscardableManager->notifyCacheMiss(
78 SkStrikeClient::CacheMissType::kGlyphDrawable, fRec.fTextSize);
79 return nullptr;
80}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
#define TRACE_STR_COPY(str)
Definition: SkTraceEvent.h:63
static void dump(const float m[20], SkYUVColorSpace cs, bool rgb2yuv)
Definition: SkYUVMath.cpp:629
SkTypefaceProxy * getProxyTypeface() const
SkScalerContextRec fRec
const SkScalerContextRec & getRec() const
virtual void notifyCacheMiss(CacheMissType type, int fontSize)=0
#define TRACE_EVENT1(category_group, name, arg1_name, arg1_val)
Definition: trace_event.h:141

◆ generateFontMetrics()

void SkScalerContextProxy::generateFontMetrics ( SkFontMetrics )
overrideprotectedvirtual

Retrieves font metrics.

Implements SkScalerContext.

Definition at line 82 of file SkTypeface_remote.cpp.

82 {
84 "skia", "generateFontMetrics", "rec", TRACE_STR_COPY(this->getRec().dump().c_str()));
85 if (this->getProxyTypeface()->isLogging()) {
86 SkDebugf("GlyphCacheMiss generateFontMetrics: %s\n", this->getRec().dump().c_str());
87 }
88
89 // Font metrics aren't really used for render, so just zero out the data and return.
90 fDiscardableManager->notifyCacheMiss(
91 SkStrikeClient::CacheMissType::kFontMetrics, fRec.fTextSize);
92 sk_bzero(metrics, sizeof(*metrics));
93}
sk_bzero(glyphs, sizeof(glyphs))

◆ generateImage()

void SkScalerContextProxy::generateImage ( const SkGlyph glyph,
void *  imageBuffer 
)
overrideprotectedvirtual

Generates the contents of glyph.fImage. When called, glyph.fImage will be pointing to a pre-allocated, uninitialized region of memory of size glyph.imageSize(). This method may not change glyph.fMaskFormat.

Because glyph.imageSize() will determine the size of fImage, generateMetrics will be called before generateImage.

Implements SkScalerContext.

Definition at line 48 of file SkTypeface_remote.cpp.

48 {
49 TRACE_EVENT1("skia", "generateImage", "rec", TRACE_STR_COPY(this->getRec().dump().c_str()));
50 if (this->getProxyTypeface()->isLogging()) {
51 SkDebugf("GlyphCacheMiss generateImage: %s\n", this->getRec().dump().c_str());
52 }
53
54 // There is no desperation search here, because if there was an image to be found it was
55 // copied over with the metrics search.
56 fDiscardableManager->notifyCacheMiss(
57 SkStrikeClient::CacheMissType::kGlyphImage, fRec.fTextSize);
58}

◆ generateMetrics()

SkScalerContext::GlyphMetrics SkScalerContextProxy::generateMetrics ( const SkGlyph glyph,
SkArenaAlloc  
)
overrideprotectedvirtual

Implements SkScalerContext.

Definition at line 34 of file SkTypeface_remote.cpp.

35 {
36 TRACE_EVENT1("skia", "generateMetrics", "rec", TRACE_STR_COPY(this->getRec().dump().c_str()));
37 if (this->getProxyTypeface()->isLogging()) {
38 SkDebugf("GlyphCacheMiss generateMetrics looking for glyph: %x\n generateMetrics: %s\n",
39 glyph.getPackedID().value(), this->getRec().dump().c_str());
40 }
41
42 fDiscardableManager->notifyCacheMiss(
43 SkStrikeClient::CacheMissType::kGlyphMetrics, fRec.fTextSize);
44
45 return {glyph.maskFormat()};
46}
SkMask::Format maskFormat() const
Definition: SkGlyph.h:500
SkPackedGlyphID getPackedID() const
Definition: SkGlyph.h:430
uint32_t value() const
Definition: SkGlyph.h:110

◆ generatePath()

bool SkScalerContextProxy::generatePath ( const SkGlyph ,
SkPath  
)
overrideprotectedvirtual

Sets the passed path to the glyph outline. If this cannot be done the path is set to empty; Does not apply subpixel positioning to the path.

Returns
false if this glyph does not have any path.

Implements SkScalerContext.

Definition at line 60 of file SkTypeface_remote.cpp.

60 {
61 TRACE_EVENT1("skia", "generatePath", "rec", TRACE_STR_COPY(this->getRec().dump().c_str()));
62 if (this->getProxyTypeface()->isLogging()) {
63 SkDebugf("GlyphCacheMiss generatePath: %s\n", this->getRec().dump().c_str());
64 }
65
66 fDiscardableManager->notifyCacheMiss(
67 SkStrikeClient::CacheMissType::kGlyphPath, fRec.fTextSize);
68 return false;
69}

◆ getProxyTypeface()

SkTypefaceProxy * SkScalerContextProxy::getProxyTypeface ( ) const
protected

Definition at line 161 of file SkTypeface_remote.cpp.

161 {
162 return (SkTypefaceProxy*)this->getTypeface();
163}
SkTypeface * getTypeface() const

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