Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
VideoDecoderGM Class Reference
Inheritance diagram for VideoDecoderGM:
skiagm::GM

Public Member Functions

 VideoDecoderGM ()
 
- 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 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
 
bool onAnimate (double nanos) override
 
- Protected Member Functions inherited from skiagm::GM
virtual DrawResult onGpuSetup (SkCanvas *, SkString *, GraphiteTestContext *)
 
virtual void onGpuTeardown ()
 
virtual DrawResult onDraw (SkCanvas *, SkString *errorMsg)
 
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 13 of file video_decoder.cpp.

Constructor & Destructor Documentation

◆ VideoDecoderGM()

VideoDecoderGM::VideoDecoderGM ( )
inline

Definition at line 17 of file video_decoder.cpp.

17{}

Member Function Documentation

◆ getISize()

SkISize VideoDecoderGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 22 of file video_decoder.cpp.

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

◆ getName()

SkString VideoDecoderGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 20 of file video_decoder.cpp.

20{ return SkString("videodecoder"); }

◆ onAnimate()

bool VideoDecoderGM::onAnimate ( double  nanos)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 53 of file video_decoder.cpp.

53 {
54 return true;
55 }

◆ onDraw()

void VideoDecoderGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 31 of file video_decoder.cpp.

31 {
32 auto* rContext = canvas->recordingContext();
33 if (!rContext) {
34 return;
35 }
36
37 fDecoder.setGrContext(rContext); // context can change over time in viewer
38
39 double timeStamp;
40 auto img = fDecoder.nextImage(&timeStamp);
41 if (!img) {
42 (void)fDecoder.rewind();
43 img = fDecoder.nextImage(&timeStamp);
44 }
45 if (img) {
46 if (0) {
47 SkDebugf("ts %g\n", timeStamp);
48 }
49 canvas->drawImage(img, 10, 10);
50 }
51 }
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
virtual GrRecordingContext * recordingContext() const
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition SkCanvas.h:1528
void setGrContext(GrRecordingContext *rContext)
sk_sp< SkImage > nextImage(double *timeStamp=nullptr)

◆ onOnceBeforeDraw()

void VideoDecoderGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 24 of file video_decoder.cpp.

24 {
25 if (!fDecoder.loadStream(SkStream::MakeFromFile("/skia/ice.mp4"))) {
26 SkDebugf("could not load movie file\n");
27 }
28 SkDebugf("duration %g\n", fDecoder.duration());
29 }
static std::unique_ptr< SkStreamAsset > MakeFromFile(const char path[])
Definition SkStream.cpp:922
double duration() const
bool loadStream(std::unique_ptr< SkStream >)

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