land https://codereview.appspot.com/6448046/
authorreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 30 Jul 2012 13:08:01 +0000 (13:08 +0000)
committerreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 30 Jul 2012 13:08:01 +0000 (13:08 +0000)
Add a method reporting used font cache size to the SkGraphics API

git-svn-id: http://skia.googlecode.com/svn/trunk@4825 2bbb7eff-a529-9590-31e7-b0007b416f81

include/core/SkGraphics.h
src/core/SkGlyphCache.cpp

index 3247dc2..c7ee07f 100644 (file)
@@ -49,6 +49,11 @@ public:
     static size_t SetFontCacheLimit(size_t bytes);
 
     /**
+     *  Return the number of bytes currently used by the font cache.
+     */
+    static size_t GetFontCacheUsed();
+
+    /**
      *  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.
index 0beec36..9ca07b9 100644 (file)
@@ -717,6 +717,10 @@ size_t SkGraphics::SetFontCacheLimit(size_t bytes) {
     return getSharedGlobals().setFontCacheLimit(bytes);
 }
 
+size_t SkGraphics::GetFontCacheUsed() {
+    return getSharedGlobals().fTotalMemoryUsed;
+}
+
 void SkGraphics::PurgeFontCache() {
     getSharedGlobals().purgeAll();
     SkTypefaceCache::PurgeAll();