Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
SkTestScalerContext Class Reference
Inheritance diagram for SkTestScalerContext:
SkScalerContext

Public Member Functions

 SkTestScalerContext (sk_sp< TestTypeface > face, const SkScalerContextEffects &effects, const SkDescriptor *desc)
 
- 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

TestTypefacegetTestTypeface () const
 
GlyphMetrics generateMetrics (const SkGlyph &glyph, SkArenaAlloc *) override
 
void generateImage (const SkGlyph &, void *) override
 
bool generatePath (const SkGlyph &glyph, SkPath *path) override
 
void generateFontMetrics (SkFontMetrics *metrics) override
 
- 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 247 of file TestTypeface.cpp.

Constructor & Destructor Documentation

◆ SkTestScalerContext()

SkTestScalerContext::SkTestScalerContext ( sk_sp< TestTypeface face,
const SkScalerContextEffects effects,
const SkDescriptor desc 
)
inline

Definition at line 249 of file TestTypeface.cpp.

252 : SkScalerContext(std::move(face), effects, desc) {
253 fRec.getSingleMatrix(&fMatrix);
255 }
void forceGenerateImageFromPath()
SkScalerContext(sk_sp< SkTypeface >, const SkScalerContextEffects &, const SkDescriptor *)
SkScalerContextRec fRec
void getSingleMatrix(SkMatrix *) const

Member Function Documentation

◆ generateFontMetrics()

void SkTestScalerContext::generateFontMetrics ( SkFontMetrics )
inlineoverrideprotectedvirtual

Retrieves font metrics.

Implements SkScalerContext.

Definition at line 282 of file TestTypeface.cpp.

282 {
283 this->getTestTypeface()->getFontMetrics(metrics);
284 SkFontPriv::ScaleFontMetrics(metrics, fMatrix.getScaleY());
285 }
static void ScaleFontMetrics(SkFontMetrics *, SkScalar)
Definition: SkFont.cpp:336
SkScalar getScaleY() const
Definition: SkMatrix.h:422
TestTypeface * getTestTypeface() const
void getFontMetrics(SkFontMetrics *metrics)

◆ generateImage()

void SkTestScalerContext::generateImage ( const SkGlyph glyph,
void *  imageBuffer 
)
inlineoverrideprotectedvirtual

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 273 of file TestTypeface.cpp.

273 {
274 SK_ABORT("Should have generated from path.");
275 }
#define SK_ABORT(message,...)
Definition: SkAssert.h:70

◆ generateMetrics()

GlyphMetrics SkTestScalerContext::generateMetrics ( const SkGlyph glyph,
SkArenaAlloc  
)
inlineoverrideprotectedvirtual

Implements SkScalerContext.

Definition at line 262 of file TestTypeface.cpp.

262 {
263 GlyphMetrics mx(glyph.maskFormat());
264
265 auto advance = this->getTestTypeface()->getAdvance(glyph.getGlyphID());
266
267 mx.advance = fMatrix.mapXY(advance.fX, advance.fY);
268 return mx;
269
270 // Always generates from paths, so SkScalerContext::makeGlyph will figure the bounds.
271 }
SkGlyphID getGlyphID() const
Definition: SkGlyph.h:429
SkMask::Format maskFormat() const
Definition: SkGlyph.h:500
void mapXY(SkScalar x, SkScalar y, SkPoint *result) const
Definition: SkMatrix.cpp:777
SkVector getAdvance(SkGlyphID) const

◆ generatePath()

bool SkTestScalerContext::generatePath ( const SkGlyph ,
SkPath  
)
inlineoverrideprotectedvirtual

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 277 of file TestTypeface.cpp.

277 {
278 *path = this->getTestTypeface()->getPath(glyph.getGlyphID()).makeTransform(fMatrix);
279 return true;
280 }
SkPath makeTransform(const SkMatrix &m, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
Definition: SkPath.h:1400
SkPath getPath(SkGlyphID glyph)
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
Definition: switches.h:57

◆ getTestTypeface()

TestTypeface * SkTestScalerContext::getTestTypeface ( ) const
inlineprotected

Definition at line 258 of file TestTypeface.cpp.

258 {
259 return static_cast<TestTypeface*>(this->getTypeface());
260 }
SkTypeface * getTypeface() const

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