Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Private Member Functions | List of all members
FontMgrMatchGM Class Reference
Inheritance diagram for FontMgrMatchGM:
skiagm::GM

Private Member Functions

void onOnceBeforeDraw () override
 
SkString getName () const override
 
SkISize getISize () override
 
DrawResult onDraw (SkCanvas *canvas, SkString *errorMsg) override
 

Additional Inherited Members

- Public Types inherited from skiagm::GM
enum  Mode { kGM_Mode , kSample_Mode , kBench_Mode }
 
using DrawResult = skiagm::DrawResult
 
using GraphiteTestContext = skiatest::graphite::GraphiteTestContext
 
- Public Member Functions inherited from skiagm::GM
 GM (SkColor backgroundColor=SK_ColorWHITE)
 
virtual ~GM ()
 
void setMode (Mode mode)
 
Mode getMode () const
 
DrawResult gpuSetup (SkCanvas *, SkString *errorMsg, GraphiteTestContext *=nullptr)
 
void gpuTeardown ()
 
void onceBeforeDraw ()
 
DrawResult draw (SkCanvas *canvas)
 
DrawResult draw (SkCanvas *, SkString *errorMsg)
 
void drawBackground (SkCanvas *)
 
DrawResult drawContent (SkCanvas *canvas)
 
DrawResult drawContent (SkCanvas *, SkString *errorMsg)
 
virtual bool runAsBench () const
 
SkScalar width ()
 
SkScalar height ()
 
SkColor getBGColor () const
 
void setBGColor (SkColor)
 
void drawSizeBounds (SkCanvas *, SkColor)
 
bool animate (double)
 
virtual bool onChar (SkUnichar)
 
bool getControls (SkMetaData *controls)
 
void setControls (const SkMetaData &controls)
 
virtual void modifyGrContextOptions (GrContextOptions *)
 
virtual void modifyGraphiteContextOptions (skgpu::graphite::ContextOptions *) const
 
virtual bool isBazelOnly () const
 
virtual std::map< std::string, std::string > getGoldKeys () const
 
- Static Public Attributes inherited from skiagm::GM
static constexpr char kErrorMsg_DrawSkippedGpuOnly []
 
- Protected Member Functions inherited from skiagm::GM
virtual DrawResult onGpuSetup (SkCanvas *, SkString *, GraphiteTestContext *)
 
virtual void onGpuTeardown ()
 
virtual void onDraw (SkCanvas *)
 
virtual bool onAnimate (double)
 
virtual bool onGetControls (SkMetaData *)
 
virtual void onSetControls (const SkMetaData &)
 
GraphiteTestContextgraphiteTestContext () const
 

Detailed Description

Definition at line 130 of file fontmgr.cpp.

Member Function Documentation

◆ getISize()

SkISize FontMgrMatchGM::getISize ( )
inlineoverrideprivatevirtual

Implements skiagm::GM.

Definition at line 140 of file fontmgr.cpp.

140{ return {640, 1024}; }

◆ getName()

SkString FontMgrMatchGM::getName ( ) const
inlineoverrideprivatevirtual

Implements skiagm::GM.

Definition at line 138 of file fontmgr.cpp.

138{ return SkString("fontmgr_match"); }

◆ onDraw()

DrawResult FontMgrMatchGM::onDraw ( SkCanvas canvas,
SkString errorMsg 
)
inlineoverrideprivatevirtual

Reimplemented from skiagm::GM.

Definition at line 178 of file fontmgr.cpp.

178 {
181 font.setSubpixel(true);
182 font.setSize(17);
183
184 const char* gNames[] = {
185 "Helvetica Neue", "Arial", "sans"
186 };
187
189 for (size_t i = 0; i < std::size(gNames); ++i) {
190 fset = fFM->matchFamily(gNames[i]);
191 if (fset->count() > 0) {
192 break;
193 }
194 }
195 if (!fset || fset->count() == 0) {
196 *errorMsg = "No SkFontStyleSet";
197 return DrawResult::kSkip;
198 }
199
200 canvas->translate(20, 40);
201 this->exploreFamily(canvas, font, fset.get());
202 canvas->translate(150, 0);
203 this->iterateFamily(canvas, font, fset.get());
204 return DrawResult::kOk;
205 }
void translate(SkScalar dx, SkScalar dy)
sk_sp< SkFontStyleSet > matchFamily(const char familyName[]) const
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
T * get() const
Definition SkRefCnt.h:303
SkFont DefaultFont()
font
Font Metadata and Metrics.

◆ onOnceBeforeDraw()

void FontMgrMatchGM::onOnceBeforeDraw ( )
inlineoverrideprivatevirtual

Reimplemented from skiagm::GM.

Definition at line 133 of file fontmgr.cpp.

133 {
135 SkGraphics::SetFontCacheLimit(16 * 1024 * 1024);
136 }
static size_t SetFontCacheLimit(size_t bytes)
sk_sp< SkFontMgr > TestFontMgr()

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