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

Public Member Functions

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

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

This tests drawing device-covering rects with solid colors and bitmap shaders over a checkerboard background using different xfermodes.

Definition at line 42 of file xfermodes3.cpp.

Constructor & Destructor Documentation

◆ Xfermodes3GM()

skiagm::Xfermodes3GM::Xfermodes3GM ( )
inline

Definition at line 44 of file xfermodes3.cpp.

44{ this->setBGColor(ToolUtils::color_to_565(0xFF70D0E0)); }
void setBGColor(SkColor)
Definition: gm.cpp:159
SkColor color_to_565(SkColor color)
Definition: ToolUtils.cpp:139

Member Function Documentation

◆ getISize()

SkISize skiagm::Xfermodes3GM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 49 of file xfermodes3.cpp.

49{ return SkISize::Make(630, 1215); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

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

Implements skiagm::GM.

Definition at line 47 of file xfermodes3.cpp.

47{ return SkString("xfermodes3"); }

◆ onDraw()

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

Reimplemented from skiagm::GM.

Definition at line 51 of file xfermodes3.cpp.

51 {
52 canvas->translate(SkIntToScalar(10), SkIntToScalar(20));
53
55 SkPaint labelP;
56
57 constexpr SkColor kSolidColors[] = {
60 0x80808000
61 };
62
63 constexpr SkColor kBmpAlphas[] = {
64 0xff,
65 0x80,
66 };
67
68 auto tempSurface(this->makeTempSurface(canvas, kSize, kSize));
69
70 int test = 0;
71 int x = 0, y = 0;
72 constexpr struct { SkPaint::Style fStyle; SkScalar fWidth; } kStrokes[] = {
75 };
76 for (size_t s = 0; s < std::size(kStrokes); ++s) {
77 for (size_t m = 0; m < kSkBlendModeCount; ++m) {
78 SkBlendMode mode = static_cast<SkBlendMode>(m);
81 SkIntToScalar(y + kSize + 3) + font.getSize(),
82 font, labelP);
83 for (size_t c = 0; c < std::size(kSolidColors); ++c) {
84 SkPaint modePaint;
85 modePaint.setBlendMode(mode);
86 modePaint.setColor(kSolidColors[c]);
87 modePaint.setStyle(kStrokes[s].fStyle);
88 modePaint.setStrokeWidth(kStrokes[s].fWidth);
89
90 this->drawMode(canvas, x, y, kSize, kSize, modePaint, tempSurface.get());
91
92 ++test;
93 x += kSize + 10;
94 if (!(test % kTestsPerRow)) {
95 x = 0;
96 y += kSize + 30;
97 }
98 }
99 for (size_t a = 0; a < std::size(kBmpAlphas); ++a) {
100 SkPaint modePaint;
101 modePaint.setBlendMode(mode);
102 modePaint.setAlpha(kBmpAlphas[a]);
103 modePaint.setShader(fBmpShader);
104 modePaint.setStyle(kStrokes[s].fStyle);
105 modePaint.setStrokeWidth(kStrokes[s].fWidth);
106
107 this->drawMode(canvas, x, y, kSize, kSize, modePaint, tempSurface.get());
108
109 ++test;
110 x += kSize + 10;
111 if (!(test % kTestsPerRow)) {
112 x = 0;
113 y += kSize + 30;
114 }
115 }
116 }
117 }
118 }
SkStrokeRec::Style fStyle
#define test(name)
SK_API const char * SkBlendMode_Name(SkBlendMode blendMode)
static constexpr int kSkBlendModeCount
Definition: SkBlendMode.h:76
SkBlendMode
Definition: SkBlendMode.h:38
uint32_t SkColor
Definition: SkColor.h:37
constexpr SkColor SK_ColorTRANSPARENT
Definition: SkColor.h:99
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
#define SkIntToScalar(x)
Definition: SkScalar.h:57
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
Definition: SkCanvas.h:1803
Definition: SkFont.h:35
void setStyle(Style style)
Definition: SkPaint.cpp:105
void setColor(SkColor color)
Definition: SkPaint.cpp:119
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
@ kFill_Style
set to fill geometry
Definition: SkPaint.h:193
void setAlpha(U8CPU a)
Definition: SkPaint.h:279
void setShader(sk_sp< SkShader > shader)
void setBlendMode(SkBlendMode mode)
Definition: SkPaint.cpp:151
void setStrokeWidth(SkScalar width)
Definition: SkPaint.cpp:159
float SkScalar
Definition: extension.cpp:12
struct MyStruct s
struct MyStruct a[10]
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 mode
Definition: switches.h:228
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.

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