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

Public Member Functions

 SurfacePropsGM (uint32_t flags)
 
- 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
 

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

Constructor & Destructor Documentation

◆ SurfacePropsGM()

SurfacePropsGM::SurfacePropsGM ( uint32_t  flags)
inline

Definition at line 91 of file surface.cpp.

91 : fFlags(flags) {
92 recs = {
94 "Unknown geometry, default contrast/gamma",
98 "RGB_H, default contrast/gamma",
102 "BGR_H, default contrast/gamma",
106 "RGB_V, default contrast/gamma",
110 "BGR_V, default contrast/gamma",
113 {kRGB_H_SkPixelGeometry, "RGB_H contrast : 0 gamma: 0", 0, 0},
114 {kRGB_H_SkPixelGeometry, "RGB_H contrast : 1 gamma: 0", 1, 0},
115 {kRGB_H_SkPixelGeometry, "RGB_H contrast : 0 gamma: 3.9", 0, 3.9f},
116 {kRGB_H_SkPixelGeometry, "RGB_H contrast : 1 gamma: 3.9", 1, 3.9f},
117 };
118 }
@ kUnknown_SkPixelGeometry
@ kRGB_V_SkPixelGeometry
@ kBGR_H_SkPixelGeometry
@ kRGB_H_SkPixelGeometry
@ kBGR_V_SkPixelGeometry
#define SK_GAMMA_CONTRAST
Definition: SkTypes.h:94
#define SK_GAMMA_EXPONENT
Definition: SkTypes.h:86
FlutterSemanticsFlag flags

Member Function Documentation

◆ getISize()

SkISize SurfacePropsGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 126 of file surface.cpp.

126{ return SkISize::Make(W, H * recs.size()); }
Definition: SkMD5.cpp:130
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20
#define W
Definition: surface.cpp:41

◆ getName()

SkString SurfacePropsGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 121 of file surface.cpp.

121 {
122 return SkStringPrintf("surfaceprops%s",
123 fFlags != 0 ? "_df" : "");
124 }
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.

◆ onDraw()

void SurfacePropsGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 128 of file surface.cpp.

128 {
129 auto ctx = canvas->recordingContext();
130 auto recorder = canvas->recorder();
131
132 // must be opaque to have a hope of testing LCD text
134
135 SkScalar x = 0;
136 SkScalar y = 0;
137 for (const auto& rec : recs) {
138 auto surface(make_surface(ctx, recorder, info, fFlags, rec.fGeo, rec.fContrast,
139 rec.fGamma));
140 if (!surface) {
141 SkDebugf("failed to create surface! label: %s", rec.fLabel);
142 continue;
143 }
144 test_draw(surface->getCanvas(), rec.fLabel);
145 surface->draw(canvas, x, y);
146 y += H;
147 }
148 }
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
@ kOpaque_SkAlphaType
pixel is opaque
Definition: SkAlphaType.h:28
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
virtual GrRecordingContext * recordingContext() const
Definition: SkCanvas.cpp:1637
virtual skgpu::graphite::Recorder * recorder() const
Definition: SkCanvas.cpp:1641
VkSurfaceKHR surface
Definition: main.cc:49
float SkScalar
Definition: extension.cpp:12
double y
double x
static SkImageInfo MakeN32(int width, int height, SkAlphaType at)
static void test_draw(SkCanvas *canvas, const char label[])
Definition: surface.cpp:72
#define H
Definition: surface.cpp:42
static sk_sp< SkSurface > make_surface(GrRecordingContext *ctx, skgpu::graphite::Recorder *recorder, const SkImageInfo &info, uint32_t flags, SkPixelGeometry geo, SkScalar contrast, SkScalar gamma)
Definition: surface.cpp:52

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