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

Public Member Functions

 ImageFiltersStrokedGM ()
 
- 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
 

Static Protected Member Functions

static void draw_circle (SkCanvas *canvas, const SkRect &r, const SkPaint &paint)
 
static void draw_line (SkCanvas *canvas, const SkRect &r, const SkPaint &paint)
 
static void draw_rect (SkCanvas *canvas, const SkRect &r, const SkPaint &paint)
 

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 27 of file imagefiltersstroked.cpp.

Constructor & Destructor Documentation

◆ ImageFiltersStrokedGM()

skiagm::ImageFiltersStrokedGM::ImageFiltersStrokedGM ( )
inline

Definition at line 29 of file imagefiltersstroked.cpp.

29 {
30 this->setBGColor(0x00000000);
31 }
void setBGColor(SkColor)
Definition: gm.cpp:159

Member Function Documentation

◆ draw_circle()

static void skiagm::ImageFiltersStrokedGM::draw_circle ( SkCanvas canvas,
const SkRect r,
const SkPaint paint 
)
inlinestaticprotected

Definition at line 38 of file imagefiltersstroked.cpp.

38 {
39 canvas->drawCircle(r.centerX(), r.centerY(),
40 r.width() * 2 / 5, paint);
41 }
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
Definition: SkCanvas.cpp:2707
const Paint & paint
Definition: color_source.cc:38
constexpr float centerX() const
Definition: SkRect.h:776
constexpr float centerY() const
Definition: SkRect.h:785
constexpr float width() const
Definition: SkRect.h:762

◆ draw_line()

static void skiagm::ImageFiltersStrokedGM::draw_line ( SkCanvas canvas,
const SkRect r,
const SkPaint paint 
)
inlinestaticprotected

Definition at line 43 of file imagefiltersstroked.cpp.

43 {
44 canvas->drawLine(r.fLeft, r.fBottom, r.fRight, r.fTop, paint);
45 }
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
Definition: SkCanvas.cpp:2700
SkScalar fBottom
larger y-axis bounds
Definition: extension.cpp:17
SkScalar fLeft
smaller x-axis bounds
Definition: extension.cpp:14
SkScalar fRight
larger x-axis bounds
Definition: extension.cpp:16
SkScalar fTop
smaller y-axis bounds
Definition: extension.cpp:15

◆ draw_rect()

static void skiagm::ImageFiltersStrokedGM::draw_rect ( SkCanvas canvas,
const SkRect r,
const SkPaint paint 
)
inlinestaticprotected

Definition at line 47 of file imagefiltersstroked.cpp.

47 {
48 canvas->drawRect(r, paint);
49 }
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673

◆ getISize()

SkISize skiagm::ImageFiltersStrokedGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 36 of file imagefiltersstroked.cpp.

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

◆ getName()

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

Implements skiagm::GM.

Definition at line 34 of file imagefiltersstroked.cpp.

34{ return SkString("imagefiltersstroked"); }

◆ onDraw()

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

Reimplemented from skiagm::GM.

Definition at line 51 of file imagefiltersstroked.cpp.

51 {
52 void (*drawProc[])(SkCanvas*, const SkRect&, const SkPaint&) = {
54 };
55
56 canvas->clear(SK_ColorBLACK);
57
58 SkMatrix resizeMatrix;
60
61 sk_sp<SkImageFilter> filters[] = {
62 SkImageFilters::Blur(5, 5, nullptr),
63 SkImageFilters::DropShadow(10, 10, 3, 3, SK_ColorGREEN, nullptr),
64 SkImageFilters::Offset(-16, 32, nullptr),
65 SkImageFilters::MatrixTransform(resizeMatrix, SkSamplingOptions(), nullptr),
66 };
67
68 SkRect r = SkRect::MakeWH(64, 64);
69 SkScalar margin = 32;
71 paint.setColor(SK_ColorWHITE);
72 paint.setAntiAlias(true);
73 paint.setStrokeWidth(10);
75
76 for (size_t i = 0; i < std::size(drawProc); ++i) {
77 canvas->translate(0, margin);
78 canvas->save();
79 for (size_t j = 0; j < std::size(filters); ++j) {
80 canvas->translate(margin, 0);
81 canvas->save();
82 if (2 == j) {
83 canvas->translate(16, -32);
84 } else if (3 == j) {
87 }
88 paint.setImageFilter(filters[j]);
89 drawProc[i](canvas, r, paint);
90 canvas->restore();
91 canvas->translate(r.width() + margin, 0);
92 }
93 canvas->restore();
94 canvas->translate(0, r.height());
95 }
96 }
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 SkScalarInvert(x)
Definition: SkScalar.h:73
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void clear(SkColor color)
Definition: SkCanvas.h:1199
int save()
Definition: SkCanvas.cpp:447
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
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 > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
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={})
SkMatrix & setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
Definition: SkMatrix.cpp:296
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
static void draw_circle(SkCanvas *canvas, const SkRect &r, const SkPaint &paint)
static void draw_rect(SkCanvas *canvas, const SkRect &r, const SkPaint &paint)
static void draw_line(SkCanvas *canvas, const SkRect &r, const SkPaint &paint)
float SkScalar
Definition: extension.cpp:12
#define RESIZE_FACTOR_Y
#define RESIZE_FACTOR_X
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 constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609

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