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

Public Member Functions

 DRRectGM ()
 
- 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 19 of file drrect.cpp.

Constructor & Destructor Documentation

◆ DRRectGM()

DRRectGM::DRRectGM ( )
inline

Definition at line 21 of file drrect.cpp.

21{}

Member Function Documentation

◆ getISize()

SkISize DRRectGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 26 of file drrect.cpp.

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

◆ getName()

SkString DRRectGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 24 of file drrect.cpp.

24{ return SkString("drrect"); }

◆ onDraw()

void DRRectGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 28 of file drrect.cpp.

28 {
30 paint.setAntiAlias(true);
31
32 SkRRect outers[4];
33 // like squares/circles, to exercise fast-cases in GPU
34 SkRect r = { 0, 0, 100, 100 };
35 SkVector radii[4] = {
36 { 0, 0 }, { 30, 1 }, { 10, 40 }, { 40, 40 }
37 };
38
39 const SkScalar dx = r.width() + 16;
40 const SkScalar dy = r.height() + 16;
41
42 outers[0].setRect(r);
43 outers[1].setOval(r);
44 outers[2].setRectXY(r, 20, 20);
45 outers[3].setRectRadii(r, radii);
46
47 SkRRect inners[5];
48 r.inset(25, 25);
49
50 inners[0].setEmpty();
51 inners[1].setRect(r);
52 inners[2].setOval(r);
53 inners[3].setRectXY(r, 20, 20);
54 inners[4].setRectRadii(r, radii);
55
56 canvas->translate(16, 16);
57 for (size_t j = 0; j < std::size(inners); ++j) {
58 for (size_t i = 0; i < std::size(outers); ++i) {
59 canvas->save();
60 canvas->translate(dx * j, dy * i);
61 canvas->drawDRRect(outers[i], inners[j], paint);
62 canvas->restore();
63 }
64 }
65 }
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
int save()
Definition: SkCanvas.cpp:447
void drawDRRect(const SkRRect &outer, const SkRRect &inner, const SkPaint &paint)
Definition: SkCanvas.cpp:1645
void setEmpty()
Definition: SkRRect.h:118
void setOval(const SkRect &oval)
Definition: SkRRect.cpp:30
void setRectRadii(const SkRect &rect, const SkVector radii[4])
Definition: SkRRect.cpp:189
void setRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
Definition: SkRRect.cpp:52
void setRect(const SkRect &rect)
Definition: SkRRect.h:126
const Paint & paint
Definition: color_source.cc:38
float SkScalar
Definition: extension.cpp:12
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
Definition: SkRecords.h:208
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
void inset(float dx, float dy)
Definition: SkRect.h:1060
constexpr float height() const
Definition: SkRect.h:769
constexpr float width() const
Definition: SkRect.h:762

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