diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-11-08 13:48:32 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-11-08 13:48:32 +0000 |
commit | 77407ca019ca1bb98dd65f940be825d38719e983 (patch) | |
tree | 50a62c68e649ef2fbf4032006eef19d01387976e /include | |
parent | ca08edd7a88d4691f0ec762fe7c8dee96ef0052b (diff) |
add api to SkGraphics to get/set font cache limit
add SK_DEFAULT_FONT_CACHE_LIMIT to SkUserConfig, to override our default value
git-svn-id: http://skia.googlecode.com/svn/trunk@2621 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/config/SkUserConfig.h | 6 | ||||
-rw-r--r-- | include/core/SkFontHost.h | 8 | ||||
-rw-r--r-- | include/core/SkGraphics.h | 39 |
3 files changed, 36 insertions, 17 deletions
diff --git a/include/config/SkUserConfig.h b/include/config/SkUserConfig.h index 270c51c400..439cbea030 100644 --- a/include/config/SkUserConfig.h +++ b/include/config/SkUserConfig.h @@ -105,6 +105,12 @@ */ //#define SkDebugf(...) MyFunction(__VA_ARGS__) +/* + * To specify a different default font cache limit, define this. If this is + * undefined, skia will use a built-in value. + */ +//#define SK_DEFAULT_FONT_CACHE_LIMIT (1024 * 1024) + /* If defined, use CoreText instead of ATSUI on OS X. */ //#define SK_USE_MAC_CORE_TEXT diff --git a/include/core/SkFontHost.h b/include/core/SkFontHost.h index 8858ecb817..c32c3d5ae0 100644 --- a/include/core/SkFontHost.h +++ b/include/core/SkFontHost.h @@ -232,14 +232,6 @@ public: /////////////////////////////////////////////////////////////////////////// - /** Return the number of bytes (approx) that should be purged from the font - cache. The input parameter is the cache's estimate of how much as been - allocated by the cache so far. - To purge (basically) everything, return the input parameter. - To purge nothing, return 0 - */ - static size_t ShouldPurgeFontCache(size_t sizeAllocatedSoFar); - /** Return SkScalerContext gamma flag, or 0, based on the paint that will be used to draw something with antialiasing. */ diff --git a/include/core/SkGraphics.h b/include/core/SkGraphics.h index 114364f274..d6af865931 100644 --- a/include/core/SkGraphics.h +++ b/include/core/SkGraphics.h @@ -17,20 +17,41 @@ public: static void Init(); static void Term(); - /** Return the (approximate) number of bytes used by the font cache. - */ + /** + * Return the version numbers for the library. If the parameter is not + * null, it is set to the version number. + */ + static void GetVersion(int32_t* major, int32_t* minor, int32_t* patch); + + // Font Cache routines + + /** + * Return the (approximate) number of bytes used by the font cache. + */ static size_t GetFontCacheUsed(); - /** Attempt to purge the font cache until <= the specified amount remains - in the cache. Specifying 0 will attempt to purge the entire cache. - Returns true if some amount was purged from the font cache. - */ + /** + * Attempt to purge the font cache until <= the specified amount remains + * in the cache. Specifying 0 will attempt to purge the entire cache. + * Returns true if some amount was purged from the font cache. + */ static bool SetFontCacheUsed(size_t usageInBytes); - /** Return the version numbers for the library. If the parameter is not - null, it is set to the version number. + /** + * 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(). */ - static void GetVersion(int32_t* major, int32_t* minor, int32_t* patch); + static size_t GetFontCacheLimit(); + + /** + * 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. + */ + static size_t SetFontCacheLimit(size_t bytes); private: /** This is automatically called by SkGraphics::Init(), and must be |