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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrPath.h ('k') | src/gpu/GrStencilAndCoverPathRenderer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrPath.h" 8 #include "GrPath.h"
9 9
10 SK_DEFINE_INST_COUNT(GrPath) 10 SK_DEFINE_INST_COUNT(GrPath)
11
12 GrResourceKey GrPath::ComputeKey(const SkPath& path, const SkStrokeRec& stroke) {
13 static const GrResourceKey::ResourceType gPathResourceType = GrResourceKey:: GenerateResourceType();
14 static const GrCacheID::Domain gPathDomain = GrCacheID::GenerateDomain();
15
16 GrCacheID::Key key;
17 uint32_t* keyData = key.fData32;
18 keyData[0] = path.getGenerationID();
19
20 SK_COMPILE_ASSERT(SkPaint::kJoinCount <= 3, cap_shift_will_be_wrong);
21 keyData[1] = stroke.needToApply();
22 if (0 != keyData[1]) {
23 keyData[1] |= stroke.getJoin() << 1;
24 keyData[1] |= stroke.getCap() << 3;
25 keyData[2] = static_cast<uint32_t>(stroke.getMiter());
26 keyData[3] = static_cast<uint32_t>(stroke.getWidth());
27 } else {
28 keyData[2] = 0;
29 keyData[3] = 0;
30 }
31
32 return GrResourceKey(GrCacheID(gPathDomain, key), gPathResourceType, 0);
33 }
OLDNEW
« 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