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

Public Member Functions

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

Static Protected Member Functions

static void drawInto (SkCanvas *canvas)
 

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 172 of file surface.cpp.

Constructor & Destructor Documentation

◆ NewSurfaceGM()

NewSurfaceGM::NewSurfaceGM ( )
inline

Definition at line 174 of file surface.cpp.

174{}

Member Function Documentation

◆ drawInto()

static void NewSurfaceGM::drawInto ( SkCanvas canvas)
inlinestaticprotected

Definition at line 181 of file surface.cpp.

181 {
182 canvas->drawColor(SK_ColorRED);
183 }
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
Definition: SkCanvas.h:1182

◆ getISize()

SkISize NewSurfaceGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 179 of file surface.cpp.

179{ return SkISize::Make(300, 140); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString NewSurfaceGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 177 of file surface.cpp.

177{ return SkString("surfacenew"); }

◆ onDraw()

void NewSurfaceGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 185 of file surface.cpp.

185 {
187
188 auto surf(ToolUtils::makeSurface(canvas, info, nullptr));
189 drawInto(surf->getCanvas());
190
191 sk_sp<SkImage> image(surf->makeImageSnapshot());
192 canvas->drawImage(image, 10, 10);
193
194 auto surf2(surf->makeSurface(info));
195 drawInto(surf2->getCanvas());
196
197 // Assert that the props were communicated transitively through the first image
198 SkASSERT(equal(surf->props(), surf2->props()));
199
200 sk_sp<SkImage> image2(surf2->makeImageSnapshot());
201 canvas->drawImage(image2.get(), 10 + SkIntToScalar(image->width()) + 10, 10);
202 }
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
static bool equal(const SkBitmap &a, const SkBitmap &b)
Definition: ImageTest.cpp:1395
#define SkASSERT(cond)
Definition: SkAssert.h:116
#define SkIntToScalar(x)
Definition: SkScalar.h:57
static void drawInto(SkCanvas *canvas)
Definition: surface.cpp:181
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
int width() const
Definition: SkImage.h:285
sk_sp< const SkImage > image
Definition: SkRecords.h:269
sk_sp< SkSurface > makeSurface(SkCanvas *canvas, const SkImageInfo &info, const SkSurfaceProps *props)
Definition: ToolUtils.cpp:512
static SkImageInfo MakeN32Premul(int width, int height)

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