Index: src/gpu/GrStencilAndCoverTextContext.cpp |
diff --git a/src/gpu/GrStencilAndCoverTextContext.cpp b/src/gpu/GrStencilAndCoverTextContext.cpp |
index c29dca6d0af540e5151865abfa3ca7e29adec2b4..2f2f1f8ebd1182fe0aa2616e2403a185f6f115b0 100644 |
--- a/src/gpu/GrStencilAndCoverTextContext.cpp |
+++ b/src/gpu/GrStencilAndCoverTextContext.cpp |
@@ -205,20 +205,25 @@ static GrPathRange* get_gr_glyphs(GrContext* ctx, |
const SkTypeface* typeface, |
const SkDescriptor* desc, |
const SkStrokeRec& stroke) { |
- static const GrCacheID::Domain gGlyphsDomain = GrCacheID::GenerateDomain(); |
- |
- GrCacheID::Key key; |
- uint64_t* keyData = key.fData64; |
- keyData[0] = desc ? desc->getChecksum() : 0; |
- keyData[0] = (keyData[0] << 32) | (typeface ? typeface->uniqueID() : 0); |
- keyData[1] = GrPath::ComputeStrokeKey(stroke); |
- GrResourceKey resourceKey = GrResourceKey(GrCacheID(gGlyphsDomain, key), 0); |
+ static const GrContentKey::Domain kDomain = GrContentKey::GenerateDomain(); |
+ GrContentKey key; |
+ GrContentKey::Builder builder(&key, kDomain, 4); |
+ struct GlyphKey { |
+ uint32_t fChecksum; |
+ uint32_t fTypeface; |
+ uint64_t fStroke; |
+ }; |
+ GlyphKey* glyphKey = reinterpret_cast<GlyphKey*>(&builder[0]); |
+ glyphKey->fChecksum = desc ? desc->getChecksum() : 0; |
+ glyphKey->fTypeface = typeface ? typeface->uniqueID() : 0; |
+ glyphKey->fStroke = GrPath::ComputeStrokeKey(stroke); |
+ builder.finish(); |
SkAutoTUnref<GrPathRange> glyphs( |
- static_cast<GrPathRange*>(ctx->findAndRefCachedResource(resourceKey))); |
+ static_cast<GrPathRange*>(ctx->findAndRefCachedResource(key))); |
if (NULL == glyphs || (NULL != desc && !glyphs->isEqualTo(*desc))) { |
glyphs.reset(ctx->getGpu()->pathRendering()->createGlyphs(typeface, desc, stroke)); |
- ctx->addResourceToCache(resourceKey, glyphs); |
+ ctx->addResourceToCache(key, glyphs); |
} |
return glyphs.detach(); |