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

Public Member Functions

 ComposeShaderAlphaGM ()
 
- 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 80 of file composeshader.cpp.

Constructor & Destructor Documentation

◆ ComposeShaderAlphaGM()

ComposeShaderAlphaGM::ComposeShaderAlphaGM ( )
inline

Definition at line 82 of file composeshader.cpp.

82{}

Member Function Documentation

◆ getISize()

SkISize ComposeShaderAlphaGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 87 of file composeshader.cpp.

87{ return SkISize::Make(750, 220); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString ComposeShaderAlphaGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 85 of file composeshader.cpp.

85{ return SkString("composeshader_alpha"); }

◆ onDraw()

void ComposeShaderAlphaGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 89 of file composeshader.cpp.

89 {
90 sk_sp<SkShader> shaders[] = {
93 };
94
96 paint.setColor(SK_ColorGREEN);
97
98 const SkRect r = SkRect::MakeXYWH(5, 5, 100, 100);
99
100 for (size_t y = 0; y < std::size(shaders); ++y) {
101 canvas->save();
102 for (int alpha = 0xFF; alpha > 0; alpha -= 0x28) {
103 paint.setAlphaf(1.0f);
104 paint.setShader(nullptr);
105 canvas->drawRect(r, paint);
106
107 paint.setAlpha(alpha);
108 paint.setShader(shaders[y]);
109 canvas->drawRect(r, paint);
110
111 canvas->translate(r.width() + 5, 0);
112 }
113 canvas->restore();
114 canvas->translate(0, r.height() + 5);
115 }
116 }
@ kDstIn
r = d * sa
@ kSrcOver
r = s + (1-sa)*d
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
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
static sk_sp< SkShader > make_shader(SkBlendMode mode)
double y
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 SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659
constexpr float height() const
Definition: SkRect.h:769
constexpr float width() const
Definition: SkRect.h:762

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