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

Unified Diff: src/gpu/GrPath.cpp

Issue 858123002: Add specialized content key class for resources. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix comment 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
Index: src/gpu/GrPath.cpp
diff --git a/src/gpu/GrPath.cpp b/src/gpu/GrPath.cpp
index eb956fbf658e77574dec939d65f198e61ce90f21..a989be09676b01201ba9866e193be46c2082ef72 100644
--- a/src/gpu/GrPath.cpp
+++ b/src/gpu/GrPath.cpp
@@ -13,15 +13,17 @@ template<int NumBits> static uint64_t get_top_n_float_bits(float f) {
return floatBits >> (32 - NumBits);
}
-GrResourceKey GrPath::ComputeKey(const SkPath& path, const SkStrokeRec& stroke) {
- static const GrCacheID::Domain gPathDomain = GrCacheID::GenerateDomain();
+void GrPath::ComputeKey(const SkPath& path, const SkStrokeRec& stroke, GrContentKey* key) {
+ static const GrContentKey::Domain kDomain = GrContentKey::GenerateDomain();
- GrCacheID::Key key;
- uint64_t* keyData = key.fData64;
- keyData[0] = path.getGenerationID();
- keyData[1] = ComputeStrokeKey(stroke);
-
- return GrResourceKey(GrCacheID(gPathDomain, key), 0);
+ GrContentKey::Builder builder(key, kDomain, 3);
robertphillips 2015/01/22 16:49:12 Add assert that this is tightly packed ?
bsalomon 2015/01/22 19:23:17 killed it
+ struct PathKey {
+ uint32_t fGenID;
+ uint64_t fStroke;
+ };
+ PathKey *pathKey = reinterpret_cast<PathKey*>(&builder[0]);
+ pathKey->fGenID = path.getGenerationID();
+ pathKey->fStroke = ComputeStrokeKey(stroke);
}
uint64_t GrPath::ComputeStrokeKey(const SkStrokeRec& stroke) {
« src/gpu/GrContext.cpp ('K') | « src/gpu/GrPath.h ('k') | src/gpu/GrResourceCache2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698