Do not embed glyph image data in SkGlyphCache.
Instead of allocating memory for glyph images eagerly by embedding the memory in the glyph cache, allocate memory dynamically on need. TBR=bungeman@google.com BUG=chromium:684366 Change-Id: If32bbc4d2608c976b93868feb519dcfa1212ce59 Reviewed-on: https://skia-review.googlesource.com/7433 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
parent
7717d4a343
commit
80d22ea13a
@ -237,13 +237,11 @@ private:
|
|||||||
SkTHashTable<SkGlyph, SkPackedGlyphID, SkGlyph::HashTraits> fGlyphMap;
|
SkTHashTable<SkGlyph, SkPackedGlyphID, SkGlyph::HashTraits> fGlyphMap;
|
||||||
|
|
||||||
// so we don't grow our arrays a lot
|
// so we don't grow our arrays a lot
|
||||||
static constexpr size_t kMinGlyphCount = 16;
|
static constexpr size_t kMinGlyphCount = 8;
|
||||||
static constexpr size_t kMinGlyphImageSize = (16*2);
|
static constexpr size_t kMinGlyphImageSize = 16 /* height */ * 8 /* width */;
|
||||||
static constexpr size_t kMinAllocAmount
|
static constexpr size_t kMinAllocAmount = kMinGlyphImageSize * kMinGlyphCount;
|
||||||
= ((sizeof(SkGlyph) + kMinGlyphImageSize) * kMinGlyphCount);
|
|
||||||
|
|
||||||
char storage[kMinAllocAmount];
|
SkArenaAlloc fAlloc {kMinAllocAmount};
|
||||||
SkArenaAlloc fAlloc {storage};
|
|
||||||
|
|
||||||
std::unique_ptr<CharGlyphRec[]> fPackedUnicharIDToPackedGlyphID;
|
std::unique_ptr<CharGlyphRec[]> fPackedUnicharIDToPackedGlyphID;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user