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

Side by Side Diff: src/gpu/GrPath.cpp

Issue 940463006: Rename GrContentKey to GrUniqueKey (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrPath.h ('k') | src/gpu/GrResourceCache.h » ('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 template<int NumBits> static uint64_t get_top_n_float_bits(float f) { 10 template<int NumBits> static uint64_t get_top_n_float_bits(float f) {
11 char* floatData = reinterpret_cast<char*>(&f); 11 char* floatData = reinterpret_cast<char*>(&f);
12 uint32_t floatBits = *reinterpret_cast<uint32_t*>(floatData); 12 uint32_t floatBits = *reinterpret_cast<uint32_t*>(floatData);
13 return floatBits >> (32 - NumBits); 13 return floatBits >> (32 - NumBits);
14 } 14 }
15 15
16 void GrPath::ComputeKey(const SkPath& path, const SkStrokeRec& stroke, GrContent Key* key) { 16 void GrPath::ComputeKey(const SkPath& path, const SkStrokeRec& stroke, GrUniqueK ey* key) {
17 static const GrContentKey::Domain kDomain = GrContentKey::GenerateDomain(); 17 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
18 GrContentKey::Builder builder(key, kDomain, 3); 18 GrUniqueKey::Builder builder(key, kDomain, 3);
19 *reinterpret_cast<uint64_t*>(&builder[0]) = ComputeStrokeKey(stroke); 19 *reinterpret_cast<uint64_t*>(&builder[0]) = ComputeStrokeKey(stroke);
20 builder[2] = path.getGenerationID(); 20 builder[2] = path.getGenerationID();
21 } 21 }
22 22
23 uint64_t GrPath::ComputeStrokeKey(const SkStrokeRec& stroke) { 23 uint64_t GrPath::ComputeStrokeKey(const SkStrokeRec& stroke) {
24 enum { 24 enum {
25 kStyleBits = 2, 25 kStyleBits = 2,
26 kJoinBits = 2, 26 kJoinBits = 2,
27 kCapBits = 2, 27 kCapBits = 2,
28 kWidthBits = 29, 28 kWidthBits = 29,
(...skipping 17 matching lines...) Expand all
46 } 46 }
47 47
48 uint64_t key = stroke.getStyle(); 48 uint64_t key = stroke.getStyle();
49 key |= stroke.getJoin() << kJoinShift; 49 key |= stroke.getJoin() << kJoinShift;
50 key |= stroke.getCap() << kCapShift; 50 key |= stroke.getCap() << kCapShift;
51 key |= get_top_n_float_bits<kWidthBits>(stroke.getWidth()) << kWidthShift; 51 key |= get_top_n_float_bits<kWidthBits>(stroke.getWidth()) << kWidthShift;
52 key |= get_top_n_float_bits<kMiterBits>(stroke.getMiter()) << kMiterShift; 52 key |= get_top_n_float_bits<kMiterBits>(stroke.getMiter()) << kMiterShift;
53 53
54 return key; 54 return key;
55 } 55 }
OLDNEW
« no previous file with comments | « src/gpu/GrPath.h ('k') | src/gpu/GrResourceCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698