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

Protected Member Functions

void onOnceBeforeDraw () override
 
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
 
- 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
 
- Static Public Attributes inherited from skiagm::GM
static constexpr char kErrorMsg_DrawSkippedGpuOnly []
 

Detailed Description

Definition at line 103 of file lumafilter.cpp.

Member Function Documentation

◆ getISize()

SkISize LumaFilterGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 121 of file lumafilter.cpp.

121{ return SkISize::Make(600, 420); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString LumaFilterGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 119 of file lumafilter.cpp.

119{ return SkString("lumafilter"); }

◆ onDraw()

void LumaFilterGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 123 of file lumafilter.cpp.

123 {
124 SkBlendMode modes[] = {
131 };
132 struct {
133 const sk_sp<SkShader>& fShader1;
134 const sk_sp<SkShader>& fShader2;
135 } shaders[] = {
136 { nullptr, nullptr },
137 { nullptr, fGr2 },
138 { fGr1, nullptr },
139 { fGr1, fGr2 },
140 };
141
142 SkScalar gridStep = kSize + 2 * kInset;
143 for (size_t i = 0; i < std::size(modes); ++i) {
144 draw_label(canvas, SkBlendMode_Name(modes[i]),
145 SkPoint::Make(gridStep * (0.5f + i), 20));
146 }
147
148 for (size_t i = 0; i < std::size(shaders); ++i) {
149 canvas->save();
150 canvas->translate(kInset, gridStep * i + 30);
151 for (size_t m = 0; m < std::size(modes); ++m) {
152 draw_scene(canvas, fFilter, modes[m], shaders[i].fShader1,
153 shaders[i].fShader2);
154 canvas->translate(gridStep, 0);
155 }
156 canvas->restore();
157 }
158 }
SK_API const char * SkBlendMode_Name(SkBlendMode blendMode)
SkBlendMode
Definition: SkBlendMode.h:38
@ kDstIn
r = d * sa
@ kSrcOver
r = s + (1-sa)*d
@ kSrcATop
r = s*da + d*(1-sa)
@ kDstATop
r = d*sa + s*(1-da)
@ kDstOver
r = d + (1-da)*s
@ kSrcIn
r = s * da
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
int save()
Definition: SkCanvas.cpp:447
float SkScalar
Definition: extension.cpp:12
static void draw_scene(SkCanvas *canvas, const sk_sp< SkColorFilter > &filter, SkBlendMode mode, const sk_sp< SkShader > &s1, const sk_sp< SkShader > &s2)
Definition: lumafilter.cpp:55
static SkScalar kInset
Definition: lumafilter.cpp:39
static SkScalar kSize
Definition: lumafilter.cpp:38
static void draw_label(SkCanvas *canvas, const char *label, const SkPoint &offset)
Definition: lumafilter.cpp:43
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 Make(float x, float y)
Definition: SkPoint_impl.h:173

◆ onOnceBeforeDraw()

void LumaFilterGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 105 of file lumafilter.cpp.

105 {
106 SkColor g1Colors[] = { kColor1, SkColorSetA(kColor1, 0x20) };
107 SkColor g2Colors[] = { kColor2, SkColorSetA(kColor2, 0x20) };
108 SkPoint g1Points[] = { { 0, 0 }, { 0, 100 } };
109 SkPoint g2Points[] = { { 0, 0 }, { kSize, 0 } };
110 SkScalar pos[] = { 0.2f, 1.0f };
111
112 fFilter = SkLumaColorFilter::Make();
113 fGr1 = SkGradientShader::MakeLinear(g1Points, g1Colors, pos, std::size(g1Colors),
115 fGr2 = SkGradientShader::MakeLinear(g2Points, g2Colors, pos, std::size(g2Colors),
117 }
SkPoint pos
uint32_t SkColor
Definition: SkColor.h:37
static constexpr SkColor SkColorSetA(SkColor c, U8CPU a)
Definition: SkColor.h:82
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)
static SkColor kColor1
Definition: lumafilter.cpp:40
static SkColor kColor2
Definition: lumafilter.cpp:41
static sk_sp< SkColorFilter > Make()

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