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

Public Member Functions

 SimpleShapesGM (bool antialias)
 
- 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
 

Private Member Functions

void drawShapes (SkCanvas *canvas) const override
 

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 []
 
- Protected Member Functions inherited from skiagm::ShapesGM
 ShapesGM (const char *name, bool antialias)
 
SkString getName () const override
 
SkISize getISize () override
 
void onOnceBeforeDraw () override
 
void onDraw (SkCanvas *canvas) override
 
- Protected Member Functions inherited from skiagm::GM
virtual DrawResult onGpuSetup (SkCanvas *, SkString *, GraphiteTestContext *)
 
virtual void onGpuTeardown ()
 
virtual DrawResult onDraw (SkCanvas *, SkString *errorMsg)
 
virtual bool onAnimate (double)
 
virtual bool onGetControls (SkMetaData *)
 
virtual void onSetControls (const SkMetaData &)
 
GraphiteTestContextgraphiteTestContext () const
 
- Protected Attributes inherited from skiagm::ShapesGM
SkString fName
 
bool fAntialias
 
SkPaint fPaint
 
TArray< SkRRectfShapes
 
TArray< SkScalarfRotations
 
int fSimpleShapeCount
 

Detailed Description

Definition at line 102 of file shapes.cpp.

Constructor & Destructor Documentation

◆ SimpleShapesGM()

skiagm::SimpleShapesGM::SimpleShapesGM ( bool  antialias)
inline

Definition at line 104 of file shapes.cpp.

104: INHERITED("simpleshapes", antialias) {}

Member Function Documentation

◆ drawShapes()

void skiagm::SimpleShapesGM::drawShapes ( SkCanvas canvas) const
inlineoverrideprivatevirtual

Implements skiagm::ShapesGM.

Definition at line 107 of file shapes.cpp.

107 {
108 SkRandom rand(2);
109 for (int i = 0; i < fShapes.size(); i++) {
111 paint.setColor(rand.nextU() & ~0x808080);
112 paint.setAlphaf(0.5f); // Use alpha to detect double blends.
113 const SkRRect& shape = fShapes[i];
114 canvas->save();
115 canvas->rotate(fRotations[i]);
116 switch (shape.getType()) {
118 canvas->drawRect(shape.rect(), paint);
119 break;
121 canvas->drawOval(shape.rect(), paint);
122 break;
123 default:
124 canvas->drawRRect(shape, paint);
125 break;
126 }
127 canvas->restore();
128 }
129 }
void drawRect(const SkRect &rect, const SkPaint &paint)
void drawOval(const SkRect &oval, const SkPaint &paint)
void restore()
Definition SkCanvas.cpp:465
void rotate(SkScalar degrees)
void drawRRect(const SkRRect &rrect, const SkPaint &paint)
int save()
Definition SkCanvas.cpp:451
Type getType() const
Definition SkRRect.h:76
const SkRect & rect() const
Definition SkRRect.h:264
@ kOval_Type
non-zero width and height filled with radii
Definition SkRRect.h:69
@ kRect_Type
non-zero width and height, and zeroed radii
Definition SkRRect.h:68
int size() const
Definition SkTArray.h:416
SkPaint fPaint
Definition shapes.cpp:93
TArray< SkScalar > fRotations
Definition shapes.cpp:95
TArray< SkRRect > fShapes
Definition shapes.cpp:94
const Paint & paint

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