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

Public Member Functions

 ComplexClip4GM (bool aaclip)
 
- 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 emulateDeviceRestriction (SkCanvas *canvas, const SkIRect &deviceRestriction)
 
void emulateClipRectReplace (SkCanvas *canvas, const SkRect &clipRect, bool aa)
 
void emulateClipRRectReplace (SkCanvas *canvas, const SkRRect &clipRRect, bool aa)
 
void emulateClipPathReplace (SkCanvas *canvas, const SkPath &path, bool aa)
 
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 complexclip4.cpp.

Constructor & Destructor Documentation

◆ ComplexClip4GM()

skiagm::ComplexClip4GM::ComplexClip4GM ( bool  aaclip)
inline

Definition at line 25 of file complexclip4.cpp.

26 : fDoAAClip(aaclip) {
27 this->setBGColor(0xFFDEDFDE);
28 }
void setBGColor(SkColor)
Definition: gm.cpp:159

Member Function Documentation

◆ emulateClipPathReplace()

void skiagm::ComplexClip4GM::emulateClipPathReplace ( SkCanvas canvas,
const SkPath path,
bool  aa 
)
inlineprotected

Definition at line 63 of file complexclip4.cpp.

65 {
68 }
static void ResetClip(SkCanvas *canvas)
Definition: SkCanvasPriv.h:61
void clipPath(const SkPath &path, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1456
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57

◆ emulateClipRectReplace()

void skiagm::ComplexClip4GM::emulateClipRectReplace ( SkCanvas canvas,
const SkRect clipRect,
bool  aa 
)
inlineprotected

Definition at line 49 of file complexclip4.cpp.

51 {
54 }
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
clipRect(r.rect, r.opAA.op(), r.opAA.aa())) template<> void Draw

◆ emulateClipRRectReplace()

void skiagm::ComplexClip4GM::emulateClipRRectReplace ( SkCanvas canvas,
const SkRRect clipRRect,
bool  aa 
)
inlineprotected

Definition at line 56 of file complexclip4.cpp.

58 {
61 }
void clipRRect(const SkRRect &rrect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1439
clipRRect(r.rrect, r.opAA.op(), r.opAA.aa())) DRAW(ClipRect

◆ emulateDeviceRestriction()

void skiagm::ComplexClip4GM::emulateDeviceRestriction ( SkCanvas canvas,
const SkIRect deviceRestriction 
)
inlineprotected

Definition at line 43 of file complexclip4.cpp.

43 {
44 // TODO(michaelludwig): It may make more sense for device clip restriction to move on to
45 // the SkSurface (which would let this GM draw correctly in viewer).
46 canvas->androidFramework_setDeviceClipRestriction(deviceRestriction);
47 }
void androidFramework_setDeviceClipRestriction(const SkIRect &rect)
Definition: SkCanvas.cpp:1378

◆ getISize()

SkISize skiagm::ComplexClip4GM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 38 of file complexclip4.cpp.

38{ return SkISize::Make(970, 780); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

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

Implements skiagm::GM.

Definition at line 31 of file complexclip4.cpp.

31 {
32 SkString str;
33 str.printf("complexclip4_%s",
34 fDoAAClip ? "aa" : "bw");
35 return str;
36 }
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534

◆ onDraw()

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

Reimplemented from skiagm::GM.

Definition at line 70 of file complexclip4.cpp.

70 {
71 SkPaint p;
72 p.setAntiAlias(fDoAAClip);
73 p.setColor(SK_ColorYELLOW);
74
75 canvas->save();
76 // draw a yellow rect through a rect clip
77 canvas->save();
78 emulateDeviceRestriction(canvas, SkIRect::MakeLTRB(100, 100, 300, 300));
79 canvas->drawColor(SK_ColorGREEN);
80 emulateClipRectReplace(canvas, SkRect::MakeLTRB(100, 200, 400, 500), fDoAAClip);
81 canvas->drawRect(SkRect::MakeLTRB(100, 200, 400, 500), p);
82 canvas->restore();
83
84 // draw a yellow rect through a diamond clip
85 canvas->save();
86 emulateDeviceRestriction(canvas, SkIRect::MakeLTRB(500, 100, 800, 300));
87 canvas->drawColor(SK_ColorGREEN);
88
89 SkPath pathClip = SkPath::Polygon({
90 {650, 200},
91 {900, 300},
92 {650, 400},
93 {650, 300},
94 }, true);
95 emulateClipPathReplace(canvas, pathClip, fDoAAClip);
96 canvas->drawRect(SkRect::MakeLTRB(500, 200, 900, 500), p);
97 canvas->restore();
98
99 // draw a yellow rect through a round rect clip
100 canvas->save();
101 emulateDeviceRestriction(canvas, SkIRect::MakeLTRB(500, 500, 800, 700));
102 canvas->drawColor(SK_ColorGREEN);
103
105 canvas, SkRRect::MakeOval(SkRect::MakeLTRB(500, 600, 900, 750)), fDoAAClip);
106 canvas->drawRect(SkRect::MakeLTRB(500, 600, 900, 750), p);
107 canvas->restore();
108
109 // fill the clip with yellow color showing that androidFramework_replaceClip is
110 // in device space
111 canvas->save();
112 canvas->clipRect(SkRect::MakeLTRB(100, 400, 300, 750),
113 SkClipOp::kIntersect, fDoAAClip);
114 canvas->drawColor(SK_ColorGREEN);
115 // should not affect the device-space clip
116 canvas->rotate(20.f);
117 canvas->translate(50.f, 50.f);
118 emulateDeviceRestriction(canvas, SkIRect::MakeLTRB(150, 450, 250, 700));
119 canvas->drawColor(SK_ColorYELLOW);
120 canvas->restore();
121
122 canvas->restore();
123 }
constexpr SkColor SK_ColorYELLOW
Definition: SkColor.h:139
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
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 drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
Definition: SkCanvas.h:1182
void rotate(SkScalar degrees)
Definition: SkCanvas.cpp:1300
int save()
Definition: SkCanvas.cpp:447
Definition: SkPath.h:59
static SkPath Polygon(const SkPoint pts[], int count, bool isClosed, SkPathFillType=SkPathFillType::kWinding, bool isVolatile=false)
Definition: SkPath.cpp:3614
static SkRRect MakeOval(const SkRect &oval)
Definition: SkRRect.h:162
void emulateClipPathReplace(SkCanvas *canvas, const SkPath &path, bool aa)
void emulateDeviceRestriction(SkCanvas *canvas, const SkIRect &deviceRestriction)
void emulateClipRRectReplace(SkCanvas *canvas, const SkRRect &clipRRect, bool aa)
void emulateClipRectReplace(SkCanvas *canvas, const SkRect &clipRect, bool aa)
static constexpr SkIRect MakeLTRB(int32_t l, int32_t t, int32_t r, int32_t b)
Definition: SkRect.h:91
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646

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