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

Public Member Functions

 GradientsNoTextureGM (bool dither)
 
- 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 95 of file gradients_no_texture.cpp.

Constructor & Destructor Documentation

◆ GradientsNoTextureGM()

GradientsNoTextureGM::GradientsNoTextureGM ( bool  dither)
inline

Definition at line 97 of file gradients_no_texture.cpp.

97 : fDither(dither) {
98 this->setBGColor(0xFFDDDDDD);
99 }
void setBGColor(SkColor)
Definition: gm.cpp:159

Member Function Documentation

◆ getISize()

SkISize GradientsNoTextureGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 106 of file gradients_no_texture.cpp.

106{ return SkISize::Make(640, 615); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString GradientsNoTextureGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 102 of file gradients_no_texture.cpp.

102 {
103 return SkString(fDither ? "gradients_no_texture" : "gradients_no_texture_nodither");
104 }

◆ onDraw()

void GradientsNoTextureGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 108 of file gradients_no_texture.cpp.

108 {
109 constexpr SkPoint kPts[2] = { { 0, 0 },
110 { SkIntToScalar(50), SkIntToScalar(50) } };
111 constexpr SkTileMode kTM = SkTileMode::kClamp;
112 SkRect kRect = { 0, 0, SkIntToScalar(50), SkIntToScalar(50) };
114 paint.setAntiAlias(true);
115 paint.setDither(fDither);
116
117 canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
118 constexpr uint8_t kAlphas[] = { 0xff, 0x40 };
119 for (size_t a = 0; a < std::size(kAlphas); ++a) {
120 for (size_t i = 0; i < std::size(gGradData); ++i) {
121 canvas->save();
122 for (size_t j = 0; j < std::size(gGradMakers); ++j) {
123 paint.setShader(gGradMakers[j](kPts, gGradData[i], kTM));
124 paint.setAlpha(kAlphas[a]);
125 canvas->drawRect(kRect, paint);
126 canvas->translate(0, SkIntToScalar(kRect.height() + 20));
127 }
128 canvas->restore();
129 canvas->translate(SkIntToScalar(kRect.width() + 20), 0);
130 }
131 }
132 }
#define SkIntToScalar(x)
Definition: SkScalar.h:57
SkTileMode
Definition: SkTileMode.h:13
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
int save()
Definition: SkCanvas.cpp:447
const Paint & paint
Definition: color_source.cc:38
struct MyStruct a[10]
constexpr GradData gGradData[]
constexpr GradMaker gGradMakers[]
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
static constexpr SkPoint kPts[kPtsCount]
Definition: emptypath.cpp:123

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