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

Public Member Functions

 ThinRectsGM (bool round)
 
- 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
 

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 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 23 of file thinrects.cpp.

Constructor & Destructor Documentation

◆ ThinRectsGM()

skiagm::ThinRectsGM::ThinRectsGM ( bool  round)
inline

Definition at line 25 of file thinrects.cpp.

25 : fRound(round) {
26 this->setBGColor(0xFF000000);
27 }
static void round(SkPoint *p)
void setBGColor(SkColor)
Definition gm.cpp:159

Member Function Documentation

◆ getISize()

SkISize skiagm::ThinRectsGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 32 of file thinrects.cpp.

32{ return SkISize::Make(240, 320); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition SkSize.h:20

◆ getName()

SkString skiagm::ThinRectsGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 30 of file thinrects.cpp.

30{ return SkString(fRound ? "thinroundrects" : "thinrects"); }

◆ onDraw()

void skiagm::ThinRectsGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 34 of file thinrects.cpp.

34 {
35
36 SkPaint white;
38 white.setAntiAlias(true);
39
40 SkPaint green;
42 green.setAntiAlias(true);
43
44 for (int i = 0; i < 8; ++i) {
45 canvas->save();
46 canvas->translate(i*0.125f, i*40.0f);
47 this->drawVertRects(canvas, white);
48
49 canvas->translate(40.0f, 0.0f);
50 this->drawVertRects(canvas, green);
51 canvas->restore();
52
53 canvas->save();
54 canvas->translate(80.0f, i*40.0f + i*0.125f);
55 this->drawHorizRects(canvas, white);
56
57 canvas->translate(40.0f, 0.0f);
58 this->drawHorizRects(canvas, green);
59 canvas->restore();
60
61 canvas->save();
62 canvas->translate(160.0f + i*0.125f,
63 i*40.0f + i*0.125f);
64 this->drawSquares(canvas, white);
65
66 canvas->translate(40.0f, 0.0f);
67 this->drawSquares(canvas, green);
68 canvas->restore();
69 }
70 }
constexpr SkColor SK_ColorGREEN
Definition SkColor.h:131
constexpr SkColor SK_ColorWHITE
Definition SkColor.h:122
void restore()
Definition SkCanvas.cpp:465
void translate(SkScalar dx, SkScalar dy)
int save()
Definition SkCanvas.cpp:451
void setColor(SkColor color)
Definition SkPaint.cpp:119
void setAntiAlias(bool aa)
Definition SkPaint.h:170

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