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

Public Member Functions

 ReadPixelsPictureGM ()
 
- 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
 
DrawResult onDraw (SkCanvas *canvas, SkString *errorMsg) 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 247 of file readpixels.cpp.

Constructor & Destructor Documentation

◆ ReadPixelsPictureGM()

ReadPixelsPictureGM::ReadPixelsPictureGM ( )
inline

Definition at line 249 of file readpixels.cpp.

249{}

Member Function Documentation

◆ getISize()

SkISize ReadPixelsPictureGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 254 of file readpixels.cpp.

254{ return SkISize::Make(3 * kWidth, 12 * kHeight); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString ReadPixelsPictureGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 252 of file readpixels.cpp.

252{ return SkString("readpixelspicture"); }

◆ onDraw()

DrawResult ReadPixelsPictureGM::onDraw ( SkCanvas canvas,
SkString errorMsg 
)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 256 of file readpixels.cpp.

256 {
257 if (!canvas->imageInfo().colorSpace()) {
258 *errorMsg = "This gm is only interesting in color correct modes.";
259 return DrawResult::kSkip;
260 }
261
262 const sk_sp<SkImage> images[] = {
264 };
265 const SkAlphaType alphaTypes[] = {
268 };
269 const SkColorType colorTypes[] = {
273 };
274 const sk_sp<SkColorSpace> colorSpaces[] = {
278 };
279 const SkImage::CachingHint hints[] = {
282 };
283
284 for (const sk_sp<SkImage>& image : images) {
285 for (const sk_sp<SkColorSpace>& dstColorSpace : colorSpaces) {
286 canvas->save();
287 for (SkColorType dstColorType : colorTypes) {
288 for (SkAlphaType dstAlphaType : alphaTypes) {
289 for (SkImage::CachingHint hint : hints) {
290 draw_image(nullptr, canvas, image.get(), dstColorType, dstAlphaType,
291 dstColorSpace, hint);
292 canvas->translate(0.0f, (float) kHeight);
293 }
294 }
295 }
296 canvas->restore();
297 canvas->translate((float) kWidth, 0.0f);
298 }
299 }
300 return DrawResult::kOk;
301 }
kUnpremul_SkAlphaType
SkAlphaType
Definition: SkAlphaType.h:26
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
SkColorType
Definition: SkColorType.h:19
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
Definition: SkColorType.h:26
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
Definition: SkColorType.h:38
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkColorType.h:24
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
int save()
Definition: SkCanvas.cpp:447
SkImageInfo imageInfo() const
Definition: SkCanvas.cpp:1206
static sk_sp< SkColorSpace > MakeSRGB()
CachingHint
Definition: SkImage.h:463
@ kDisallow_CachingHint
disallows internally caching decoded and copied pixels
Definition: SkImage.h:465
@ kAllow_CachingHint
allows internally caching decoded and copied pixels
Definition: SkImage.h:464
T * get() const
Definition: SkRefCnt.h:303
std::array< MockImage, 3 > images
Definition: mock_vulkan.cc:41
sk_sp< const SkImage > image
Definition: SkRecords.h:269
static void draw_image(GrDirectContext *dContext, SkCanvas *canvas, SkImage *image, SkColorType dstColorType, SkAlphaType dstAlphaType, sk_sp< SkColorSpace > dstColorSpace, SkImage::CachingHint hint)
Definition: readpixels.cpp:112
static sk_sp< SkColorSpace > make_wide_gamut()
Definition: readpixels.cpp:85
static sk_sp< SkImage > make_picture_image()
Definition: readpixels.cpp:67
static sk_sp< SkColorSpace > make_small_gamut()
Definition: readpixels.cpp:99
SkColorSpace * colorSpace() const

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