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

Protected Member Functions

void onOnceBeforeDraw () override
 
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
 

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 283 of file strokes.cpp.

Member Function Documentation

◆ getISize()

SkISize Strokes2GM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 298 of file strokes.cpp.

298{ 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 Strokes2GM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 296 of file strokes.cpp.

296{ return SkString("strokes_poly"); }

◆ onDraw()

void Strokes2GM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 300 of file strokes.cpp.

300 {
301 canvas->drawColor(SK_ColorWHITE);
302
305 paint.setStrokeWidth(SkIntToScalar(9)/2);
306
307 for (int y = 0; y < 2; y++) {
308 paint.setAntiAlias(!!y);
309 SkAutoCanvasRestore acr(canvas, true);
310 canvas->translate(0, SH * y);
312 SkIntToScalar(2),
313 SW - SkIntToScalar(2),
314 SH - SkIntToScalar(2)));
315
316 SkRandom rand;
317 for (int i = 0; i < N/2; i++) {
318 SkRect r;
319 rnd_rect(&r, &paint, rand);
320 canvas->rotate(SkIntToScalar(15), SW/2, SH/2);
321 canvas->drawPath(fPath, paint);
322 }
323 }
324 }
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
#define SkIntToScalar(x)
Definition: SkScalar.h:57
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
Definition: SkCanvas.h:1182
void rotate(SkScalar degrees)
Definition: SkCanvas.cpp:1300
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
const Paint & paint
Definition: color_source.cc:38
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
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646

◆ onOnceBeforeDraw()

void Strokes2GM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 286 of file strokes.cpp.

286 {
287 SkRandom rand;
288 fPath.moveTo(0, 0);
289 for (int i = 0; i < 13; i++) {
290 SkScalar x = rand.nextUScalar1() * (W >> 1);
291 SkScalar y = rand.nextUScalar1() * (H >> 1);
292 fPath.lineTo(x, y);
293 }
294 }
SkPath & moveTo(SkScalar x, SkScalar y)
Definition: SkPath.cpp:688
SkPath & lineTo(SkScalar x, SkScalar y)
Definition: SkPath.cpp:728
SkScalar nextUScalar1()
Definition: SkRandom.h:101
float SkScalar
Definition: extension.cpp:12
double x

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