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

Side by Side Diff: src/gpu/GrTextStrike_impl.h

Issue 88113002: Speed up GrResourceCache lookup by inlining GrBinHashKey comparisons (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address review comments (capitalized statics) Created 7 years 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/GrTHashTable.h ('k') | src/gpu/effects/GrTextureStripAtlas.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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 10
11 #ifndef GrTextStrike_impl_DEFINED 11 #ifndef GrTextStrike_impl_DEFINED
12 #define GrTextStrike_impl_DEFINED 12 #define GrTextStrike_impl_DEFINED
13 13
14 class GrFontCache::Key { 14 class GrFontCache::Key {
15 public: 15 public:
16 explicit Key(const GrKey* fontScalarKey) { 16 explicit Key(const GrKey* fontScalarKey) {
17 fFontScalerKey = fontScalarKey; 17 fFontScalerKey = fontScalarKey;
18 } 18 }
19 19
20 intptr_t getHash() const { return fFontScalerKey->getHash(); } 20 intptr_t getHash() const { return fFontScalerKey->getHash(); }
21 21
22 static bool LT(const GrTextStrike& strike, const Key& key) { 22 static bool LessThan(const GrTextStrike& strike, const Key& key) {
23 return *strike.getFontScalerKey() < *key.fFontScalerKey; 23 return *strike.getFontScalerKey() < *key.fFontScalerKey;
24 } 24 }
25 static bool EQ(const GrTextStrike& strike, const Key& key) { 25 static bool Equals(const GrTextStrike& strike, const Key& key) {
26 return *strike.getFontScalerKey() == *key.fFontScalerKey; 26 return *strike.getFontScalerKey() == *key.fFontScalerKey;
27 } 27 }
28 28
29 private: 29 private:
30 const GrKey* fFontScalerKey; 30 const GrKey* fFontScalerKey;
31 }; 31 };
32 32
33 void GrFontCache::detachStrikeFromList(GrTextStrike* strike) { 33 void GrFontCache::detachStrikeFromList(GrTextStrike* strike) {
34 if (strike->fPrev) { 34 if (strike->fPrev) {
35 SkASSERT(fHead != strike); 35 SkASSERT(fHead != strike);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 /** 81 /**
82 * This Key just wraps a glyphID, and matches the protocol need for 82 * This Key just wraps a glyphID, and matches the protocol need for
83 * GrTHashTable 83 * GrTHashTable
84 */ 84 */
85 class GrTextStrike::Key { 85 class GrTextStrike::Key {
86 public: 86 public:
87 Key(GrGlyph::PackedID id) : fPackedID(id) {} 87 Key(GrGlyph::PackedID id) : fPackedID(id) {}
88 88
89 uint32_t getHash() const { return fPackedID; } 89 uint32_t getHash() const { return fPackedID; }
90 90
91 static bool LT(const GrGlyph& glyph, const Key& key) { 91 static bool LessThan(const GrGlyph& glyph, const Key& key) {
92 return glyph.fPackedID < key.fPackedID; 92 return glyph.fPackedID < key.fPackedID;
93 } 93 }
94 static bool EQ(const GrGlyph& glyph, const Key& key) { 94 static bool Equals(const GrGlyph& glyph, const Key& key) {
95 return glyph.fPackedID == key.fPackedID; 95 return glyph.fPackedID == key.fPackedID;
96 } 96 }
97 97
98 private: 98 private:
99 GrGlyph::PackedID fPackedID; 99 GrGlyph::PackedID fPackedID;
100 }; 100 };
101 101
102 GrGlyph* GrTextStrike::getGlyph(GrGlyph::PackedID packed, 102 GrGlyph* GrTextStrike::getGlyph(GrGlyph::PackedID packed,
103 GrFontScaler* scaler) { 103 GrFontScaler* scaler) {
104 GrGlyph* glyph = fCache.find(packed); 104 GrGlyph* glyph = fCache.find(packed);
105 if (NULL == glyph) { 105 if (NULL == glyph) {
106 glyph = this->generateGlyph(packed, scaler); 106 glyph = this->generateGlyph(packed, scaler);
107 } 107 }
108 return glyph; 108 return glyph;
109 } 109 }
110 110
111 #endif 111 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrTHashTable.h ('k') | src/gpu/effects/GrTextureStripAtlas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698