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

Public Member Functions

 ClipCubicGM ()
 
- 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 doDraw (SkCanvas *canvas, const SkPath &path)
 
void drawAndClip (SkCanvas *canvas, const SkPath &path, SkScalar dx, SkScalar dy)
 
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 163 of file aaclip.cpp.

Constructor & Destructor Documentation

◆ ClipCubicGM()

ClipCubicGM::ClipCubicGM ( )
inline

Definition at line 169 of file aaclip.cpp.

169 {
170 fVPath = SkPathBuilder().moveTo(W, 0)
171 .cubicTo(W, H-10, 0, 10, 0, H)
172 .detach();
173
174 SkMatrix pivot;
175 pivot.setRotate(90, W/2, H/2);
176 fHPath = fVPath.makeTransform(pivot);
177 }
SkMatrix & setRotate(SkScalar degrees, SkScalar px, SkScalar py)
Definition: SkMatrix.cpp:452
SkPathBuilder & cubicTo(SkPoint pt1, SkPoint pt2, SkPoint pt3)
SkPathBuilder & moveTo(SkPoint pt)
SkPath makeTransform(const SkMatrix &m, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
Definition: SkPath.h:1400
Definition: SkMD5.cpp:130

Member Function Documentation

◆ doDraw()

void ClipCubicGM::doDraw ( SkCanvas canvas,
const SkPath path 
)
inlineprotected

Definition at line 184 of file aaclip.cpp.

184 {
186 paint.setAntiAlias(true);
187
188 paint.setColor(0xFFCCCCCC);
189 canvas->drawPath(path, paint);
190
191 paint.setColor(SK_ColorRED);
193 canvas->drawPath(path, paint);
194 }
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
const Paint & paint
Definition: color_source.cc:38
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

◆ drawAndClip()

void ClipCubicGM::drawAndClip ( SkCanvas canvas,
const SkPath path,
SkScalar  dx,
SkScalar  dy 
)
inlineprotected

Definition at line 196 of file aaclip.cpp.

196 {
197 SkAutoCanvasRestore acr(canvas, true);
198
199 SkRect r = SkRect::MakeXYWH(0, H/4, W, H/2);
201 paint.setColor(ToolUtils::color_to_565(0xFF8888FF));
202
203 canvas->drawRect(r, paint);
204 this->doDraw(canvas, path);
205
206 canvas->translate(dx, dy);
207
208 canvas->drawRect(r, paint);
209 canvas->clipRect(r);
210 this->doDraw(canvas, path);
211 }
void doDraw(SkCanvas *canvas, const SkPath &path)
Definition: aaclip.cpp:184
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
Definition: SkRecords.h:208
SkColor color_to_565(SkColor color)
Definition: ToolUtils.cpp:139
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659

◆ getISize()

SkISize ClipCubicGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 182 of file aaclip.cpp.

182{ return SkISize::Make(400, 410); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString ClipCubicGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 180 of file aaclip.cpp.

180{ return SkString("clipcubic"); }

◆ onDraw()

void ClipCubicGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 213 of file aaclip.cpp.

213 {
214 canvas->translate(80, 10);
215 this->drawAndClip(canvas, fVPath, 200, 0);
216 canvas->translate(0, 200);
217 this->drawAndClip(canvas, fHPath, 200, 0);
218 }
void drawAndClip(SkCanvas *canvas, const SkPath &path, SkScalar dx, SkScalar dy)
Definition: aaclip.cpp:196

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