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

Public Member Functions

 ImageFiltersClippedGM ()
 
- 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 75 of file imagefiltersclipped.cpp.

Constructor & Destructor Documentation

◆ ImageFiltersClippedGM()

skiagm::ImageFiltersClippedGM::ImageFiltersClippedGM ( )
inline

Definition at line 77 of file imagefiltersclipped.cpp.

77 {
78 this->setBGColor(0x00000000);
79 }
void setBGColor(SkColor)
Definition: gm.cpp:159

Member Function Documentation

◆ getISize()

SkISize skiagm::ImageFiltersClippedGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 84 of file imagefiltersclipped.cpp.

84{ return SkISize::Make(860, 500); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

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

Implements skiagm::GM.

Definition at line 82 of file imagefiltersclipped.cpp.

82{ return SkString("imagefiltersclipped"); }

◆ onDraw()

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

Reimplemented from skiagm::GM.

Definition at line 92 of file imagefiltersclipped.cpp.

92 {
93 canvas->clear(SK_ColorBLACK);
94
95 sk_sp<SkImageFilter> gradient(SkImageFilters::Image(fGradientCircle,
99 SkMatrix resizeMatrix;
101 SkPoint3 pointLocation = SkPoint3::Make(32, 32, SkIntToScalar(10));
102
104 sk_sp<SkImageFilter> filters[] = {
107 SkIntToScalar(3), SkIntToScalar(3), SK_ColorGREEN, nullptr),
109 SkIntToScalar(12), std::move(gradient), checkerboard),
113 SkImageFilters::MatrixTransform(resizeMatrix, SkSamplingOptions(), nullptr),
114 // Crop output of lighting to the checkerboard
117 };
118
119 SkScalar margin = SkIntToScalar(16);
120 SkRect bounds = r;
121 bounds.outset(margin, margin);
122
123 canvas->save();
124 for (int xOffset = 0; xOffset < 80; xOffset += 16) {
125 canvas->save();
126 bounds.fLeft = SkIntToScalar(xOffset);
127 for (size_t i = 0; i < std::size(filters); ++i) {
128 draw_clipped_filter(canvas, filters[i], i, r, bounds);
129 canvas->translate(r.width() + margin, 0);
130 }
131 canvas->restore();
132 canvas->translate(0, r.height() + margin);
133 }
134 canvas->restore();
135
136 sk_sp<SkImageFilter> rectFilter(
138 canvas->translate(std::size(filters)*(r.width() + margin), 0);
139 for (int xOffset = 0; xOffset < 80; xOffset += 16) {
140 bounds.fLeft = SkIntToScalar(xOffset);
141 draw_clipped_filter(canvas, rectFilter, 0, r, bounds);
142 canvas->translate(0, r.height() + margin);
143 }
144 }
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
#define SK_Scalar1
Definition: SkScalar.h:18
#define SkIntToScalar(x)
Definition: SkScalar.h:57
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void clear(SkColor color)
Definition: SkCanvas.h:1199
int save()
Definition: SkCanvas.cpp:447
static sk_sp< SkImageFilter > PointLitDiffuse(const SkPoint3 &location, SkColor lightColor, SkScalar surfaceScale, SkScalar kd, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
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 > MatrixTransform(const SkMatrix &matrix, const SkSamplingOptions &sampling, sk_sp< SkImageFilter > input)
static sk_sp< SkImageFilter > Offset(SkScalar dx, SkScalar dy, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Shader(sk_sp< SkShader > shader, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Dilate(SkScalar radiusX, SkScalar radiusY, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
SkMatrix & setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
Definition: SkMatrix.cpp:296
float SkScalar
Definition: extension.cpp:12
#define RESIZE_FACTOR_Y
#define RESIZE_FACTOR_X
static void draw_clipped_filter(SkCanvas *canvas, sk_sp< SkImageFilter > filter, size_t i, const SkRect &primBounds, const SkRect &clipBounds)
Optional< SkRect > bounds
Definition: SkRecords.h:189
SK_API sk_sp< SkShader > MakeFractalNoise(SkScalar baseFrequencyX, SkScalar baseFrequencyY, int numOctaves, SkScalar seed, const SkISize *tileSize=nullptr)
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
SkSamplingOptions(SkFilterMode::kLinear))
static SkPoint3 Make(SkScalar x, SkScalar y, SkScalar z)
Definition: SkPoint3.h:18
constexpr float height() const
Definition: SkRect.h:769
constexpr float width() const
Definition: SkRect.h:762
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609
static void checkerboard(SkCanvas *canvas, SkColor c1, SkColor c2, int size)

◆ onOnceBeforeDraw()

void skiagm::ImageFiltersClippedGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 86 of file imagefiltersclipped.cpp.

86 {
87 fCheckerboard =
88 ToolUtils::create_checkerboard_image(64, 64, 0xFFA0A0A0, 0xFF404040, 8);
89 fGradientCircle = make_gradient_circle(64, 64);
90 }
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: