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

Private Member Functions

SkString getName () const override
 
SkISize getISize () override
 
void onDraw (SkCanvas *canvas) 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 onOnceBeforeDraw ()
 
virtual DrawResult onDraw (SkCanvas *, SkString *errorMsg)
 
virtual bool onAnimate (double)
 
virtual bool onGetControls (SkMetaData *)
 
virtual void onSetControls (const SkMetaData &)
 
GraphiteTestContextgraphiteTestContext () const
 

Detailed Description

Definition at line 66 of file lcdtext.cpp.

Member Function Documentation

◆ getISize()

SkISize LcdTextSizeGM::getISize ( )
inlineoverrideprivatevirtual

Implements skiagm::GM.

Definition at line 75 of file lcdtext.cpp.

75{ return {320, 120}; }

◆ getName()

SkString LcdTextSizeGM::getName ( ) const
inlineoverrideprivatevirtual

Implements skiagm::GM.

Definition at line 73 of file lcdtext.cpp.

73{ return SkString("lcdtextsize"); }

◆ onDraw()

void LcdTextSizeGM::onDraw ( SkCanvas canvas)
inlineoverrideprivatevirtual

Reimplemented from skiagm::GM.

Definition at line 77 of file lcdtext.cpp.

77 {
78 const char* lcd_text = "LCD";
79 const char* gray_text = "GRAY";
80
81 constexpr static float kLCDTextSizeLimit = 48;
82
83 const struct {
84 SkPoint fLoc;
85 SkScalar fTextSize;
86 SkScalar fScale;
87 const char* fText;
88 } rec[] = {
89 { { 10, 50 }, kLCDTextSizeLimit - 1, 1, lcd_text },
90 { { 160, 50 }, kLCDTextSizeLimit + 1, 1, gray_text },
91 { { 10, 100 }, kLCDTextSizeLimit / 2, 1.99f, lcd_text },
92 { { 160, 100 }, kLCDTextSizeLimit / 2, 2.01f, gray_text },
93 };
94
95 for (size_t i = 0; i < std::size(rec); ++i) {
96 const SkPoint loc = rec[i].fLoc;
97 SkAutoCanvasRestore acr(canvas, true);
98
101
102 ScaleAbout(canvas, rec[i].fScale, rec[i].fScale, loc.x(), loc.y());
103 canvas->drawString(rec[i].fText, loc.x(), loc.y(), font, SkPaint());
104 }
105 }
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
Definition SkCanvas.h:1803
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
float SkScalar
Definition extension.cpp:12
sk_sp< SkTypeface > DefaultPortableTypeface()
font
Font Metadata and Metrics.
constexpr float y() const
constexpr float x() const

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