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

Public Member Functions

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

static const int W = 64
 
static const int H = 64
 
- Static Public Attributes inherited from skiagm::GM
static constexpr char kErrorMsg_DrawSkippedGpuOnly []
 

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
 

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
 

Detailed Description

Definition at line 127 of file xfermodes.cpp.

Constructor & Destructor Documentation

◆ XfermodesGM()

XfermodesGM::XfermodesGM ( )
inline

Definition at line 223 of file xfermodes.cpp.

223{}

Member Function Documentation

◆ getISize()

SkISize XfermodesGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 228 of file xfermodes.cpp.

228{ return SkISize::Make(1990, 570); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString XfermodesGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 226 of file xfermodes.cpp.

226{ return SkString("xfermodes"); }

◆ onDraw()

void XfermodesGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 230 of file xfermodes.cpp.

230 {
231 canvas->translate(SkIntToScalar(10), SkIntToScalar(20));
232
233 const SkScalar w = SkIntToScalar(W);
234 const SkScalar h = SkIntToScalar(H);
235 SkMatrix m;
236 m.setScale(SkIntToScalar(6), SkIntToScalar(6));
239
240 SkPaint labelP;
241 labelP.setAntiAlias(true);
242
244
245 const int kWrap = 5;
246
247 SkScalar x0 = 0;
248 SkScalar y0 = 0;
249 for (int sourceType = 1; sourceType & kAll_SrcType; sourceType <<= 1) {
250 SkScalar x = x0, y = y0;
251 for (size_t i = 0; i < std::size(gModes); i++) {
252 if ((gModes[i].fSourceTypeMask & sourceType) == 0) {
253 continue;
254 }
255 SkRect r{ x, y, x+w, y+h };
256
257 SkPaint p;
258 p.setStyle(SkPaint::kFill_Style);
259 p.setShader(s);
260 canvas->drawRect(r, p);
261
262 canvas->saveLayer(&r, nullptr);
263 draw_mode(canvas, gModes[i].fMode, static_cast<SrcType>(sourceType),
264 r.fLeft, r.fTop);
265 canvas->restore();
266
267 r.inset(-SK_ScalarHalf, -SK_ScalarHalf);
268 p.setStyle(SkPaint::kStroke_Style);
269 p.setShader(nullptr);
270 canvas->drawRect(r, p);
271
272#if 1
273 const char* label = SkBlendMode_Name(gModes[i].fMode);
274 SkTextUtils::DrawString(canvas, label, x + w/2, y - font.getSize()/2,
276#endif
277 x += w + SkIntToScalar(10);
278 if ((i % kWrap) == kWrap - 1) {
279 x = x0;
280 y += h + SkIntToScalar(30);
281 }
282 }
283 if (y < 320) {
284 if (x > x0) {
285 y += h + SkIntToScalar(30);
286 }
287 y0 = y;
288 } else {
289 x0 += SkIntToScalar(400);
290 y0 = 0;
291 }
292 }
293 }
SK_API const char * SkBlendMode_Name(SkBlendMode blendMode)
#define SK_ScalarHalf
Definition: SkScalar.h:19
#define SkIntToScalar(x)
Definition: SkScalar.h:57
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
Definition: SkBitmap.cpp:669
int saveLayer(const SkRect *bounds, const SkPaint *paint)
Definition: SkCanvas.cpp:496
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
Definition: SkFont.h:35
void setAntiAlias(bool aa)
Definition: SkPaint.h:170
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
@ kFill_Style
set to fill geometry
Definition: SkPaint.h:193
static void DrawString(SkCanvas *canvas, const char text[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint, Align align=kLeft_Align)
Definition: SkTextUtils.h:34
static const int W
Definition: xfermodes.cpp:221
float SkScalar
Definition: extension.cpp:12
struct MyStruct s
double y
double x
SkFont DefaultPortableFont()
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
font
Font Metadata and Metrics.
SkSamplingOptions(SkFilterMode::kLinear))
SkScalar w
SkScalar h
Definition: SkMD5.cpp:130
const struct @268 gModes[]
SrcType
Definition: xfermodes.cpp:29
@ kAll_SrcType
All the source types.
Definition: xfermodes.cpp:47
int fSourceTypeMask
Definition: xfermodes.cpp:53

Member Data Documentation

◆ H

const int XfermodesGM::H = 64
static

Definition at line 222 of file xfermodes.cpp.

◆ W

const int XfermodesGM::W = 64
static

Definition at line 221 of file xfermodes.cpp.


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