Flutter Engine
The Flutter Engine
Classes | Public Types | Static Public Member Functions | List of all members
SkBitmapCache Class Reference

#include <SkBitmapCache.h>

Classes

class  Rec
 
struct  RecDeleter
 

Public Types

typedef std::unique_ptr< Rec, RecDeleterRecPtr
 

Static Public Member Functions

static bool Find (const SkBitmapCacheDesc &, SkBitmap *result)
 
static RecPtr Alloc (const SkBitmapCacheDesc &, const SkImageInfo &, SkPixmap *)
 
static void Add (RecPtr, SkBitmap *)
 

Detailed Description

Definition at line 43 of file SkBitmapCache.h.

Member Typedef Documentation

◆ RecPtr

typedef std::unique_ptr<Rec, RecDeleter> SkBitmapCache::RecPtr

Definition at line 53 of file SkBitmapCache.h.

Member Function Documentation

◆ Add()

void SkBitmapCache::Add ( RecPtr  rec,
SkBitmap bitmap 
)
static

Definition at line 215 of file SkBitmapCache.cpp.

215 {
216 SkResourceCache::Add(rec.release(), bitmap);
217}
static void Add(Rec *, void *payload=nullptr)
Definition: bitmap.py:1

◆ Alloc()

SkBitmapCache::RecPtr SkBitmapCache::Alloc ( const SkBitmapCacheDesc desc,
const SkImageInfo info,
SkPixmap pmap 
)
static

Definition at line 187 of file SkBitmapCache.cpp.

188 {
189 // Ensure that the info matches the subset (i.e. the subset is the entire image)
190 SkASSERT(info.width() == desc.fSubset.width());
191 SkASSERT(info.height() == desc.fSubset.height());
192
193 const size_t rb = info.minRowBytes();
194 size_t size = info.computeByteSize(rb);
196 return nullptr;
197 }
198
199 std::unique_ptr<SkDiscardableMemory> dm;
200 void* block = nullptr;
201
203 if (factory) {
204 dm.reset(factory(size));
205 } else {
206 block = sk_malloc_canfail(size);
207 }
208 if (!dm && !block) {
209 return nullptr;
210 }
211 *pmap = SkPixmap(info, dm ? dm->data() : block, rb);
212 return RecPtr(new Rec(desc, info, rb, std::move(dm), block));
213}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
#define SkASSERT(cond)
Definition: SkAssert.h:116
static void * sk_malloc_canfail(size_t size)
Definition: SkMalloc.h:93
std::unique_ptr< Rec, RecDeleter > RecPtr
Definition: SkBitmapCache.h:53
static DiscardableFactory GetDiscardableFactory()
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
static bool ByteSizeOverflowed(size_t byteSize)
Definition: SkImageInfo.h:588

◆ Find()

bool SkBitmapCache::Find ( const SkBitmapCacheDesc desc,
SkBitmap result 
)
static

Search based on the desc. If found, returns true and result will be set to the matching bitmap with its pixels already locked.

Definition at line 219 of file SkBitmapCache.cpp.

219 {
220 desc.validate();
222}
static bool Finder(const SkResourceCache::Rec &baseRec, void *contextBitmap)
static bool Find(const Key &key, FindVisitor, void *context)
GAsyncResult * result

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