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

Side by Side Diff: src/core/SkGlyphCache.h

Issue 18132009: move failable work outside of constructors for SkGlyphCache and SkScalerContextGDI. If we fail, try… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/core/SkGlyphCache.cpp » ('j') | src/ports/SkFontHost_win.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
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 #ifndef SkGlyphCache_DEFINED 10 #ifndef SkGlyphCache_DEFINED
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 178 }
179 } 179 }
180 void forget() { 180 void forget() {
181 fCache = NULL; 181 fCache = NULL;
182 } 182 }
183 private: 183 private:
184 const SkGlyphCache* fCache; 184 const SkGlyphCache* fCache;
185 }; 185 };
186 186
187 private: 187 private:
188 SkGlyphCache(SkTypeface*, const SkDescriptor*); 188 // we take ownership of the scalercontext
189 SkGlyphCache(SkTypeface*, const SkDescriptor*, SkScalerContext*);
189 ~SkGlyphCache(); 190 ~SkGlyphCache();
190 191
191 enum MetricsType { 192 enum MetricsType {
192 kJustAdvance_MetricsType, 193 kJustAdvance_MetricsType,
193 kFull_MetricsType 194 kFull_MetricsType
194 }; 195 };
195 196
196 SkGlyph* lookupMetrics(uint32_t id, MetricsType); 197 SkGlyph* lookupMetrics(uint32_t id, MetricsType);
197 static bool DetachProc(const SkGlyphCache*, void*) { return true; } 198 static bool DetachProc(const SkGlyphCache*, void*) { return true; }
198 199
(...skipping 17 matching lines...) Expand all
216 } 217 }
217 *head = this; 218 *head = this;
218 } 219 }
219 220
220 SkGlyphCache* fNext, *fPrev; 221 SkGlyphCache* fNext, *fPrev;
221 SkDescriptor* fDesc; 222 SkDescriptor* fDesc;
222 SkScalerContext* fScalerContext; 223 SkScalerContext* fScalerContext;
223 SkPaint::FontMetrics fFontMetrics; 224 SkPaint::FontMetrics fFontMetrics;
224 225
225 enum { 226 enum {
226 kHashBits = 12, 227 kHashBits = 8,
227 kHashCount = 1 << kHashBits, 228 kHashCount = 1 << kHashBits,
228 kHashMask = kHashCount - 1 229 kHashMask = kHashCount - 1
229 }; 230 };
230 SkGlyph* fGlyphHash[kHashCount]; 231 SkGlyph* fGlyphHash[kHashCount];
231 SkTDArray<SkGlyph*> fGlyphArray; 232 SkTDArray<SkGlyph*> fGlyphArray;
232 SkChunkAlloc fGlyphAlloc; 233 SkChunkAlloc fGlyphAlloc;
233 234
234 int fMetricsCount, fAdvanceCount; 235 int fMetricsCount, fAdvanceCount;
235 236
236 struct CharGlyphRec { 237 struct CharGlyphRec {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } 292 }
292 } 293 }
293 294
294 private: 295 private:
295 SkGlyphCache* fCache; 296 SkGlyphCache* fCache;
296 297
297 static bool DetachProc(const SkGlyphCache*, void*); 298 static bool DetachProc(const SkGlyphCache*, void*);
298 }; 299 };
299 300
300 #endif 301 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkGlyphCache.cpp » ('j') | src/ports/SkFontHost_win.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698