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

Public Member Functions

 LcdOverlapGM ()
 
- 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 drawTestCase (SkCanvas *canvas, SkScalar x, SkScalar y, SkBlendMode mode, SkBlendMode mode2)
 
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

Definition at line 30 of file lcdoverlap.cpp.

Constructor & Destructor Documentation

◆ LcdOverlapGM()

skiagm::LcdOverlapGM::LcdOverlapGM ( )
inline

Definition at line 32 of file lcdoverlap.cpp.

32 {
33 const int kPointSize = 25;
34 fTextHeight = SkIntToScalar(kPointSize);
35 }
#define SkIntToScalar(x)
Definition: SkScalar.h:57
constexpr int kPointSize
Definition: shaderpath.cpp:61

Member Function Documentation

◆ drawTestCase()

void skiagm::LcdOverlapGM::drawTestCase ( SkCanvas canvas,
SkScalar  x,
SkScalar  y,
SkBlendMode  mode,
SkBlendMode  mode2 
)
inlineprotected

Definition at line 54 of file lcdoverlap.cpp.

55 {
56 const SkColor colors[] {
63 };
64
65 for (size_t i = 0; i < std::size(colors); i++) {
66 canvas->save();
67 canvas->translate(x, y);
68 canvas->rotate(360.0f / std::size(colors) * i);
69 canvas->translate(-fBlob->bounds().width() / 2.0f - fBlob->bounds().left() + 0.5f, 0);
70
71 SkPaint textPaint;
72 textPaint.setColor(colors[i]);
73 textPaint.setBlendMode(i % 2 == 0 ? mode : mode2);
74 canvas->drawTextBlob(fBlob, 0, 0, textPaint);
75 canvas->restore();
76 }
77 }
constexpr SkColor SK_ColorYELLOW
Definition: SkColor.h:139
constexpr SkColor SK_ColorMAGENTA
Definition: SkColor.h:147
uint32_t SkColor
Definition: SkColor.h:37
constexpr SkColor SK_ColorCYAN
Definition: SkColor.h:143
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void rotate(SkScalar degrees)
Definition: SkCanvas.cpp:1300
int save()
Definition: SkCanvas.cpp:447
void drawTextBlob(const SkTextBlob *blob, SkScalar x, SkScalar y, const SkPaint &paint)
Definition: SkCanvas.cpp:2484
void setColor(SkColor color)
Definition: SkPaint.cpp:119
void setBlendMode(SkBlendMode mode)
Definition: SkPaint.cpp:151
const SkRect & bounds() const
Definition: SkTextBlob.h:53
double y
double x
PODArray< SkColor > colors
Definition: SkRecords.h:276
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
constexpr float left() const
Definition: SkRect.h:734
constexpr float width() const
Definition: SkRect.h:762

◆ getISize()

SkISize skiagm::LcdOverlapGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 52 of file lcdoverlap.cpp.

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

◆ getName()

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

Implements skiagm::GM.

Definition at line 38 of file lcdoverlap.cpp.

38{ return SkString("lcdoverlap"); }

◆ onDraw()

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

Reimplemented from skiagm::GM.

Definition at line 79 of file lcdoverlap.cpp.

79 {
80 SkScalar offsetX = kWidth / 4.0f;
81 SkScalar offsetY = kHeight / 4.0f;
87 }
@ kSrcOver
r = s + (1-sa)*d
@ kLuminosity
luminosity of source with hue and saturation of destination
@ kHardLight
multiply or screen, depending on source
void drawTestCase(SkCanvas *canvas, SkScalar x, SkScalar y, SkBlendMode mode, SkBlendMode mode2)
Definition: lcdoverlap.cpp:54
float SkScalar
Definition: extension.cpp:12
SkScalar offsetX
SkScalar offsetY

◆ onOnceBeforeDraw()

void skiagm::LcdOverlapGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 40 of file lcdoverlap.cpp.

40 {
41 // build text blob
43
45 const char* text = "able was I ere I saw elba";
46 font.setSubpixel(true);
49 fBlob = builder.make();
50 }
Definition: SkFont.h:35
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
std::u16string text
sk_sp< SkTypeface > DefaultPortableTypeface()
void add_to_text_blob(SkTextBlobBuilder *builder, const char *text, const SkFont &font, SkScalar x, SkScalar y)
Definition: ToolUtils.cpp:228
font
Font Metadata and Metrics.

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