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

Public Member Functions

 DrawRegionGM ()
 
- 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
 
bool runAsBench () const 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
 

Protected Attributes

SkRegion fRegion
 

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

This is very similar to the RectGrid macrobench in Android.

Definition at line 19 of file drawregion.cpp.

Constructor & Destructor Documentation

◆ DrawRegionGM()

DrawRegionGM::DrawRegionGM ( )
inline

Definition at line 21 of file drawregion.cpp.

21{}

Member Function Documentation

◆ getISize()

SkISize DrawRegionGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 26 of file drawregion.cpp.

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

◆ getName()

SkString DrawRegionGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 24 of file drawregion.cpp.

24{ return SkString("drawregion"); }

◆ onDraw()

void DrawRegionGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 40 of file drawregion.cpp.

40 {
41 canvas->translate(10, 10);
42
45 paint.setColor(0xFFFF00FF);
46 canvas->drawRect(SkRect::MakeLTRB(50.0f, 50.0f, 250.0f, 250.0f), paint);
47
48 paint.setColor(0xFF00FFFF);
49 canvas->drawRegion(fRegion, paint);
50 }
SkRegion fRegion
Definition: drawregion.cpp:52
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawRegion(const SkRegion &region, const SkPaint &paint)
Definition: SkCanvas.cpp:1685
@ kFill_Style
set to fill geometry
Definition: SkPaint.h:193
const Paint & paint
Definition: color_source.cc:38
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646

◆ onOnceBeforeDraw()

void DrawRegionGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 32 of file drawregion.cpp.

32 {
33 for (int x = 50; x < 250; x+=2) {
34 for (int y = 50; y < 250; y+=2) {
35 fRegion.op({x, y, x + 1, y + 1}, SkRegion::kUnion_Op);
36 }
37 }
38 }
@ kUnion_Op
target unioned with operand
Definition: SkRegion.h:369
bool op(const SkIRect &rect, Op op)
Definition: SkRegion.h:384
double y
double x

◆ runAsBench()

bool DrawRegionGM::runAsBench ( ) const
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 28 of file drawregion.cpp.

28 {
29 return true;
30 }

Member Data Documentation

◆ fRegion

SkRegion DrawRegionGM::fRegion
protected

Definition at line 52 of file drawregion.cpp.


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