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

Protected Member Functions

void onOnceBeforeDraw () override
 
bool runAsBench () const 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 19 of file circularclips.cpp.

Member Function Documentation

◆ getISize()

SkISize CircularClipsGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 39 of file circularclips.cpp.

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

◆ getName()

SkString CircularClipsGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 37 of file circularclips.cpp.

37{ return SkString("circular-clips"); }

◆ onDraw()

void CircularClipsGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 41 of file circularclips.cpp.

41 {
42 const SkClipOp ops[] = {
45 };
46
47 SkRect rect = SkRect::MakeLTRB(fX1 - fR, fY - fR, fX2 + fR, fY + fR);
48
49 SkPaint fillPaint;
50
51 // Giant background circular clips (AA, non-inverted, replace/isect)
52 fillPaint.setColor(0x80808080);
53 canvas->save();
54 canvas->scale(10, 10);
55 canvas->translate(-((fX1 + fX2)/2 - fR), -(fY - 2*fR/3));
56 canvas->clipPath(fCircle1, true);
57 canvas->clipPath(fCircle2, true);
58
59 canvas->drawRect(rect, fillPaint);
60
61 canvas->restore();
62
63 fillPaint.setColor(0xFF000000);
64
65 for (size_t i = 0; i < 4; i++) {
66 fCircle1.toggleInverseFillType();
67 if (i % 2 == 0) {
68 fCircle2.toggleInverseFillType();
69 }
70
71 canvas->save();
72 for (size_t op = 0; op < std::size(ops); op++) {
73 canvas->save();
74
75 canvas->clipPath(fCircle1);
76 canvas->clipPath(fCircle2, ops[op]);
77
78 canvas->drawRect(rect, fillPaint);
79
80 canvas->restore();
81 canvas->translate(0, 2 * fY);
82 }
83 canvas->restore();
84 canvas->translate(fX1 + fX2, 0);
85 }
86 }
SkPathOp ops[]
SkClipOp
Definition: SkClipOp.h:13
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void clipPath(const SkPath &path, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1456
int save()
Definition: SkCanvas.cpp:447
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
void setColor(SkColor color)
Definition: SkPaint.cpp:119
void toggleInverseFillType()
Definition: SkPath.h:249
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646

◆ onOnceBeforeDraw()

void CircularClipsGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 24 of file circularclips.cpp.

24 {
25 fX1 = 80;
26 fX2 = 120;
27 fY = 50;
28 fR = 40;
29
30 fCircle1 = SkPath::Circle(fX1, fY, fR, SkPathDirection::kCW);
31 fCircle2 = SkPath::Circle(fX2, fY, fR, SkPathDirection::kCW);
32 }
static SkPath Circle(SkScalar center_x, SkScalar center_y, SkScalar radius, SkPathDirection dir=SkPathDirection::kCW)
Definition: SkPath.cpp:3598

◆ runAsBench()

bool CircularClipsGM::runAsBench ( ) const
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 35 of file circularclips.cpp.

35{ return true; }

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