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

Public Member Functions

 LcdBlendGM ()
 
- 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
 
void onOnceBeforeDraw () override
 
SkISize getISize () override
 
void onDraw (SkCanvas *canvas) override
 
void drawColumn (SkCanvas *canvas, SkColor backgroundColor, SkColor textColor, bool useGrad)
 
- 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 49 of file lcdblendmodes.cpp.

Constructor & Destructor Documentation

◆ LcdBlendGM()

skiagm::LcdBlendGM::LcdBlendGM ( )
inline

Definition at line 51 of file lcdblendmodes.cpp.

51 {
52 const int kPointSize = 25;
53 fTextHeight = SkIntToScalar(kPointSize);
54 }
#define SkIntToScalar(x)
Definition: SkScalar.h:57
constexpr int kPointSize
Definition: shaderpath.cpp:61

Member Function Documentation

◆ drawColumn()

void skiagm::LcdBlendGM::drawColumn ( SkCanvas canvas,
SkColor  backgroundColor,
SkColor  textColor,
bool  useGrad 
)
inlineprotected

Definition at line 91 of file lcdblendmodes.cpp.

91 {
92 const SkBlendMode gModes[] = {
122 };
123 // Draw background rect
124 SkPaint backgroundPaint;
125 backgroundPaint.setColor(backgroundColor);
126 canvas->drawRect(SkRect::MakeIWH(kColWidth, kHeight), backgroundPaint);
127 SkScalar y = fTextHeight;
128 for (size_t m = 0; m < std::size(gModes); m++) {
130 paint.setColor(textColor);
131 paint.setBlendMode(gModes[m]);
133 font.setSubpixel(true);
135 if (useGrad) {
136 SkRect r;
137 r.setXYWH(0, y - fTextHeight, SkIntToScalar(kColWidth), fTextHeight);
138 paint.setShader(make_shader(r));
139 }
141 canvas->drawString(string, 0, y, font, paint);
142 y+=fTextHeight;
143 }
144 }
SK_API const char * SkBlendMode_Name(SkBlendMode blendMode)
SkBlendMode
Definition: SkBlendMode.h:38
@ kSrcOut
r = s * (1-da)
@ kExclusion
rc = s + d - two(s*d), ra = kSrcOver
@ kSaturation
saturation of source with hue and luminosity of destination
@ kColorBurn
darken destination to reflect source
@ kPlus
r = min(s + d, 1)
@ kLighten
rc = s + d - min(s*da, d*sa), ra = kSrcOver
@ kHue
hue of source with saturation and luminosity of destination
@ kDstIn
r = d * sa
@ kModulate
r = s*d
@ kMultiply
r = s*(1-da) + d*(1-sa) + s*d
@ kColorDodge
brighten destination to reflect source
@ kScreen
r = s + d - s*d
@ kSrcOver
r = s + (1-sa)*d
@ kXor
r = s*(1-da) + d*(1-sa)
@ kLuminosity
luminosity of source with hue and saturation of destination
@ kSoftLight
lighten or darken, depending on source
@ kDifference
rc = s + d - 2*(min(s*da, d*sa)), ra = kSrcOver
@ kOverlay
multiply or screen, depending on destination
@ kSrcATop
r = s*da + d*(1-sa)
@ kDstATop
r = d*sa + s*(1-da)
@ kDstOver
r = d + (1-da)*s
@ kColor
hue and saturation of source with luminosity of destination
@ kHardLight
multiply or screen, depending on source
@ kDstOut
r = d * (1-sa)
@ kDarken
rc = s + d - max(s*da, d*sa), ra = kSrcOver
@ kSrcIn
r = s * da
@ kClear
r = 0
constexpr SkBlendMode gModes[]
Definition: aarectmodes.cpp:73
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
Definition: SkCanvas.h:1803
Definition: SkFont.h:35
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
void setColor(SkColor color)
Definition: SkPaint.cpp:119
const Paint & paint
Definition: color_source.cc:38
float SkScalar
Definition: extension.cpp:12
double y
sk_sp< SkTypeface > DefaultPortableTypeface()
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.
static sk_sp< SkShader > make_shader(const SkRect &bounds)
constexpr int kColWidth
constexpr int kHeight
void setXYWH(float x, float y, float width, float height)
Definition: SkRect.h:931
static SkRect MakeIWH(int w, int h)
Definition: SkRect.h:623

◆ getISize()

SkISize skiagm::LcdBlendGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 63 of file lcdblendmodes.cpp.

63{ return SkISize::Make(kWidth, kHeight); }
constexpr int kWidth
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

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

Implements skiagm::GM.

Definition at line 57 of file lcdblendmodes.cpp.

57{ return SkString("lcdblendmodes"); }

◆ onDraw()

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

Reimplemented from skiagm::GM.

Definition at line 65 of file lcdblendmodes.cpp.

65 {
66 SkPaint p;
67 p.setAntiAlias(false);
68 p.setStyle(SkPaint::kFill_Style);
69 p.setShader(fCheckerboard);
71 canvas->drawRect(r, p);
72
75 auto surface(ToolUtils::makeSurface(canvas, info, &props));
76
77 SkCanvas* surfCanvas = surface->getCanvas();
78 this->drawColumn(surfCanvas, SK_ColorBLACK, SK_ColorWHITE, false);
79 surfCanvas->translate(SkIntToScalar(kColWidth), 0);
80 this->drawColumn(surfCanvas, SK_ColorWHITE, SK_ColorBLACK, false);
81 surfCanvas->translate(SkIntToScalar(kColWidth), 0);
82 this->drawColumn(surfCanvas, SK_ColorGREEN, SK_ColorMAGENTA, false);
83 surfCanvas->translate(SkIntToScalar(kColWidth), 0);
84 this->drawColumn(surfCanvas, SK_ColorCYAN, SK_ColorMAGENTA, true);
85
86 SkPaint surfPaint;
88 surface->draw(canvas, 0, 0, SkSamplingOptions(), &surfPaint);
89 }
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
constexpr SkColor SK_ColorMAGENTA
Definition: SkColor.h:147
constexpr SkColor SK_ColorCYAN
Definition: SkColor.h:143
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
@ kRGB_H_SkPixelGeometry
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
@ kFill_Style
set to fill geometry
Definition: SkPaint.h:193
void setBlendMode(SkBlendMode mode)
Definition: SkPaint.cpp:151
void drawColumn(SkCanvas *canvas, SkColor backgroundColor, SkColor textColor, bool useGrad)
VkSurfaceKHR surface
Definition: main.cc:49
sk_sp< SkSurface > makeSurface(SkCanvas *canvas, const SkImageInfo &info, const SkSurfaceProps *props)
Definition: ToolUtils.cpp:512
SkSamplingOptions(SkFilterMode::kLinear))
static SkImageInfo MakeN32Premul(int width, int height)
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609

◆ onOnceBeforeDraw()

void skiagm::LcdBlendGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 59 of file lcdblendmodes.cpp.

59 {
61 }
sk_sp< SkShader > create_checkerboard_shader(SkColor c1, SkColor c2, int size)
Definition: ToolUtils.cpp:150

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