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

Public Member Functions

 ArcOfZorroGM ()
 
- 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
 

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
 

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 arcofzorro.cpp.

Constructor & Destructor Documentation

◆ ArcOfZorroGM()

skiagm::ArcOfZorroGM::ArcOfZorroGM ( )
inline

Definition at line 25 of file arcofzorro.cpp.

25 {
26 this->setBGColor(0xFFCCCCCC);
27 }
void setBGColor(SkColor)
Definition: gm.cpp:159

Member Function Documentation

◆ getISize()

SkISize skiagm::ArcOfZorroGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 32 of file arcofzorro.cpp.

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

◆ getName()

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

Implements skiagm::GM.

Definition at line 30 of file arcofzorro.cpp.

30{ return SkString("arcofzorro"); }

◆ onDraw()

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

Reimplemented from skiagm::GM.

Definition at line 34 of file arcofzorro.cpp.

34 {
35 SkRandom rand;
36
37 SkRect rect = SkRect::MakeXYWH(10, 10, 200, 200);
38
39 SkPaint p;
40
41 p.setStyle(SkPaint::kStroke_Style);
42 p.setStrokeWidth(35);
43 int xOffset = 0, yOffset = 0;
44 int direction = 0;
45
46 for (float arc = 134.0f; arc < 136.0f; arc += 0.01f) {
47 SkColor color = rand.nextU();
48 color |= 0xff000000;
49 p.setColor(color);
50
51 canvas->save();
52 canvas->translate(SkIntToScalar(xOffset), SkIntToScalar(yOffset));
53 canvas->drawArc(rect, 0, arc, false, p);
54 canvas->restore();
55
56 switch (direction) {
57 case 0:
58 xOffset += 10;
59 if (xOffset >= 700) {
60 direction = 1;
61 }
62 break;
63 case 1:
64 xOffset -= 10;
65 yOffset += 10;
66 if (xOffset < 50) {
67 direction = 2;
68 }
69 break;
70 case 2:
71 xOffset += 10;
72 break;
73 }
74 }
75
76 }
uint32_t SkColor
Definition: SkColor.h:37
#define SkIntToScalar(x)
Definition: SkScalar.h:57
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawArc(const SkRect &oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, const SkPaint &paint)
Definition: SkCanvas.cpp:2728
int save()
Definition: SkCanvas.cpp:447
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
uint32_t nextU()
Definition: SkRandom.h:42
DlColor color
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659

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