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

Public Member Functions

 YUVSplitterGM ()
 
- 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 1250 of file wacky_yuv_formats.cpp.

Constructor & Destructor Documentation

◆ YUVSplitterGM()

YUVSplitterGM::YUVSplitterGM ( )
inline

Definition at line 1254 of file wacky_yuv_formats.cpp.

1254{}

Member Function Documentation

◆ getISize()

SkISize YUVSplitterGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 1259 of file wacky_yuv_formats.cpp.

1259{ return SkISize::Make(1280, 768); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString YUVSplitterGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 1257 of file wacky_yuv_formats.cpp.

1257{ return SkString("yuv_splitter"); }

◆ onDraw()

void YUVSplitterGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 1265 of file wacky_yuv_formats.cpp.

1265 {
1266 canvas->translate(fOrig->width(), 0);
1267 canvas->save();
1269 std::array<sk_sp<SkImage>, SkYUVAInfo::kMaxPlanes> planes;
1270 for (auto cs : {kRec709_SkYUVColorSpace,
1274 std::tie(planes, info) = sk_gpu_test::MakeYUVAPlanesAsA8(fOrig.get(),
1275 cs,
1277 /*recording context*/ nullptr);
1278 SkPixmap pixmaps[4];
1279 for (int i = 0; i < info.numPlanes(); ++i) {
1280 planes[i]->peekPixels(&pixmaps[i]);
1281 }
1282 auto yuvaPixmaps = SkYUVAPixmaps::FromExternalPixmaps(info, pixmaps);
1284 yuvaPixmaps,
1286 /* limit to max tex size */ false,
1287 /* color space */ nullptr);
1288 if (img) {
1289 canvas->drawImage(img, 0, 0);
1290 draw_diff(canvas, 0, fOrig->height(), fOrig.get(), img.get());
1291 }
1292 canvas->translate(fOrig->width(), 0);
1293 }
1294 canvas->restore();
1295 canvas->translate(-fOrig->width(), 0);
1296 int y = 0;
1297 for (int i = 0; i < info.numPlanes(); ++i) {
1298 canvas->drawImage(planes[i], 0, y);
1299 y += planes[i]->height();
1300 }
1301 }
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
@ kBT2020_SkYUVColorSpace
Definition: SkImageInfo.h:101
@ kJPEG_SkYUVColorSpace
Definition: SkImageInfo.h:98
@ kRec601_SkYUVColorSpace
Definition: SkImageInfo.h:99
@ kRec709_SkYUVColorSpace
Definition: SkImageInfo.h:100
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
virtual GrRecordingContext * recordingContext() const
Definition: SkCanvas.cpp:1637
int save()
Definition: SkCanvas.cpp:447
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
int width() const
Definition: SkImage.h:285
int height() const
Definition: SkImage.h:291
static constexpr int kMaxPlanes
Definition: SkYUVAInfo.h:98
@ k444
No subsampling. UV values for each Y.
static SkYUVAPixmaps FromExternalPixmaps(const SkYUVAInfo &, const SkPixmap[kMaxPlanes])
T * get() const
Definition: SkRefCnt.h:303
double y
SK_API sk_sp< SkImage > TextureFromYUVAPixmaps(GrRecordingContext *context, const SkYUVAPixmaps &pixmaps, skgpu::Mipmapped buildMips, bool limitToMaxTextureSize, sk_sp< SkColorSpace > imageColorSpace)
std::tuple< std::array< sk_sp< SkImage >, SkYUVAInfo::kMaxPlanes >, SkYUVAInfo > MakeYUVAPlanesAsA8(SkImage *src, SkYUVColorSpace cs, SkYUVAInfo::Subsampling ss, GrRecordingContext *rContext)
Definition: YUVUtils.cpp:152
static void draw_diff(SkCanvas *canvas, SkScalar x, SkScalar y, const SkImage *a, const SkImage *b)

◆ onOnceBeforeDraw()

void YUVSplitterGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 1261 of file wacky_yuv_formats.cpp.

1261 {
1262 fOrig = ToolUtils::GetResourceAsImage("images/mandrill_256.png");
1263 }
sk_sp< SkImage > GetResourceAsImage(const char *resource)
Definition: DecodeUtils.h:25

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