Flutter Engine
The Flutter Engine
Protected Member Functions | List of all members
HighContrastFilterGM Class Reference
Inheritance diagram for HighContrastFilterGM:
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 106 of file highcontrastfilter.cpp.

Member Function Documentation

◆ getISize()

SkISize HighContrastFilterGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 127 of file highcontrastfilter.cpp.

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

◆ getName()

SkString HighContrastFilterGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 125 of file highcontrastfilter.cpp.

125{ return SkString("highcontrastfilter"); }

◆ onDraw()

void HighContrastFilterGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 129 of file highcontrastfilter.cpp.

129 {
131 { false, InvertStyle::kNoInvert, 0.0f },
132 { false, InvertStyle::kInvertBrightness, 0.0f },
133 { false, InvertStyle::kInvertLightness, 0.0f },
134 { false, InvertStyle::kInvertLightness, 0.2f },
135 { true, InvertStyle::kNoInvert, 0.0f },
136 { true, InvertStyle::kInvertBrightness, 0.0f },
137 { true, InvertStyle::kInvertLightness, 0.0f },
138 { true, InvertStyle::kInvertLightness, 0.2f },
139 };
140
141 for (size_t i = 0; i < std::size(configs); ++i) {
142 SkScalar x = kSize * (i % 4);
143 SkScalar y = kSize * (i / 4);
144 canvas->save();
145 canvas->translate(x, y);
146 canvas->scale(kSize, kSize);
147 draw_scene(canvas, configs[i]);
148 draw_label(canvas, configs[i]);
149 canvas->restore();
150 }
151 }
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
float SkScalar
Definition: extension.cpp:12
static void draw_label(SkCanvas *canvas, const SkHighContrastConfig &config)
static void draw_scene(SkCanvas *canvas, const SkHighContrastConfig &config)
static SkScalar kSize
double y
double 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

◆ onOnceBeforeDraw()

void HighContrastFilterGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 108 of file highcontrastfilter.cpp.

108 {
109 SkColor g1Colors[] = { kColor1, SkColorSetA(kColor1, 0x20) };
110 SkColor g2Colors[] = { kColor2, SkColorSetA(kColor2, 0x20) };
111 SkPoint g1Points[] = { { 0, 0 }, { 0, 100 } };
112 SkPoint g2Points[] = { { 0, 0 }, { kSize, 0 } };
113 SkScalar pos[] = { 0.2f, 1.0f };
114
115 SkHighContrastConfig fConfig;
116 fFilter = SkHighContrastFilter::Make(fConfig);
118 g1Points, g1Colors, pos, std::size(g1Colors),
121 g2Points, g2Colors, pos, std::size(g2Colors),
123 }
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
static SkColor kColor2
static sk_sp< SkColorFilter > Make(const SkHighContrastConfig &config)

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