Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
SkGraphics Class Reference

#include <SkGraphics.h>

Public Types

typedef std::unique_ptr< SkImageGenerator >(* ImageGeneratorFromEncodedDataFactory) (sk_sp< SkData >)
 
using OpenTypeSVGDecoderFactory = std::unique_ptr< SkOpenTypeSVGDecoder >(*)(const uint8_t *svg, size_t length)
 

Static Public Member Functions

static void Init ()
 
static size_t GetFontCacheLimit ()
 
static size_t SetFontCacheLimit (size_t bytes)
 
static size_t GetFontCacheUsed ()
 
static int GetFontCacheCountUsed ()
 
static int GetFontCacheCountLimit ()
 
static int SetFontCacheCountLimit (int count)
 
static int GetTypefaceCacheCountLimit ()
 
static int SetTypefaceCacheCountLimit (int count)
 
static void PurgeFontCache ()
 
static void PurgePinnedFontCache ()
 
static size_t GetResourceCacheTotalBytesUsed ()
 
static size_t GetResourceCacheTotalByteLimit ()
 
static size_t SetResourceCacheTotalByteLimit (size_t newLimit)
 
static void PurgeResourceCache ()
 
static size_t GetResourceCacheSingleAllocationByteLimit ()
 
static size_t SetResourceCacheSingleAllocationByteLimit (size_t newLimit)
 
static void DumpMemoryStatistics (SkTraceMemoryDump *dump)
 
static void PurgeAllCaches ()
 
static ImageGeneratorFromEncodedDataFactory SetImageGeneratorFromEncodedDataFactory (ImageGeneratorFromEncodedDataFactory)
 
static OpenTypeSVGDecoderFactory SetOpenTypeSVGDecoderFactory (OpenTypeSVGDecoderFactory)
 
static OpenTypeSVGDecoderFactory GetOpenTypeSVGDecoderFactory ()
 

Detailed Description

Definition at line 23 of file SkGraphics.h.

Member Typedef Documentation

◆ ImageGeneratorFromEncodedDataFactory

typedef std::unique_ptr< SkImageGenerator >(* SkGraphics::ImageGeneratorFromEncodedDataFactory) (sk_sp< SkData >)

Definition at line 143 of file SkGraphics.h.

◆ OpenTypeSVGDecoderFactory

using SkGraphics::OpenTypeSVGDecoderFactory = std::unique_ptr<SkOpenTypeSVGDecoder> (*)(const uint8_t* svg, size_t length)

To draw OpenType SVG data, Skia will look at this runtime function pointer. If this function pointer is set, the SkTypeface implementations which support OpenType SVG will call this function to create an SkOpenTypeSVGDecoder to decode the OpenType SVG and draw it as needed. If this function is not set, the SkTypeface implementations will generally not support OpenType SVG and attempt to use other glyph representations if available.

Definition at line 163 of file SkGraphics.h.

Member Function Documentation

◆ DumpMemoryStatistics()

void SkGraphics::DumpMemoryStatistics ( SkTraceMemoryDump dump)
static

Dumps memory usage of caches using the SkTraceMemoryDump interface. See SkTraceMemoryDump for usage of this method.

Definition at line 35 of file SkGraphics.cpp.

35 {
38}
static void dump(const float m[20], SkYUVColorSpace cs, bool rgb2yuv)
static void DumpMemoryStatistics(SkTraceMemoryDump *dump)
static void DumpMemoryStatistics(SkTraceMemoryDump *dump)

◆ GetFontCacheCountLimit()

int SkGraphics::GetFontCacheCountLimit ( )
static

Return the current limit to the number of entries in the font cache. A cache "entry" is associated with each typeface + pointSize + matrix.

Definition at line 60 of file SkGraphics.cpp.

60 {
62}
int getCacheCountLimit() const SK_EXCLUDES(fLock)
static SkStrikeCache * GlobalStrikeCache()

◆ GetFontCacheCountUsed()

int SkGraphics::GetFontCacheCountUsed ( )
static

Return the number of entries in the font cache. A cache "entry" is associated with each typeface + pointSize + matrix.

Definition at line 68 of file SkGraphics.cpp.

68 {
70}
int getCacheCountUsed() const SK_EXCLUDES(fLock)

