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

Public Member Functions

 TestGradientGM ()
 
- 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 21 of file testgradient.cpp.

Constructor & Destructor Documentation

◆ TestGradientGM()

TestGradientGM::TestGradientGM ( )
inline

Definition at line 23 of file testgradient.cpp.

23{}

Member Function Documentation

◆ getISize()

SkISize TestGradientGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 28 of file testgradient.cpp.

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

◆ getName()

SkString TestGradientGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 26 of file testgradient.cpp.

26{ return SkString("testgradient"); }

◆ onDraw()

void TestGradientGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 30 of file testgradient.cpp.

30 {
31 // Set up a gradient paint for a rect.
32 // And non-gradient paint for other objects.
33 canvas->drawColor(SK_ColorWHITE);
34
37 paint.setAntiAlias(true);
38 paint.setStrokeWidth(4);
39 paint.setColor(0xFFFE938C);
40
41 SkRect rect = SkRect::MakeXYWH(10, 10, 100, 160);
42
43 SkPoint points[2] = {
44 SkPoint::Make(0.0f, 0.0f),
45 SkPoint::Make(256.0f, 256.0f)
46 };
48 SkPaint newPaint(paint);
49 newPaint.setShader(SkGradientShader::MakeLinear(
50 points, colors, nullptr, 2, SkTileMode::kClamp));
51 canvas->drawRect(rect, newPaint);
52
54 oval.setOval(rect);
55 oval.offset(40, 80);
56 paint.setColor(0xFFE6B89C);
57 canvas->drawRRect(oval, paint);
58
59 paint.setColor(0xFF9CAFB7);
60 canvas->drawCircle(180, 50, 25, paint);
61
62 rect.offset(80, 50);
63 paint.setColor(0xFF4281A4);
65 canvas->drawRoundRect(rect, 10, 10, paint);
66 }
static const int points[]
constexpr SkColor SK_ColorYELLOW
Definition: SkColor.h:139
uint32_t SkColor
Definition: SkColor.h:37
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
Definition: SkCanvas.h:1182
void drawRRect(const SkRRect &rrect, const SkPaint &paint)
Definition: SkCanvas.cpp:1705
void drawRoundRect(const SkRect &rect, SkScalar rx, SkScalar ry, const SkPaint &paint)
Definition: SkCanvas.cpp:2717
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
Definition: SkCanvas.cpp:2707
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
@ 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
SkRect oval
Definition: SkRecords.h:249
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
PODArray< SkColor > colors
Definition: SkRecords.h:276
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659
void offset(float dx, float dy)
Definition: SkRect.h:1016

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