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

Public Member Functions

 HelloBazelWorldGM ()
 
- 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
 
bool isBazelOnly () const 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

Definition at line 31 of file hello_bazel_world.cpp.

Constructor & Destructor Documentation

◆ HelloBazelWorldGM()

HelloBazelWorldGM::HelloBazelWorldGM ( )
inline

Definition at line 33 of file hello_bazel_world.cpp.

33{}

Member Function Documentation

◆ getISize()

SkISize HelloBazelWorldGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 38 of file hello_bazel_world.cpp.

38{ return SkISize::Make(500, 500); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString HelloBazelWorldGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 36 of file hello_bazel_world.cpp.

36{ return SkString("HelloBazelWorld"); }

◆ isBazelOnly()

bool HelloBazelWorldGM::isBazelOnly ( ) const
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 40 of file hello_bazel_world.cpp.

40{ return true; }

◆ onDraw()

void HelloBazelWorldGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 42 of file hello_bazel_world.cpp.

42 {
44 paint.setAntiAlias(true);
46
47 const char* text = "Hello, Bazel world!";
48 size_t text_length = strlen(text);
49
50 SkRect r;
51 (void)font.measureText(text, text_length, SkTextEncoding::kUTF8, &r);
52 SkPoint pos = {this->width() / 2 - r.centerX(), this->height() / 2 - r.centerY()};
53
54 paint.setColor(SK_ColorRED);
55 canvas->drawSimpleText(
56 text, text_length, SkTextEncoding::kUTF8, pos.fX, pos.fY, font, paint);
57 }
SkPoint pos
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
@ kUTF8
uses bytes to represent UTF-8 or ASCII
void drawSimpleText(const void *text, size_t byteLength, SkTextEncoding encoding, SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
Definition: SkCanvas.cpp:2413
Definition: SkFont.h:35
SkScalar width()
Definition: gm.h:159
SkScalar height()
Definition: gm.h:162
const Paint & paint
Definition: color_source.cc:38
std::u16string text
sk_sp< SkTypeface > DefaultPortableTypeface()
font
Font Metadata and Metrics.
float fX
x-axis value
Definition: SkPoint_impl.h:164
float fY
y-axis value
Definition: SkPoint_impl.h:165
constexpr float centerX() const
Definition: SkRect.h:776
constexpr float centerY() const
Definition: SkRect.h:785

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