Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: src/gpu/GrStencilAndCoverTextContext.cpp

Issue 858123002: Add specialized content key class for resources. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove default template arg Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrStencilAndCoverPathRenderer.cpp ('k') | src/gpu/GrTexture.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « src/gpu/GrStencilAndCoverPathRenderer.cpp ('k') | src/gpu/GrTexture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698