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

Public Member Functions

 StrokesGM ()
 
- 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 56 of file strokes.cpp.

Constructor & Destructor Documentation

◆ StrokesGM()

StrokesGM::StrokesGM ( )
inline

Definition at line 58 of file strokes.cpp.

58{}

Member Function Documentation

◆ getISize()

SkISize StrokesGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 63 of file strokes.cpp.

63{ return SkISize::Make(W, H * 2); }
#define W
Definition strokes.cpp:33
Definition SkMD5.cpp:130
static constexpr SkISize Make(int32_t w, int32_t h)
Definition SkSize.h:20

◆ getName()

SkString StrokesGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 61 of file strokes.cpp.

61{ return SkString("strokes_round"); }

◆ onDraw()

void StrokesGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 72 of file strokes.cpp.

72 {
75 paint.setStrokeWidth(SkIntToScalar(9)/2);
76
77 for (int y = 0; y < 2; y++) {
78 paint.setAntiAlias(!!y);
79 SkAutoCanvasRestore acr(canvas, true);
80 canvas->translate(0, SH * y);
83 , SW - SkIntToScalar(2), SH - SkIntToScalar(2)
84 ));
85
86 SkRandom rand;
87 for (int i = 0; i < N; i++) {
88 SkRect r;
89 rnd_rect(&r, &paint, rand);
90 canvas->drawOval(r, paint);
91 rnd_rect(&r, &paint, rand);
92 canvas->drawRoundRect(r, r.width()/4, r.height()/4, paint);
93 rnd_rect(&r, &paint, rand);
94 }
95 }
96 }
#define SkIntToScalar(x)
Definition SkScalar.h:57
void drawOval(const SkRect &oval, const SkPaint &paint)
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void translate(SkScalar dx, SkScalar dy)
void drawRoundRect(const SkRect &rect, SkScalar rx, SkScalar ry, const SkPaint &paint)
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
const Paint & paint
double y
#define N
Definition strokes.cpp:35
constexpr SkScalar SH
Definition strokes.cpp:38
constexpr SkScalar SW
Definition strokes.cpp:37
static void rnd_rect(SkRect *r, SkPaint *paint, SkRandom &rand)
Definition strokes.cpp:40
constexpr float height() const
Definition SkRect.h:769
constexpr float width() const
Definition SkRect.h:762
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition SkRect.h:646

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