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

Public Member Functions

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

This GM draws with invalid paints. It should draw nothing other than the background.

Definition at line 23 of file badpaint.cpp.

Constructor & Destructor Documentation

◆ BadPaintGM()

BadPaintGM::BadPaintGM ( )
inline

Definition at line 25 of file badpaint.cpp.

25{}

Member Function Documentation

◆ getISize()

SkISize BadPaintGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 30 of file badpaint.cpp.

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

◆ getName()

SkString BadPaintGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 28 of file badpaint.cpp.

28{ return SkString("badpaint"); }

◆ onDraw()

void BadPaintGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 51 of file badpaint.cpp.

51 {
52 SkRect rect = SkRect::MakeXYWH(10, 10, 80, 80);
53 for (int i = 0; i < fPaints.size(); ++i) {
54 canvas->drawRect(rect, fPaints[i]);
55 }
56 }
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
int size() const
Definition: SkTArray.h:421
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659

◆ onOnceBeforeDraw()

void BadPaintGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 32 of file badpaint.cpp.

32 {
33 SkBitmap emptyBmp;
34
35 SkBitmap blueBmp;
36 blueBmp.allocN32Pixels(10, 10);
37 blueBmp.eraseColor(SK_ColorBLUE);
38
39 SkMatrix badMatrix;
40 badMatrix.setAll(0, 0, 0, 0, 0, 0, 0, 0, 0);
41
42 // Empty bitmap.
44 fPaints.back().setShader(emptyBmp.makeShader(SkSamplingOptions()));
45
46 // Non-invertible local matrix.
48 fPaints.back().setShader(blueBmp.makeShader(SkSamplingOptions(), badMatrix));
49 }
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
Definition: SkBitmap.cpp:669
void allocN32Pixels(int width, int height, bool isOpaque=false)
Definition: SkBitmap.cpp:232
void eraseColor(SkColor4f) const
Definition: SkBitmap.cpp:442
SkMatrix & setAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar persp0, SkScalar persp1, SkScalar persp2)
Definition: SkMatrix.h:562
void setColor(SkColor color)
Definition: SkPaint.cpp:119
void setShader(sk_sp< SkShader > shader)

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