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

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

Issue 1011403005: Revert of Ensure that we use different glyph entries for regular and df text. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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/GrDistanceFieldTextContext.cpp ('k') | src/gpu/GrFontCache.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 /* 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
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // for easy removal from list 65 // for easy removal from list
66 GrTextStrike* fPrev; 66 GrTextStrike* fPrev;
67 GrTextStrike* fNext; 67 GrTextStrike* fNext;
68 68
69 private: 69 private:
70 SkTDynamicHash<GrGlyph, GrGlyph::PackedID> fCache; 70 SkTDynamicHash<GrGlyph, GrGlyph::PackedID> fCache;
71 const GrFontDescKey* fFontScalerKey; 71 const GrFontDescKey* fFontScalerKey;
72 SkVarAlloc fPool; 72 SkVarAlloc fPool;
73 73
74 GrFontCache* fFontCache; 74 GrFontCache* fFontCache;
75 bool fUseDistanceField;
75 76
76 GrAtlas::ClientPlotUsage fPlotUsage; 77 GrAtlas::ClientPlotUsage fPlotUsage;
77 78
78 GrGlyph* generateGlyph(GrGlyph::PackedID packed, GrFontScaler* scaler); 79 GrGlyph* generateGlyph(GrGlyph::PackedID packed, GrFontScaler* scaler);
79 80
80 friend class GrFontCache; 81 friend class GrFontCache;
81 }; 82 };
82 83
83 class GrFontCache { 84 class GrFontCache {
84 public: 85 public:
85 GrFontCache(GrGpu*); 86 GrFontCache(GrGpu*);
86 ~GrFontCache(); 87 ~GrFontCache();
87 88
88 inline GrTextStrike* getStrike(GrFontScaler* scaler) { 89 inline GrTextStrike* getStrike(GrFontScaler* scaler, bool useDistanceField) {
89 this->validate(); 90 this->validate();
90 91
91 GrTextStrike* strike = fCache.find(*(scaler->getKey())); 92 GrTextStrike* strike = fCache.find(*(scaler->getKey()));
92 if (NULL == strike) { 93 if (NULL == strike) {
93 strike = this->generateStrike(scaler); 94 strike = this->generateStrike(scaler);
94 } else if (strike->fPrev) { 95 } else if (strike->fPrev) {
95 // Need to put the strike at the head of its dllist, since that is h ow 96 // Need to put the strike at the head of its dllist, since that is h ow
96 // we age the strikes for purging (we purge from the back of the lis t) 97 // we age the strikes for purging (we purge from the back of the lis t)
97 this->detachStrikeFromList(strike); 98 this->detachStrikeFromList(strike);
98 // attach at the head 99 // attach at the head
99 fHead->fPrev = strike; 100 fHead->fPrev = strike;
100 strike->fNext = fHead; 101 strike->fNext = fHead;
101 strike->fPrev = NULL; 102 strike->fPrev = NULL;
102 fHead = strike; 103 fHead = strike;
103 } 104 }
105 strike->fUseDistanceField = useDistanceField;
104 this->validate(); 106 this->validate();
105 return strike; 107 return strike;
106 } 108 }
107 109
108 // add to texture atlas that matches this format 110 // add to texture atlas that matches this format
109 GrPlot* addToAtlas(GrMaskFormat format, GrAtlas::ClientPlotUsage* usage, 111 GrPlot* addToAtlas(GrMaskFormat format, GrAtlas::ClientPlotUsage* usage,
110 int width, int height, const void* image, 112 int width, int height, const void* image,
111 SkIPoint16* loc); 113 SkIPoint16* loc);
112 114
113 void freeAll(); 115 void freeAll();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } else { 174 } else {
173 SkASSERT(fTail == strike); 175 SkASSERT(fTail == strike);
174 fTail = strike->fPrev; 176 fTail = strike->fPrev;
175 } 177 }
176 } 178 }
177 179
178 void purgeStrike(GrTextStrike* strike); 180 void purgeStrike(GrTextStrike* strike);
179 }; 181 };
180 182
181 #endif 183 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDistanceFieldTextContext.cpp ('k') | src/gpu/GrFontCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698