Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
ImageSlide Class Reference

#include <ImageSlide.h>

Inheritance diagram for ImageSlide:
Slide SkRefCnt SkRefCntBase

Public Member Functions

 ImageSlide (const SkString &name, const SkString &path)
 
 ImageSlide (const SkString &name, sk_sp< SkImage > image)
 
SkISize getDimensions () const override
 
void draw (SkCanvas *canvas) override
 
void load (SkScalar winWidth, SkScalar winHeight) override
 
void unload () override
 
- Public Member Functions inherited from Slide
virtual SkISize getDimensions () const
 
virtual void gpuTeardown ()
 
virtual void draw (SkCanvas *canvas)=0
 
virtual bool animate (double nanos)
 
virtual void load (SkScalar winWidth, SkScalar winHeight)
 
virtual void resize (SkScalar winWidth, SkScalar winHeight)
 
virtual void unload ()
 
virtual bool onChar (SkUnichar c)
 
virtual bool onMouse (SkScalar x, SkScalar y, skui::InputState state, skui::ModifierKey modifiers)
 
virtual bool onGetControls (SkMetaData *)
 
virtual void onSetControls (const SkMetaData &)
 
const SkStringgetName ()
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Additional Inherited Members

- Protected Attributes inherited from Slide
SkString fName
 

Detailed Description

Definition at line 20 of file ImageSlide.h.

Constructor & Destructor Documentation

◆ ImageSlide() [1/2]

ImageSlide::ImageSlide ( const SkString name,
const SkString path 
)

Definition at line 17 of file ImageSlide.cpp.

17 : fPath(path) {
18 fName = name;
19}
SkString fName
Definition: Slide.h:54
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ ImageSlide() [2/2]

ImageSlide::ImageSlide ( const SkString name,
sk_sp< SkImage image 
)

Definition at line 21 of file ImageSlide.cpp.

22 : fImage(std::move(image)), fRetainImage(true) {
23 fName = name;
24}
sk_sp< const SkImage > image
Definition: SkRecords.h:269

Member Function Documentation

◆ draw()

void ImageSlide::draw ( SkCanvas canvas)
overridevirtual

Implements Slide.

Definition at line 30 of file ImageSlide.cpp.

30 {
31 SkASSERT(fImage);
32 canvas->drawImage(fImage, 0, 0);
33}
#define SkASSERT(cond)
Definition: SkAssert.h:116
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528

◆ getDimensions()

SkISize ImageSlide::getDimensions ( ) const
overridevirtual

A slide may have a content dimensions that is independent of the current window size. An empty size indicates that the Slide's dimensions are equal to the window's dimensions.

Reimplemented from Slide.

Definition at line 26 of file ImageSlide.cpp.

26 {
27 return fImage ? fImage->dimensions() : SkISize::Make(0, 0);
28}
SkISize dimensions() const
Definition: SkImage.h:297
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ load()

void ImageSlide::load ( SkScalar  winWidth,
SkScalar  winHeight 
)
overridevirtual

Reimplemented from Slide.

Definition at line 35 of file ImageSlide.cpp.

35 {
36 if (fRetainImage) {
37 SkASSERT(fImage);
38 } else {
40 fImage = SkImages::DeferredFromEncodedData(encoded);
41 }
42}
static sk_sp< SkData > MakeFromFileName(const char path[])
Definition: SkData.cpp:148
const char * c_str() const
Definition: SkString.h:133
SK_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)

◆ unload()

void ImageSlide::unload ( )
overridevirtual

Reimplemented from Slide.

Definition at line 44 of file ImageSlide.cpp.

44 {
45 if (!fRetainImage) {
46 fImage.reset(nullptr);
47 }
48}
void reset(T *ptr=nullptr)
Definition: SkRefCnt.h:310

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