Flutter Engine
The Flutter Engine
Protected Member Functions | Protected Attributes | List of all members
skiagm::ShapesGM Class Referenceabstract
Inheritance diagram for skiagm::ShapesGM:
skiagm::GM skiagm::InnerShapesGM skiagm::SimpleShapesGM

Protected Member Functions

 ShapesGM (const char *name, bool antialias)
 
SkString getName () const override
 
SkISize getISize () override
 
void onOnceBeforeDraw () override
 
void onDraw (SkCanvas *canvas) override
 
virtual void drawShapes (SkCanvas *canvas) const =0
 
- 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
 

Protected Attributes

SkString fName
 
bool fAntialias
 
SkPaint fPaint
 
TArray< SkRRectfShapes
 
TArray< SkScalarfRotations
 
int fSimpleShapeCount
 

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 33 of file shapes.cpp.

Constructor & Destructor Documentation

◆ ShapesGM()

skiagm::ShapesGM::ShapesGM ( const char *  name,
bool  antialias 
)
inlineprotected

Definition at line 35 of file shapes.cpp.

35 : fName(name), fAntialias(antialias) {
36 if (!antialias) {
37 fName.append("_bw");
38 }
39 }
void append(const char text[])
Definition: SkString.h:203
SkString fName
Definition: shapes.cpp:91
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

Member Function Documentation

◆ drawShapes()

virtual void skiagm::ShapesGM::drawShapes ( SkCanvas canvas) const
protectedpure virtual

◆ getISize()

SkISize skiagm::ShapesGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 42 of file shapes.cpp.

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

◆ getName()

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

Implements skiagm::GM.

Definition at line 41 of file shapes.cpp.

41{ return fName; }

◆ onDraw()

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

Reimplemented from skiagm::GM.

Definition at line 79 of file shapes.cpp.

79 {
80 canvas->clear(SK_ColorWHITE);
81
82 canvas->save();
83 canvas->translate(canvas->imageInfo().width() / 2.f, canvas->imageInfo().height() / 2.f);
84 this->drawShapes(canvas);
85 canvas->restore();
86 }
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void clear(SkColor color)
Definition: SkCanvas.h:1199
int save()
Definition: SkCanvas.cpp:447
SkImageInfo imageInfo() const
Definition: SkCanvas.cpp:1206
virtual void drawShapes(SkCanvas *canvas) const =0
int width() const
Definition: SkImageInfo.h:365
int height() const
Definition: SkImageInfo.h:371

◆ onOnceBeforeDraw()

void skiagm::ShapesGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 44 of file shapes.cpp.

44 {
45 fShapes.push_back().setOval(SkRect::MakeXYWH(-5, 25, 200, 100));
47
48 fShapes.push_back().setRect(SkRect::MakeXYWH(95, 75, 125, 100));
50
51 fShapes.push_back().setRectXY(SkRect::MakeXYWH(0, 75, 150, 100), 1e-5f, 1e-5f);
53
54 fShapes.push_back().setRectXY(SkRect::MakeXYWH(15, -20, 100, 100), 20, 15);
56
58
59 fShapes.push_back().setNinePatch(SkRect::MakeXYWH(140, -50, 90, 110), 10, 5, 25, 35);
61
62 fShapes.push_back().setNinePatch(SkRect::MakeXYWH(160, -60, 60, 90), 10, 60, 50, 30);
64
65 fShapes.push_back().setNinePatch(SkRect::MakeXYWH(220, -120, 60, 90), 1, 89, 59, 1);
67
68 SkVector radii[4] = {{4, 6}, {12, 8}, {24, 16}, {32, 48}};
69 fShapes.push_back().setRectRadii(SkRect::MakeXYWH(150, -129, 80, 160), radii);
71
72 SkVector radii2[4] = {{0, 0}, {80, 60}, {0, 0}, {80, 60}};
73 fShapes.push_back().setRectRadii(SkRect::MakeXYWH(180, -30, 80, 60), radii2);
75
77 }
void setAntiAlias(bool aa)
Definition: SkPaint.h:170
void setOval(const SkRect &oval)
Definition: SkRRect.cpp:30
void setRectRadii(const SkRect &rect, const SkVector radii[4])
Definition: SkRRect.cpp:189
void setRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
Definition: SkRRect.cpp:52
void setNinePatch(const SkRect &rect, SkScalar leftRad, SkScalar topRad, SkScalar rightRad, SkScalar bottomRad)
Definition: SkRRect.cpp:115
void setRect(const SkRect &rect)
Definition: SkRRect.h:126
int size() const
Definition: SkTArray.h:421
SkPaint fPaint
Definition: shapes.cpp:93
int fSimpleShapeCount
Definition: shapes.cpp:96
TArray< SkScalar > fRotations
Definition: shapes.cpp:95
TArray< SkRRect > fShapes
Definition: shapes.cpp:94
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659

Member Data Documentation

◆ fAntialias

bool skiagm::ShapesGM::fAntialias
protected

Definition at line 92 of file shapes.cpp.

◆ fName

SkString skiagm::ShapesGM::fName
protected

Definition at line 91 of file shapes.cpp.

◆ fPaint

SkPaint skiagm::ShapesGM::fPaint
protected

Definition at line 93 of file shapes.cpp.

◆ fRotations

TArray<SkScalar> skiagm::ShapesGM::fRotations
protected

Definition at line 95 of file shapes.cpp.

◆ fShapes

TArray<SkRRect> skiagm::ShapesGM::fShapes
protected

Definition at line 94 of file shapes.cpp.

◆ fSimpleShapeCount

int skiagm::ShapesGM::fSimpleShapeCount
protected

Definition at line 96 of file shapes.cpp.


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