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

Public Member Functions

 ImageFiltersTransformedGM ()
 
- 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 onOnceBeforeDraw () 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 63 of file imagefilterstransformed.cpp.

Constructor & Destructor Documentation

◆ ImageFiltersTransformedGM()

skiagm::ImageFiltersTransformedGM::ImageFiltersTransformedGM ( )
inline

Definition at line 65 of file imagefilterstransformed.cpp.

65 {
67 }
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
void setBGColor(SkColor)
Definition: gm.cpp:159

Member Function Documentation

◆ getISize()

SkISize skiagm::ImageFiltersTransformedGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 72 of file imagefilterstransformed.cpp.

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

◆ getName()

SkString skiagm::ImageFiltersTransformedGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 70 of file imagefilterstransformed.cpp.

70{ return SkString("imagefilterstransformed"); }

◆ onDraw()

void skiagm::ImageFiltersTransformedGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 80 of file imagefilterstransformed.cpp.

80 {
81 sk_sp<SkImageFilter> gradient(SkImageFilters::Image(fGradientCircle,
85 sk_sp<SkImageFilter> filters[] = {
86 SkImageFilters::Blur(12, 0, nullptr),
87 SkImageFilters::DropShadow(0, 15, 8, 0, SK_ColorGREEN, nullptr),
89 std::move(gradient), checkerboard),
92 };
93
94 const SkScalar margin = SkIntToScalar(20);
95 const SkScalar size = SkIntToScalar(60);
96
97 for (size_t j = 0; j < 3; j++) {
98 canvas->save();
99 canvas->translate(margin, 0);
100 for (size_t i = 0; i < std::size(filters); ++i) {
102 paint.setColor(SK_ColorWHITE);
103 paint.setImageFilter(filters[i]);
104 paint.setAntiAlias(true);
105 canvas->save();
107 canvas->scale(SkDoubleToScalar(0.8), SkDoubleToScalar(0.8));
108 if (j == 1) {
109 canvas->rotate(SkIntToScalar(45));
110 } else if (j == 2) {
111 canvas->skew(SkDoubleToScalar(0.5), SkDoubleToScalar(0.2));
112 }
115 size, size * SkDoubleToScalar(0.6)), paint);
116 canvas->restore();
117 canvas->translate(size + margin, 0);
118 }
119 canvas->restore();
120 canvas->translate(0, size + margin);
121 }
122 }
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
#define SK_ScalarHalf
Definition: SkScalar.h:19
#define SkDoubleToScalar(x)
Definition: SkScalar.h:64
#define SkIntToScalar(x)
Definition: SkScalar.h:57
void drawOval(const SkRect &oval, const SkPaint &paint)
Definition: SkCanvas.cpp:1698
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void rotate(SkScalar degrees)
Definition: SkCanvas.cpp:1300
int save()
Definition: SkCanvas.cpp:447
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
void skew(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1312
static sk_sp< SkImageFilter > DropShadow(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor color, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Erode(SkScalar radiusX, SkScalar radiusY, 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 > DisplacementMap(SkColorChannel xChannelSelector, SkColorChannel yChannelSelector, SkScalar scale, sk_sp< SkImageFilter > displacement, sk_sp< SkImageFilter > color, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Image(sk_sp< SkImage > image, const SkRect &srcRect, const SkRect &dstRect, const SkSamplingOptions &sampling)
static sk_sp< SkImageFilter > Dilate(SkScalar radiusX, SkScalar radiusY, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
const Paint & paint
Definition: color_source.cc:38
float SkScalar
Definition: extension.cpp:12
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
static void checkerboard(SkCanvas *canvas, SkColor c1, SkColor c2, int size)

◆ onOnceBeforeDraw()

void skiagm::ImageFiltersTransformedGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 74 of file imagefilterstransformed.cpp.

74 {
75 fCheckerboard =
76 ToolUtils::create_checkerboard_image(64, 64, 0xFFA0A0A0, 0xFF404040, 8);
77 fGradientCircle = make_gradient_circle(64, 64);
78 }
sk_sp< SkImage > create_checkerboard_image(int w, int h, SkColor c1, SkColor c2, int checkSize)
Definition: ToolUtils.cpp:168
static sk_sp< SkImage > make_gradient_circle(int width, int height)

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