◆ GetFontCacheLimit()

size_t SkGraphics::GetFontCacheLimit ( )
static

Return the max number of bytes that should be used by the font cache. If the cache needs to allocate more, it will purge previous entries. This max can be changed by calling SetFontCacheLimit().

Definition at line 48 of file SkGraphics.cpp.

48 {
50}
size_t getCacheSizeLimit() const SK_EXCLUDES(fLock)

◆ GetFontCacheUsed()

size_t SkGraphics::GetFontCacheUsed ( )
static

Return the number of bytes currently used by the font cache.

Definition at line 56 of file SkGraphics.cpp.

56 {
58}
size_t getTotalMemoryUsed() const SK_EXCLUDES(fLock)

◆ GetOpenTypeSVGDecoderFactory()

SkGraphics::OpenTypeSVGDecoderFactory SkGraphics::GetOpenTypeSVGDecoderFactory ( )
static

Definition at line 102 of file SkGraphics.cpp.

102 {
103 return gSVGDecoderFactory;
104}
static SkGraphics::OpenTypeSVGDecoderFactory gSVGDecoderFactory

◆ GetResourceCacheSingleAllocationByteLimit()

size_t SkGraphics::GetResourceCacheSingleAllocationByteLimit ( )
static

When the cachable entry is very lage (e.g. a large scaled bitmap), adding it to the cache can cause most/all of the existing entries to be purged. To avoid the, the client can set a limit for a single allocation. If a cacheable entry would have been cached, but its size exceeds this limit, then we do not attempt to cache it at all.

Zero is the default value, meaning we always attempt to cache entries.

Definition at line 576 of file SkResourceCache.cpp.

576 {
578}
static size_t GetSingleAllocationByteLimit()

◆ GetResourceCacheTotalByteLimit()

size_t SkGraphics::GetResourceCacheTotalByteLimit ( )
static

These functions get/set the memory usage limit for the resource cache, used for temporary bitmaps and other resources. Entries are purged from the cache when the memory useage exceeds this limit.

Definition at line 568 of file SkResourceCache.cpp.

568 {
570}
static size_t GetTotalByteLimit()

◆ GetResourceCacheTotalBytesUsed()

size_t SkGraphics::GetResourceCacheTotalBytesUsed ( )
static

This function returns the memory used for temporary images and other resources.

Definition at line 564 of file SkResourceCache.cpp.

564 {
566}
static size_t GetTotalBytesUsed()

◆ GetTypefaceCacheCountLimit()

int SkGraphics::GetTypefaceCacheCountLimit ( )
static

Return the current limit to the number of entries in the typeface cache. A cache "entry" is associated with each typeface.

Definition at line 83 of file SkGraphics.cpp.

83 {
85}
static int gTypefaceCacheCountLimit

◆ Init()

void SkGraphics::Init ( )
static

Call this at process initialization time if your environment does not permit static global initializers that execute code. Init() is thread-safe and idempotent.

Definition at line 22 of file SkGraphics.cpp.

22 {
23 // SkGraphics::Init() must be thread-safe and idempotent.
26 SkOpts::Init_BitmapProcState();
31}
void Init()
Definition SkOpts.cpp:66
void Init_BlitMask()
void Init_Swizzler()
void Init_Memset()
void Init_BlitRow()
static void CacheRuntimeFeatures()
Definition SkCpu.cpp:94

◆ PurgeAllCaches()

void SkGraphics::PurgeAllCaches ( )
static

Free as much globally cached memory as possible. This will purge all private caches in Skia, including font and image caches.

If there are caches associated with GPU context, those will not be affected by this call.

Definition at line 40 of file SkGraphics.cpp.

40 {
43 SkImageFilter_Base::PurgeCache();
44}
static void PurgeResourceCache()
static void PurgeFontCache()

◆ PurgeFontCache()

void SkGraphics::PurgeFontCache ( )
static

For debugging purposes, this will attempt to purge the font cache. It does not change the limit, but will cause subsequent font measures and draws to be recreated, since they will no longer be in the cache.

Definition at line 72 of file SkGraphics.cpp.

72 {
75}
void purgeAll() SK_EXCLUDES(fLock)
static void PurgeAll()

