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

Public Member Functions

 ReadPixelsCodecGM ()
 
- 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 185 of file readpixels.cpp.

Constructor & Destructor Documentation

◆ ReadPixelsCodecGM()

ReadPixelsCodecGM::ReadPixelsCodecGM ( )
inline

Definition at line 187 of file readpixels.cpp.

187{}

Member Function Documentation

◆ getISize()

SkISize ReadPixelsCodecGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 192 of file readpixels.cpp.

192 {
193 return SkISize::Make(3 * (kEncodedWidth + 1), 12 * (kEncodedHeight + 1));
194 }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString ReadPixelsCodecGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 190 of file readpixels.cpp.

190{ return SkString("readpixelscodec"); }

◆ onDraw()

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

Reimplemented from skiagm::GM.

Definition at line 196 of file readpixels.cpp.

196 {
197 if (!canvas->imageInfo().colorSpace()) {
198 *errorMsg = "This gm is only interesting in color correct modes.";
199 return DrawResult::kSkip;
200 }
201
202 const SkAlphaType alphaTypes[] = {
205 };
206 const SkColorType colorTypes[] = {
210 };
211 const sk_sp<SkColorSpace> colorSpaces[] = {
215 };
216 const SkImage::CachingHint hints[] = {
219 };
220
222 for (const sk_sp<SkColorSpace>& dstColorSpace : colorSpaces) {
223 canvas->save();
224 for (SkColorType dstColorType : colorTypes) {
225 for (SkAlphaType dstAlphaType : alphaTypes) {
226 for (SkImage::CachingHint hint : hints) {
227 draw_image(nullptr, canvas, image.get(), dstColorType, dstAlphaType,
228 dstColorSpace, hint);
229 canvas->translate(0.0f, (float) kEncodedHeight + 1);
230 }
231 }
232 }
233 canvas->restore();
234 canvas->translate((float) kEncodedWidth + 1, 0.0f);
235 }
236 return DrawResult::kOk;
237 }
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
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_codec_image()
Definition: readpixels.cpp:50
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: