summaryrefslogtreecommitdiffstats
path: root/include/minikin/FontCollection.h
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2014-05-21 08:37:49 -0700
committerRaph Levien <raph@google.com>2014-05-27 15:39:33 +0000
commit4d4e6bc8118d15542f1f2a9218f0f7a91a29474f (patch)
treecdfd772d61a6eb71d7268f5d278e82202a247769 /include/minikin/FontCollection.h
parentd973b3926b3a34c19d3d6f309fae1138e782e4dc (diff)
downloadandroid_frameworks_minikin-4d4e6bc8118d15542f1f2a9218f0f7a91a29474f.tar.gz
android_frameworks_minikin-4d4e6bc8118d15542f1f2a9218f0f7a91a29474f.tar.bz2
android_frameworks_minikin-4d4e6bc8118d15542f1f2a9218f0f7a91a29474f.zip
Caching for layouts and harfbuzz faces
This patch adds caching for both layouts and for HarfBuzz face objects. The granularity of the cache for layouts is words, so it splits the input string at word boundaries (using a heuristic). There are is also some refactoring to reduce the amount of allocation and copying, and movement towards properly supporting contexts. The size of the caches is a fixed number of entries; thus, it is possible to consume a large amount of memory by filling the cache with lots of large strings. This should be refined towards a scheme that bounds the total memory used by the cache. This patch fixes bug 15237293 "Regression: Measure performance is significantly slower with minikin". Change-Id: Ie8176857e2d78656ce5479a7c04969819ef2718d
Diffstat (limited to 'include/minikin/FontCollection.h')
-rw-r--r--include/minikin/FontCollection.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/minikin/FontCollection.h b/include/minikin/FontCollection.h
index dc48f8e..c6c2ed0 100644
--- a/include/minikin/FontCollection.h
+++ b/include/minikin/FontCollection.h
@@ -54,9 +54,12 @@ public:
int start;
int end;
};
+
void itemize(const uint16_t *string, size_t string_length, FontStyle style,
std::vector<Run>* result) const;
- private:
+
+ uint32_t getId() const;
+private:
static const int kLogCharsPerPage = 8;
static const int kPageMask = (1 << kLogCharsPerPage) - 1;
@@ -70,6 +73,12 @@ public:
size_t end;
};
+ // static for allocating unique id's
+ static uint32_t sNextId;
+
+ // unique id for this font collection (suitable for cache key)
+ uint32_t mId;
+
// Highest UTF-32 code point that can be mapped
uint32_t mMaxChar;