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

Public Member Functions

 ColorCubeGM ()
 
- 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 onOnceBeforeDraw () 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 27 of file jpg_color_cube.cpp.

Constructor & Destructor Documentation

◆ ColorCubeGM()

skiagm::ColorCubeGM::ColorCubeGM ( )
inline

Definition at line 29 of file jpg_color_cube.cpp.

29{}

Member Function Documentation

◆ getISize()

SkISize skiagm::ColorCubeGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 34 of file jpg_color_cube.cpp.

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

◆ getName()

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

Implements skiagm::GM.

Definition at line 32 of file jpg_color_cube.cpp.

32{ return SkString("jpg-color-cube"); }

◆ onDraw()

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

Reimplemented from skiagm::GM.

Definition at line 60 of file jpg_color_cube.cpp.

60 {
61 canvas->drawImage(fImage, 0, 0);
62 }
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528

◆ onOnceBeforeDraw()

void skiagm::ColorCubeGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 36 of file jpg_color_cube.cpp.

36 {
37 SkBitmap bmp;
38 bmp.allocN32Pixels(512, 512, true);
39 int bX = 0, bY = 0;
40 for (int b = 0; b < 64; ++b) {
41 for (int r = 0; r < 64; ++r) {
42 for (int g = 0; g < 64; ++g) {
43 *bmp.getAddr32(bX + r, bY + g) = SkPackARGB32(255,
44 SkTPin(r * 4, 0, 255),
45 SkTPin(g * 4, 0, 255),
46 SkTPin(b * 4, 0, 255));
47 }
48 }
49 bX += 64;
50 if (bX >= 512) {
51 bX = 0;
52 bY += 64;
53 }
54 }
57 fImage = SkImages::DeferredFromEncodedData(stream.detachAsData());
58 }
#define SkASSERT_RELEASE(cond)
Definition: SkAssert.h:100
static SkPMColor SkPackARGB32(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
Definition: SkColorPriv.h:106
static constexpr const T & SkTPin(const T &x, const T &lo, const T &hi)
Definition: SkTPin.h:19
const SkPixmap & pixmap() const
Definition: SkBitmap.h:133
void allocN32Pixels(int width, int height, bool isOpaque=false)
Definition: SkBitmap.cpp:232
uint32_t * getAddr32(int x, int y) const
Definition: SkBitmap.h:1260
static bool b
SK_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)

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