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

Public Member Functions

 DrawRegionModesGM ()
 
- 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 onOnceBeforeDraw () 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 26 of file drawregionmodes.cpp.

Constructor & Destructor Documentation

◆ DrawRegionModesGM()

DrawRegionModesGM::DrawRegionModesGM ( )
inline

Definition at line 28 of file drawregionmodes.cpp.

28{}

Member Function Documentation

◆ getISize()

SkISize DrawRegionModesGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 33 of file drawregionmodes.cpp.

33{ return SkISize::Make(375, 500); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString DrawRegionModesGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 31 of file drawregionmodes.cpp.

31{ return SkString("drawregionmodes"); }

◆ onDraw()

void DrawRegionModesGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 40 of file drawregionmodes.cpp.

40 {
41 canvas->clear(SK_ColorGREEN);
42
45 paint.setColor(SK_ColorRED);
46 paint.setAntiAlias(true);
47
48 canvas->save();
49 canvas->translate(-50.0f, 75.0f);
50 canvas->rotate(-45.0f);
51 canvas->drawRegion(fRegion, paint);
52
53 canvas->translate(125.0f, 125.0f);
54 paint.setImageFilter(SkImageFilters::Blur(5.0f, 5.0f, nullptr, nullptr));
55 canvas->drawRegion(fRegion, paint);
56
57 canvas->translate(-125.0f, 125.0f);
58 paint.setImageFilter(nullptr);
60 canvas->drawRegion(fRegion, paint);
61
62 canvas->translate(-125.0f, -125.0f);
63 paint.setMaskFilter(nullptr);
65 float intervals[] = { 5.0f, 5.0f };
66 paint.setPathEffect(SkDashPathEffect::Make(intervals, 2, 2.5f));
67 canvas->drawRegion(fRegion, paint);
68
69 canvas->restore();
70
71 canvas->translate(100, 325);
72 paint.setPathEffect(nullptr);
74 SkPoint points[] = { SkPoint::Make(50.0f, 50.0f), SkPoint::Make(150.0f, 150.0f) };
76 paint.setShader(SkGradientShader::MakeLinear(points, colors, nullptr, 2,
78 canvas->drawRegion(fRegion, paint);
79 }
static const int points[]
@ kNormal_SkBlurStyle
fuzzy inside and outside
Definition: SkBlurTypes.h:12
constexpr SkColor SK_ColorYELLOW
Definition: SkColor.h:139
uint32_t SkColor
Definition: SkColor.h:37
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void clear(SkColor color)
Definition: SkCanvas.h:1199
void rotate(SkScalar degrees)
Definition: SkCanvas.cpp:1300
void drawRegion(const SkRegion &region, const SkPaint &paint)
Definition: SkCanvas.cpp:1685
int save()
Definition: SkCanvas.cpp:447
static sk_sp< SkPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
@ kFill_Style
set to fill geometry
Definition: SkPaint.h:193
const Paint & paint
Definition: color_source.cc:38
PODArray< SkColor > colors
Definition: SkRecords.h:276
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173

◆ onOnceBeforeDraw()

void DrawRegionModesGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 35 of file drawregionmodes.cpp.

35 {
36 fRegion.op({50, 50, 100, 100}, SkRegion::kUnion_Op);
37 fRegion.op({50, 100, 150, 150}, SkRegion::kUnion_Op);
38 }
@ kUnion_Op
target unioned with operand
Definition: SkRegion.h:369
bool op(const SkIRect &rect, Op op)
Definition: SkRegion.h:384

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