◆ PurgePinnedFontCache()

void SkGraphics::PurgePinnedFontCache ( )
static

If the strike cache is above the cache limit, attempt to purge strikes with pinners. This should be called after clients release locks on pinned strikes.

Definition at line 77 of file SkGraphics.cpp.

77 {
79}
void purgePinned(size_t minBytesNeeded=0) SK_EXCLUDES(fLock)

◆ PurgeResourceCache()

void SkGraphics::PurgeResourceCache ( )
static

For debugging purposes, this will attempt to purge the resource cache. It does not change the limit.

Definition at line 584 of file SkResourceCache.cpp.

584 {
585 SkImageFilter_Base::PurgeCache();
587}
static void PurgeAll()

◆ SetFontCacheCountLimit()

int SkGraphics::SetFontCacheCountLimit ( int  count)
static

Set the limit to the number of entries in the font cache, and return the previous value. If this new value is lower than the previous, it will automatically try to purge entries to meet the new limit.

Definition at line 64 of file SkGraphics.cpp.

64 {
66}
int count
int setCacheCountLimit(int limit) SK_EXCLUDES(fLock)

◆ SetFontCacheLimit()

size_t SkGraphics::SetFontCacheLimit ( size_t  bytes)
static

Specify the max number of bytes that should be used by the font cache. If the cache needs to allocate more, it will purge previous entries.

This function returns the previous setting, as if GetFontCacheLimit() had be called before the new limit was set.

Definition at line 52 of file SkGraphics.cpp.

52 {
54}
size_t setCacheSizeLimit(size_t limit) SK_EXCLUDES(fLock)

◆ SetImageGeneratorFromEncodedDataFactory()

SkGraphics::ImageGeneratorFromEncodedDataFactory SkGraphics::SetImageGeneratorFromEncodedDataFactory ( ImageGeneratorFromEncodedDataFactory  factory)
static

To instantiate images from encoded data, first looks at this runtime function-ptr. If it exists, it is called to create an SkImageGenerator from SkData. If there is no function-ptr or there is, but it returns NULL, then skia will call its internal default implementation.

Returns the previous factory (which could be NULL).

Definition at line 26 of file SkImageGenerator_FromEncoded.cpp.

27{
29 gFactory = factory;
30 return prev;
31}
static float prev(float f)
static SkGraphics::ImageGeneratorFromEncodedDataFactory gFactory
std::unique_ptr< SkImageGenerator >(* ImageGeneratorFromEncodedDataFactory)(sk_sp< SkData >)
Definition SkGraphics.h:144

◆ SetOpenTypeSVGDecoderFactory()

SkGraphics::OpenTypeSVGDecoderFactory SkGraphics::SetOpenTypeSVGDecoderFactory ( OpenTypeSVGDecoderFactory  svgDecoderFactory)
static

Definition at line 96 of file SkGraphics.cpp.

96 {
98 gSVGDecoderFactory = svgDecoderFactory;
99 return old;
100}
std::unique_ptr< SkOpenTypeSVGDecoder >(*)(const uint8_t *svg, size_t length) OpenTypeSVGDecoderFactory
Definition SkGraphics.h:164

◆ SetResourceCacheSingleAllocationByteLimit()

size_t SkGraphics::SetResourceCacheSingleAllocationByteLimit ( size_t  newLimit)
static

Definition at line 580 of file SkResourceCache.cpp.

580 {
582}
static size_t SetSingleAllocationByteLimit(size_t)

◆ SetResourceCacheTotalByteLimit()

size_t SkGraphics::SetResourceCacheTotalByteLimit ( size_t  newLimit)
static

Definition at line 572 of file SkResourceCache.cpp.

572 {
573 return SkResourceCache::SetTotalByteLimit(newLimit);
574}
static size_t SetTotalByteLimit(size_t newLimit)

◆ SetTypefaceCacheCountLimit()

int SkGraphics::SetTypefaceCacheCountLimit ( int  count)
static

Set the limit to the number of entries in the typeface cache, and return the previous value. Changes to this only take effect the next time each cache object is modified.

Definition at line 87 of file SkGraphics.cpp.

87 {
90 return prev;
91}

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