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

Public Member Functions

 FillTypeGM ()
 
void makePath ()
 
- 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 showPath (SkCanvas *canvas, int x, int y, SkPathFillType ft, SkScalar scale, const SkPaint &paint)
 
void showFour (SkCanvas *canvas, SkScalar scale, const SkPaint &paint)
 
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 20 of file filltypes.cpp.

Constructor & Destructor Documentation

◆ FillTypeGM()

skiagm::FillTypeGM::FillTypeGM ( )
inline

Definition at line 23 of file filltypes.cpp.

23 {
24 this->setBGColor(0xFFDDDDDD);
25 }
void setBGColor(SkColor)
Definition: gm.cpp:159

Member Function Documentation

◆ getISize()

SkISize skiagm::FillTypeGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 39 of file filltypes.cpp.

39{ return SkISize::Make(835, 840); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

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

Implements skiagm::GM.

Definition at line 37 of file filltypes.cpp.

37{ return SkString("filltypes"); }

◆ makePath()

void skiagm::FillTypeGM::makePath ( )
inline

Definition at line 27 of file filltypes.cpp.

27 {
28 if (fPath.isEmpty()) {
29 const SkScalar radius = SkIntToScalar(45);
30 fPath = SkPathBuilder().addCircle(SkIntToScalar(50), SkIntToScalar(50), radius)
31 .addCircle(SkIntToScalar(100), SkIntToScalar(100), radius)
32 .detach();
33 }
34 }
#define SkIntToScalar(x)
Definition: SkScalar.h:57
SkPathBuilder & addCircle(SkScalar center_x, SkScalar center_y, SkScalar radius, SkPathDirection dir=SkPathDirection::kCW)
bool isEmpty() const
Definition: SkPath.cpp:416
float SkScalar
Definition: extension.cpp:12

◆ onDraw()

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

Reimplemented from skiagm::GM.

Definition at line 68 of file filltypes.cpp.

68 {
69 this->makePath();
70
71 canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
72
74 const SkScalar scale = SkIntToScalar(5)/4;
75
76 paint.setAntiAlias(false);
77
78 showFour(canvas, SK_Scalar1, paint);
79 canvas->translate(SkIntToScalar(450), 0);
80 showFour(canvas, scale, paint);
81
82 paint.setAntiAlias(true);
83
84 canvas->translate(SkIntToScalar(-450), SkIntToScalar(450));
85 showFour(canvas, SK_Scalar1, paint);
86 canvas->translate(SkIntToScalar(450), 0);
87 showFour(canvas, scale, paint);
88 }
#define SK_Scalar1
Definition: SkScalar.h:18
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void showFour(SkCanvas *canvas, SkScalar scale, const SkPaint &paint)
Definition: filltypes.cpp:57
const Paint & paint
Definition: color_source.cc:38
static SkPath scale(const SkPath &path, SkScalar scale)
Definition: patheffects.cpp:68

◆ showFour()

void skiagm::FillTypeGM::showFour ( SkCanvas canvas,
SkScalar  scale,
const SkPaint paint 
)
inlineprotected

Definition at line 57 of file filltypes.cpp.

57 {
59 scale, paint);
60 showPath(canvas, 200, 0, SkPathFillType::kEvenOdd,
61 scale, paint);
63 scale, paint);
65 scale, paint);
66 }
void showPath(SkCanvas *canvas, int x, int y, SkPathFillType ft, SkScalar scale, const SkPaint &paint)
Definition: filltypes.cpp:41

◆ showPath()

void skiagm::FillTypeGM::showPath ( SkCanvas canvas,
int  x,
int  y,
SkPathFillType  ft,
SkScalar  scale,
const SkPaint paint 
)
inlineprotected

Definition at line 41 of file filltypes.cpp.

42 {
43 const SkRect r = { 0, 0, SkIntToScalar(150), SkIntToScalar(150) };
44
45 canvas->save();
47 canvas->clipRect(r);
48 canvas->drawColor(SK_ColorWHITE);
49 fPath.setFillType(ft);
50 canvas->translate(r.centerX(), r.centerY());
51 canvas->scale(scale, scale);
52 canvas->translate(-r.centerX(), -r.centerY());
53 canvas->drawPath(fPath, paint);
54 canvas->restore();
55 }
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
void restore()
Definition: SkCanvas.cpp:461
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
Definition: SkCanvas.h:1182
int save()
Definition: SkCanvas.cpp:447
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
void setFillType(SkPathFillType ft)
Definition: SkPath.h:235
double y
double x
constexpr float centerX() const
Definition: SkRect.h:776
constexpr float centerY() const
Definition: SkRect.h:785

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