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

Protected Member Functions

bool runAsBench () const 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 154 of file imagefilters.cpp.

Member Function Documentation

◆ getISize()

SkISize SaveLayerWithBackdropGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 158 of file imagefilters.cpp.

158{ return SkISize::Make(830, 550); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString SaveLayerWithBackdropGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 157 of file imagefilters.cpp.

157{ return SkString("savelayer_with_backdrop"); }

◆ onDraw()

void SaveLayerWithBackdropGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 160 of file imagefilters.cpp.

160 {
161 SkColorMatrix cm;
162 cm.setSaturation(10);
164 const SkScalar kernel[] = { 4, 0, 4, 0, -15, 0, 4, 0, 4 };
165 sk_sp<SkImageFilter> filters[] = {
166 SkImageFilters::Blur(10, 10, nullptr),
167 SkImageFilters::Dilate(8, 8, nullptr),
168 SkImageFilters::MatrixConvolution({ 3, 3 }, kernel, 1, 0, { 0, 0 },
169 SkTileMode::kDecal, true, nullptr),
170 SkImageFilters::ColorFilter(std::move(cf), nullptr),
171 };
172
173 const struct {
174 SkScalar fSx, fSy, fTx, fTy;
175 } xforms[] = {
176 { 1, 1, 0, 0 },
177 { 0.5f, 0.5f, 530, 0 },
178 { 0.25f, 0.25f, 530, 275 },
179 { 0.125f, 0.125f, 530, 420 },
180 };
181
184 sk_sp<SkImage> image(ToolUtils::GetResourceAsImage("images/mandrill_512.png"));
185
186 canvas->translate(20, 20);
187 for (const auto& xform : xforms) {
188 canvas->save();
189 canvas->translate(xform.fTx, xform.fTy);
190 canvas->scale(xform.fSx, xform.fSy);
191 canvas->drawImage(image, 0, 0, sampling, nullptr);
192 draw_set(canvas, filters, std::size(filters));
193 canvas->restore();
194 }
195 }
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
int save()
Definition: SkCanvas.cpp:447
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
void setSaturation(float sat)
static sk_sp< SkImageFilter > MatrixConvolution(const SkISize &kernelSize, const SkScalar kernel[], SkScalar gain, SkScalar bias, const SkIPoint &kernelOffset, SkTileMode tileMode, bool convolveAlpha, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > ColorFilter(sk_sp< SkColorFilter > cf, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Dilate(SkScalar radiusX, SkScalar radiusY, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
float SkScalar
Definition: extension.cpp:12
static void draw_set(SkCanvas *canvas, sk_sp< SkImageFilter > filters[], int count)
sk_sp< const SkImage > image
Definition: SkRecords.h:269
PODArray< SkRSXform > xforms
Definition: SkRecords.h:332
SkSamplingOptions sampling
Definition: SkRecords.h:337
sk_sp< SkImage > GetResourceAsImage(const char *resource)
Definition: DecodeUtils.h:25
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

◆ runAsBench()

bool SaveLayerWithBackdropGM::runAsBench ( ) const
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 156 of file imagefilters.cpp.

156{ return true; }

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