Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
Type::kRGBA::AyncYUVNoScaleGM Class Reference

Inherits AsyncReadGMBase.

Public Member Functions

 AyncYUVNoScaleGM ()
 
DrawResult onDraw (SkCanvas *canvas, SkString *errorMsg) override
 
SkISize getISize () override
 

Detailed Description

Definition at line 531 of file asyncrescaleandread.cpp.

Constructor & Destructor Documentation

◆ AyncYUVNoScaleGM()

Type::kRGBA::AyncYUVNoScaleGM::AyncYUVNoScaleGM ( )
inline

Definition at line 533 of file asyncrescaleandread.cpp.

533: AsyncReadGMBase("async_yuv_no_scale") {}

Member Function Documentation

◆ getISize()

SkISize Type::kRGBA::AyncYUVNoScaleGM::getISize ( )
inlineoverride

Definition at line 572 of file asyncrescaleandread.cpp.

572{ return {400, 300}; }

◆ onDraw()

DrawResult Type::kRGBA::AyncYUVNoScaleGM::onDraw ( SkCanvas canvas,
SkString errorMsg 
)
inlineoverride

Definition at line 534 of file asyncrescaleandread.cpp.

534 {
535 auto surface = canvas->getSurface();
536 if (!surface) {
537 *errorMsg = "Not supported on recording/vector backends.";
539 }
540
541 auto dContext = GrAsDirectContext(surface->recordingContext());
542 if (!dContext && surface->recordingContext()) {
543 *errorMsg = "Not supported in DDL mode";
545 }
546
547 auto image = ToolUtils::GetResourceAsImage("images/yellow_rose.webp");
548 if (!image) {
550 }
552 canvas->drawImage(image.get(), 0, 0);
553
554 skgpu::graphite::Recorder* recorder = canvas->recorder();
555 SkScopeExit scopeExit;
556 auto yuvImage = readAndScaleYUVA<ReadSource::kSurface>(surface,
557 SkIRect::MakeWH(400, 300),
558 SkISize{400, 300},
559 /*readAlpha=*/false,
560 dContext,
561 recorder,
565 &scopeExit);
566
567 canvas->clear(SK_ColorWHITE);
568 canvas->drawImage(yuvImage.get(), 0, 0);
569
571 }
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
@ kRec601_SkYUVColorSpace
Definition: SkImageInfo.h:99
SkSurface * getSurface() const
Definition: SkCanvas.cpp:365
virtual skgpu::graphite::Recorder * recorder() const
Definition: SkCanvas.cpp:1641
void clear(SkColor color)
Definition: SkCanvas.h:1199
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
T * get() const
Definition: SkRefCnt.h:303
const Paint & paint
Definition: color_source.cc:38
VkSurfaceKHR surface
Definition: main.cc:49
sk_sp< const SkImage > image
Definition: SkRecords.h:269
sk_sp< SkImage > GetResourceAsImage(const char *resource)
Definition: DecodeUtils.h:25
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
Definition: SkRect.h:56
Definition: SkSize.h:16

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