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

Public Member Functions

 FilterBugGM ()
 
- 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 44 of file filterbug.cpp.

Constructor & Destructor Documentation

◆ FilterBugGM()

FilterBugGM::FilterBugGM ( )
inline

Definition at line 46 of file filterbug.cpp.

46{ this->setBGColor(SK_ColorRED); }
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
void setBGColor(SkColor)
Definition: gm.cpp:159

Member Function Documentation

◆ getISize()

SkISize FilterBugGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 51 of file filterbug.cpp.

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

◆ getName()

SkString FilterBugGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 49 of file filterbug.cpp.

49{ return SkString("filterbug"); }

◆ onDraw()

void FilterBugGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 60 of file filterbug.cpp.

60 {
61 static const SkSamplingOptions kSampling(SkCubicResampler::Mitchell());
62 static const bool kDoAA = true;
63
64 {
65 SkRect r1 = SkRect::MakeXYWH(50.0f, 0.0f, 50.0f, 50.0f);
66 SkPaint p1;
67 p1.setAntiAlias(kDoAA);
68 SkMatrix localMat;
69 localMat.setScaleTranslate(2.0f, 2.0f, 50.0f, 0.0f);
71 kSampling, &localMat));
72
73 canvas->drawRect(r1, p1);
74 }
75
76 {
77 SkRect r2 = SkRect::MakeXYWH(50.0f, 50.0f, 50.0f, 36.0f);
78
79 SkPaint p2;
81 p2.setAntiAlias(kDoAA);
82
83 canvas->drawRect(r2, p2);
84 }
85
86 {
87 SkRect r3 = SkRect::MakeXYWH(50.0f, 86.0f, 50.0f, 50.0f);
88
89 SkPaint p3;
90 p3.setAntiAlias(kDoAA);
91 SkMatrix localMat;
92 localMat.setScaleTranslate(2.0f, 2.0f, 50.0f, 86.0f);
94 kSampling, &localMat));
95
96 canvas->drawRect(r3, p3);
97 }
98 }
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
Definition: SkImage.cpp:179
void setScaleTranslate(SkScalar sx, SkScalar sy, SkScalar tx, SkScalar ty)
Definition: SkMatrix.h:1803
void setColor(SkColor color)
Definition: SkPaint.cpp:119
void setAntiAlias(bool aa)
Definition: SkPaint.h:170
void setShader(sk_sp< SkShader > shader)
static constexpr SkCubicResampler Mitchell()
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659

◆ onOnceBeforeDraw()

void FilterBugGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 53 of file filterbug.cpp.

53 {
54 // The top texture has 5 black rows on top and then 22 white rows on the bottom
55 fTop = make_image(0, 5);
56 // The bottom texture has 5 black rows on the bottom and then 22 white rows on the top
57 fBot = make_image(22, 27);
58 }
static sk_sp< SkImage > make_image(int firstBlackRow, int lastBlackRow)
Definition: filterbug.cpp:24

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