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

Public Member Functions

 PathInteriorGM ()
 
- 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

SkISize getISize () override
 
SkString getName () const override
 
void show (SkCanvas *canvas, const SkPath &path)
 
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 25 of file pathinterior.cpp.

Constructor & Destructor Documentation

◆ PathInteriorGM()

PathInteriorGM::PathInteriorGM ( )
inline

Definition at line 27 of file pathinterior.cpp.

27 {
28 this->setBGColor(0xFFDDDDDD);
29 }
void setBGColor(SkColor)
Definition: gm.cpp:159

Member Function Documentation

◆ getISize()

SkISize PathInteriorGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 32 of file pathinterior.cpp.

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

◆ getName()

SkString PathInteriorGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 34 of file pathinterior.cpp.

34{ return SkString("pathinterior"); }

◆ onDraw()

void PathInteriorGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 60 of file pathinterior.cpp.

60 {
61 canvas->translate(8.5f, 8.5f);
62
63 const SkRect rect = { 0, 0, 80, 80 };
64 const SkScalar RAD = rect.width()/8;
65
66 int i = 0;
67 for (int insetFirst = 0; insetFirst <= 1; ++insetFirst) {
68 for (int doEvenOdd = 0; doEvenOdd <= 1; ++doEvenOdd) {
69 for (int outerRR = 0; outerRR <= 1; ++outerRR) {
70 for (int innerRR = 0; innerRR <= 1; ++innerRR) {
71 for (int outerCW = 0; outerCW <= 1; ++outerCW) {
72 for (int innerCW = 0; innerCW <= 1; ++innerCW) {
77
78 SkRect r = insetFirst ? inset(rect) : rect;
79 if (outerRR) {
80 path.addRoundRect(r, RAD, RAD, outerDir);
81 } else {
82 path.addRect(r, outerDir);
83 }
84 r = insetFirst ? rect : inset(rect);
85 if (innerRR) {
86 path.addRoundRect(r, RAD, RAD, innerDir);
87 } else {
88 path.addRect(r, innerDir);
89 }
90
91 SkScalar dx = (i / 8) * rect.width() * 6 / 5;
92 SkScalar dy = (i % 8) * rect.height() * 6 / 5;
93 i++;
94 path.offset(dx, dy);
95
96 this->show(canvas, path);
97 }
98 }
99 }
100 }
101 }
102 }
103 }
SkPathDirection
Definition: SkPathTypes.h:34
void show(SkCanvas *canvas, const SkPath &path)
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
Definition: SkPath.h:59
float SkScalar
Definition: extension.cpp:12
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
Definition: SkRecords.h:208
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
static SkRect inset(const SkRect &r)

◆ show()

void PathInteriorGM::show ( SkCanvas canvas,
const SkPath path 
)
inlineprotected

Definition at line 36 of file pathinterior.cpp.

36 {
38 paint.setAntiAlias(true);
39
41#if 0
42 bool hasInterior = path.hasRectangularInterior(&rect);
43#else
44 bool hasInterior = false;
45#endif
46
47 paint.setColor(hasInterior ? ToolUtils::color_to_565(0xFF8888FF) : SK_ColorGRAY);
48 canvas->drawPath(path, paint);
50 paint.setColor(SK_ColorRED);
51 canvas->drawPath(path, paint);
52
53 if (hasInterior) {
55 paint.setColor(0x8800FF00);
56 canvas->drawRect(rect, paint);
57 }
58 }
constexpr SkColor SK_ColorGRAY
Definition: SkColor.h:113
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
@ 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
SkColor color_to_565(SkColor color)
Definition: ToolUtils.cpp:139

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