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

Public Member Functions

 ClipStrokeRectGM ()
 
- 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 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 16 of file clip_strokerect.cpp.

Constructor & Destructor Documentation

◆ ClipStrokeRectGM()

ClipStrokeRectGM::ClipStrokeRectGM ( )
inline

Definition at line 18 of file clip_strokerect.cpp.

18 {
19
20 }

Member Function Documentation

◆ getISize()

SkISize ClipStrokeRectGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 25 of file clip_strokerect.cpp.

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

◆ getName()

SkString ClipStrokeRectGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 23 of file clip_strokerect.cpp.

23{ return SkString("clip_strokerect"); }

◆ onDraw()

void ClipStrokeRectGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 27 of file clip_strokerect.cpp.

27 {
28 SkPaint p;
29 p.setColor(SK_ColorRED);
30 p.setAntiAlias(true);
31 p.setStyle(SkPaint::kStroke_Style);
32 p.setStrokeWidth(22);
33
34 SkRect r = SkRect::MakeXYWH(20, 20, 100, 100);
35 // setting the height of this to 19 causes failure
36 SkRect rect = SkRect::MakeXYWH(20, 0, 100, 20);
37
38 canvas->save();
39 canvas->clipRect(rect, true);
40 canvas->drawRect(r, p);
41 canvas->restore();
42
43 p.setColor(SK_ColorBLUE);
44 p.setStrokeWidth(2);
45 canvas->drawRect(rect, p);
46
47 p.setColor(SK_ColorRED);
48 p.setAntiAlias(true);
49 p.setStyle(SkPaint::kStroke_Style);
50 p.setStrokeWidth(22);
51
52 SkRect r2 = SkRect::MakeXYWH(20, 140, 100, 100);
53 // setting the height of this to 19 causes failure
54 SkRect rect2 = SkRect::MakeXYWH(20, 120, 100, 19);
55
56 canvas->save();
57 canvas->clipRect(rect2, true);
58 canvas->drawRect(r2, p);
59 canvas->restore();
60
61 p.setColor(SK_ColorBLUE);
62 p.setStrokeWidth(2);
63 canvas->drawRect(rect2, p);
64 }
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
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 restore()
Definition: SkCanvas.cpp:461
int save()
Definition: SkCanvas.cpp:447
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659

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