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

Protected Member Functions

SkString getName () const override
 
SkISize getISize () 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
 

Static Protected Member Functions

static void drawGrad (SkCanvas *canvas)
 

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

Detailed Description

Definition at line 42 of file gammatext.cpp.

Member Function Documentation

◆ drawGrad()

static void GammaTextGM::drawGrad ( SkCanvas canvas)
inlinestaticprotected

Definition at line 48 of file gammatext.cpp.

48 {
49 const SkPoint pts[] = { { 0, 0 }, { 0, SkIntToScalar(HEIGHT) } };
50
51 canvas->clear(SK_ColorRED);
53 paint.setShader(make_heatGradient(pts));
54 SkRect r = { 0, 0, SkIntToScalar(1024), SkIntToScalar(HEIGHT) };
55 canvas->drawRect(r, paint);
56 }
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
#define SkIntToScalar(x)
Definition: SkScalar.h:57
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void clear(SkColor color)
Definition: SkCanvas.h:1199
const Paint & paint
Definition: color_source.cc:38
static sk_sp< SkShader > make_heatGradient(const SkPoint pts[2])
Definition: gammatext.cpp:27
#define HEIGHT
Definition: gammatext.cpp:40

◆ getISize()

SkISize GammaTextGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 46 of file gammatext.cpp.

46{ return SkISize::Make(1024, HEIGHT); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString GammaTextGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 44 of file gammatext.cpp.

44{ return SkString("gammatext"); }

◆ onDraw()

void GammaTextGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 58 of file gammatext.cpp.

58 {
59 drawGrad(canvas);
60
61 const SkColor fg[] = {
62 0xFFFFFFFF,
63 0xFFFFFF00, 0xFFFF00FF, 0xFF00FFFF,
64 0xFFFF0000, 0xFF00FF00, 0xFF0000FF,
65 0xFF000000,
66 };
67
68 const char* text = "Hamburgefons";
69
72 font.setSize(16);
74
76 for (size_t i = 0; i < std::size(fg); ++i) {
77 paint.setColor(fg[i]);
78
81 while (y < stopy) {
82 canvas->drawString(text, x, y, font, paint);
83 y += font.getSize() * 2;
84 }
85 x += SkIntToScalar(1024) / std::size(fg);
86 }
87 }
uint32_t SkColor
Definition: SkColor.h:37
static void drawGrad(SkCanvas *canvas)
Definition: gammatext.cpp:48
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
Definition: SkCanvas.h:1803
Definition: SkFont.h:35
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
float SkScalar
Definition: extension.cpp:12
std::u16string text
double y
double x
SkFont DefaultPortableFont()
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 Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
font
Font Metadata and Metrics.

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