Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
FontCacheGM Class Reference
Inheritance diagram for FontCacheGM:
skiagm::GM

Public Member Functions

 FontCacheGM (GrContextOptions::Enable allowMultipleTextures)
 
void modifyGrContextOptions (GrContextOptions *options) override
 
- 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 SkISize getISize ()=0
 
virtual SkString getName () const =0
 
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
 

Protected Member Functions

SkString getName () const override
 
SkISize getISize () override
 
void onOnceBeforeDraw () override
 
void onDraw (SkCanvas *canvas) override
 
- Protected Member Functions inherited from skiagm::GM
virtual DrawResult onGpuSetup (SkCanvas *, SkString *, GraphiteTestContext *)
 
virtual void onGpuTeardown ()
 
virtual void onOnceBeforeDraw ()
 
virtual DrawResult onDraw (SkCanvas *, SkString *errorMsg)
 
virtual void onDraw (SkCanvas *)
 
virtual bool onAnimate (double)
 
virtual bool onGetControls (SkMetaData *)
 
virtual void onSetControls (const SkMetaData &)
 
GraphiteTestContextgraphiteTestContext () const
 

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
 
- Static Public Attributes inherited from skiagm::GM
static constexpr char kErrorMsg_DrawSkippedGpuOnly []
 

Detailed Description

Definition at line 39 of file fontcache.cpp.

Constructor & Destructor Documentation

◆ FontCacheGM()

FontCacheGM::FontCacheGM ( GrContextOptions::Enable  allowMultipleTextures)
inline

Definition at line 41 of file fontcache.cpp.

42 : fAllowMultipleTextures(allowMultipleTextures) {
44 }
constexpr SkColor SK_ColorLTGRAY
Definition: SkColor.h:118
void setBGColor(SkColor)
Definition: gm.cpp:159

Member Function Documentation

◆ getISize()

SkISize FontCacheGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 60 of file fontcache.cpp.

60{ return SkISize::Make(kSize, kSize); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString FontCacheGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 52 of file fontcache.cpp.

52 {
53 SkString name("fontcache");
54 if (GrContextOptions::Enable::kYes == fAllowMultipleTextures) {
55 name.append("-mt");
56 }
57 return name;
58 }
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ modifyGrContextOptions()

void FontCacheGM::modifyGrContextOptions ( GrContextOptions options)
inlineoverridevirtual

Reimplemented from skiagm::GM.

Definition at line 46 of file fontcache.cpp.

46 {
47 options->fGlyphCacheTextureMaximumBytes = 0;
48 options->fAllowMultipleGlyphCacheTextures = fAllowMultipleTextures;
49 }
const char * options

◆ onDraw()

void FontCacheGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 71 of file fontcache.cpp.

71 {
72 this->drawText(canvas);
73 // Debugging tool for GPU.
74 static const bool kShowAtlas = false;
75 if (kShowAtlas) {
76 if (auto dContext = GrAsDirectContext(canvas->recordingContext())) {
77 auto img = dContext->priv().testingOnly_getFontAtlasImage(MaskFormat::kA8);
78 canvas->drawImage(img, 0, 0);
79 }
80 }
81 }
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
virtual GrRecordingContext * recordingContext() const
Definition: SkCanvas.cpp:1637
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528

◆ onOnceBeforeDraw()

void FontCacheGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 62 of file fontcache.cpp.

62 {
64 fTypefaces[1] = ToolUtils::CreatePortableTypeface("sans-serif", SkFontStyle::Italic());
66 fTypefaces[3] = ToolUtils::CreatePortableTypeface("sans-serif", SkFontStyle::Normal());
67 fTypefaces[4] = ToolUtils::CreatePortableTypeface("serif", SkFontStyle::Bold());
68 fTypefaces[5] = ToolUtils::CreatePortableTypeface("sans-serif", SkFontStyle::Bold());
69 }
static constexpr SkFontStyle Italic()
Definition: SkFontStyle.h:72
static constexpr SkFontStyle Bold()
Definition: SkFontStyle.h:69
static constexpr SkFontStyle Normal()
Definition: SkFontStyle.h:66
sk_sp< SkTypeface > CreatePortableTypeface(const char *name, SkFontStyle style)

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