diff options
author | Mike Reed <reed@google.com> | 2017-06-01 14:45:44 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-06-01 20:55:16 +0000 |
commit | d5bee5d50c60eedda697ac305658d3817125e147 (patch) | |
tree | 237b9a07901994ecfb41f1a7a026f7c9d7815ae5 /include | |
parent | c3cbd734f06ced8a1bc4d5529b4a961b10779178 (diff) |
add API to change max pointsize for font cache
Bug: skia:6585
Change-Id: I6df8c439dca0a154e8fbfce6d66c536665dff1d7
Reviewed-on: https://skia-review.googlesource.com/18314
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkGraphics.h | 24 | ||||
-rw-r--r-- | include/core/SkPaint.h | 13 |
2 files changed, 25 insertions, 12 deletions
diff --git a/include/core/SkGraphics.h b/include/core/SkGraphics.h index 4b62e55efc..1c97f0c291 100644 --- a/include/core/SkGraphics.h +++ b/include/core/SkGraphics.h @@ -72,6 +72,30 @@ public: */ static int SetFontCacheCountLimit(int count); + /* + * Returns the maximum point size for text that may be cached. + * + * Sizes above this will be drawn directly from the font's outline. + * Setting this to a large value may speed up drawing larger text (repeatedly), + * but could cause the cache to purge other sizes more often. + * + * This value is a hint to the font engine, and the actual limit may be different due to + * implementation specific details. + */ + static int GetFontCachePointSizeLimit(); + + /* + * Set the maximum point size for text that may be cached, returning the previous value. + * + * Sizes above this will be drawn directly from the font's outline. + * Setting this to a large value may speed up drawing larger text (repeatedly), + * but could cause the cache to purge other sizes more often. + * + * This value is a hint to the font engine, and the actual limit may be different due to + * implementation specific details. + */ + static int SetFontCachePointSizeLimit(int maxPointSize); + /** * For debugging purposes, this will attempt to purge the font cache. It * does not change the limit, but will cause subsequent font measures and diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index 3a10c872aa..5b2283aa19 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -1110,13 +1110,6 @@ private: * need not match per-se. */ kCanonicalTextSizeForPaths = 64, - - /* - * Above this size (taking into account CTM and textSize), we never use - * the cache for bits or metrics (we might overflow), so we just ask - * for a caononical size and post-transform that. - */ - kMaxSizeForGlyphCache = 256, }; static bool TooBigToUseCache(const SkMatrix& ctm, const SkMatrix& textM); @@ -1126,11 +1119,7 @@ private: // have change it to kCanonicalTextSizeForPaths. SkScalar setupForAsPaths(); - static SkScalar MaxCacheSize2() { - static const SkScalar kMaxSize = SkIntToScalar(kMaxSizeForGlyphCache); - static const SkScalar kMag2Max = kMaxSize * kMaxSize; - return kMag2Max; - } + static SkScalar MaxCacheSize2(); friend class SkAutoGlyphCache; friend class SkAutoGlyphCacheNoGamma; |