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

Public Member Functions

 HardstopGradientsManyGM ()
 
- 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 36 of file hardstop_gradients_many.cpp.

Constructor & Destructor Documentation

◆ HardstopGradientsManyGM()

HardstopGradientsManyGM::HardstopGradientsManyGM ( )
inline

Definition at line 38 of file hardstop_gradients_many.cpp.

38{}

Member Function Documentation

◆ getISize()

SkISize HardstopGradientsManyGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 43 of file hardstop_gradients_many.cpp.

43{ return SkISize::Make(kWidth, kHeight); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString HardstopGradientsManyGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 41 of file hardstop_gradients_many.cpp.

41{ return SkString("hardstop_gradients_many"); }

◆ onDraw()

void HardstopGradientsManyGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 45 of file hardstop_gradients_many.cpp.

45 {
46 static constexpr SkPoint points[] = {
49 };
50
51 std::vector<SkColor> colors;
52 std::vector<SkScalar> positions;
53
54 for (int row = 1; row <= kNumRows; ++row) {
55 // Assemble a gradient containing a blue-to-white blend, repeated N times per row.
56 colors.push_back(SK_ColorBLUE);
57 colors.push_back(SK_ColorWHITE);
58
59 positions = {0.0f};
60 for (int pos = 1; pos < row; ++pos) {
61 float place = SkScalar(pos) / SkScalar(row);
62 positions.push_back(place);
63 positions.push_back(place);
64 }
65 positions.push_back(1.0f);
66 SkASSERT(positions.size() == colors.size());
67
68 // Draw it.
70 colors.data(),
71 positions.data(),
72 colors.size(),
74 /*flags=*/0,
75 /*localMatrix=*/nullptr);
77 paint.setShader(shader);
79
80 canvas->translate(0, kCellHeight);
81 }
82 }
static const int points[]
SkPoint pos
#define SkASSERT(cond)
Definition: SkAssert.h:116
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 translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
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)
const Paint & paint
Definition: color_source.cc:38
float SkScalar
Definition: extension.cpp:12
const int kNumRows
const int kRectHeight
const int kCellHeight
const int kPadHeight
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

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