Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
skresources::FileResourceProvider Class Referencefinal

#include <SkResources.h>

Inheritance diagram for skresources::FileResourceProvider:
skresources::ResourceProvider SkRefCnt SkRefCntBase

Public Member Functions

sk_sp< SkDataload (const char resource_path[], const char resource_name[]) const override
 
sk_sp< ImageAssetloadImageAsset (const char[], const char[], const char[]) const override
 
- Public Member Functions inherited from skresources::ResourceProvider
virtual sk_sp< SkDataload (const char[], const char[]) const
 
virtual sk_sp< ImageAssetloadImageAsset (const char[], const char[], const char[]) const
 
virtual sk_sp< ExternalTrackAssetloadAudioAsset (const char[], const char[], const char[])
 
virtual sk_sp< SkDataloadFont (const char[], const char[]) const
 
virtual sk_sp< SkTypefaceloadTypeface (const char[], const char[]) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static sk_sp< FileResourceProviderMake (SkString base_dir, ImageDecodeStrategy=ImageDecodeStrategy::kLazyDecode)
 

Detailed Description

Definition at line 212 of file SkResources.h.

Member Function Documentation

◆ load()

sk_sp< SkData > skresources::FileResourceProvider::load ( const char  [],
const char  [] 
) const
overridevirtual

Load a generic resource (currently only nested animations) specified by |path| + |name|, and return as an SkData.

Reimplemented from skresources::ResourceProvider.

Definition at line 194 of file SkResources.cpp.

195 {
196 const auto full_dir = SkOSPath::Join(fDir.c_str() , resource_path),
197 full_path = SkOSPath::Join(full_dir.c_str(), resource_name);
198 return SkData::MakeFromFileName(full_path.c_str());
199}
static const char * resource_name(SkPDFResourceType type)
static sk_sp< SkData > MakeFromFileName(const char path[])
Definition: SkData.cpp:148
static SkString Join(const char *rootPath, const char *relativePath)
Definition: SkOSPath.cpp:14
const char * c_str() const
Definition: SkString.h:133

◆ loadImageAsset()

sk_sp< ImageAsset > skresources::FileResourceProvider::loadImageAsset ( const char  [],
const char  [],
const char  [] 
) const
overridevirtual

Load an image asset specified by |path| + |name|, and returns the corresponding ImageAsset proxy.

Reimplemented from skresources::ResourceProvider.

Definition at line 201 of file SkResources.cpp.

203 {
204 auto data = this->load(resource_path, resource_name);
205
206 if (auto image = MultiFrameImageAsset::Make(data, fStrategy)) {
207 return std::move(image);
208 }
209
210#if defined(HAVE_VIDEO_DECODER)
211 if (auto video = VideoAsset::Make(data)) {
212 return std::move(video);
213 }
214#endif
215
216 return nullptr;
217}
sk_sp< SkData > load(const char resource_path[], const char resource_name[]) const override
static sk_sp< MultiFrameImageAsset > Make(sk_sp< SkData >, ImageDecodeStrategy=ImageDecodeStrategy::kLazyDecode)
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
sk_sp< const SkImage > image
Definition: SkRecords.h:269
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ Make()

sk_sp< FileResourceProvider > skresources::FileResourceProvider::Make ( SkString  base_dir,
ImageDecodeStrategy  strat = ImageDecodeStrategy::kLazyDecode 
)
static

Definition at line 185 of file SkResources.cpp.

185 {
186 return sk_isdir(base_dir.c_str()) ? sk_sp<FileResourceProvider>(new FileResourceProvider(
187 std::move(base_dir), strat))
188 : nullptr;
189}
bool sk_isdir(const char *path)

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