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

Unified Diff: src/gpu/GrPath.cpp

Issue 26557003: Add a GPU paths to resource cache of the context (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 1 month 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/GrPath.h ('k') | src/gpu/GrStencilAndCoverPathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrPath.cpp
diff --git a/src/gpu/GrPath.cpp b/src/gpu/GrPath.cpp
index afd223902fd440b0864839c3e9ecfe828d9d19fc..f928dffaa85c950a234dd23c9992937a98f12933 100644
--- a/src/gpu/GrPath.cpp
+++ b/src/gpu/GrPath.cpp
@@ -8,3 +8,26 @@
#include "GrPath.h"
SK_DEFINE_INST_COUNT(GrPath)
+
+GrResourceKey GrPath::ComputeKey(const SkPath& path, const SkStrokeRec& stroke) {
+ static const GrResourceKey::ResourceType gPathResourceType = GrResourceKey::GenerateResourceType();
+ static const GrCacheID::Domain gPathDomain = GrCacheID::GenerateDomain();
+
+ GrCacheID::Key key;
+ uint32_t* keyData = key.fData32;
+ keyData[0] = path.getGenerationID();
+
+ SK_COMPILE_ASSERT(SkPaint::kJoinCount <= 3, cap_shift_will_be_wrong);
+ keyData[1] = stroke.needToApply();
+ if (0 != keyData[1]) {
+ keyData[1] |= stroke.getJoin() << 1;
+ keyData[1] |= stroke.getCap() << 3;
+ keyData[2] = static_cast<uint32_t>(stroke.getMiter());
+ keyData[3] = static_cast<uint32_t>(stroke.getWidth());
+ } else {
+ keyData[2] = 0;
+ keyData[3] = 0;
+ }
+
+ return GrResourceKey(GrCacheID(gPathDomain, key), gPathResourceType, 0);
+}
« no previous file with comments | « src/gpu/GrPath.h ('k') | src/gpu/GrStencilAndCoverPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698