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

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

Issue 742253002: remove GrAllocPool (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: feedback inc Created 6 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
« no previous file with comments | « src/gpu/GrTextStrike.h ('k') | no next file » | 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 2010 Google Inc. 2 * Copyright 2010 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 "GrGpu.h" 8 #include "GrGpu.h"
9 #include "GrRectanizer.h" 9 #include "GrRectanizer.h"
10 #include "GrSurfacePriv.h" 10 #include "GrSurfacePriv.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 #endif 220 #endif
221 221
222 /* 222 /*
223 The text strike is specific to a given font/style/matrix setup, which is 223 The text strike is specific to a given font/style/matrix setup, which is
224 represented by the GrHostFontScaler object we are given in getGlyph(). 224 represented by the GrHostFontScaler object we are given in getGlyph().
225 225
226 We map a 32bit glyphID to a GrGlyph record, which in turn points to a 226 We map a 32bit glyphID to a GrGlyph record, which in turn points to a
227 atlas and a position within that texture. 227 atlas and a position within that texture.
228 */ 228 */
229 229
230 GrTextStrike::GrTextStrike(GrFontCache* cache, const GrFontDescKey* key) : fPool (64) { 230 GrTextStrike::GrTextStrike(GrFontCache* cache, const GrFontDescKey* key) {
231 fFontScalerKey = key; 231 fFontScalerKey = key;
232 fFontScalerKey->ref(); 232 fFontScalerKey->ref();
233 233
234 fFontCache = cache; // no need to ref, it won't go away before we do 234 fFontCache = cache; // no need to ref, it won't go away before we do
235 235
236 #ifdef SK_DEBUG 236 #ifdef SK_DEBUG
237 // SkDebugf(" GrTextStrike %p %d\n", this, gCounter); 237 // SkDebugf(" GrTextStrike %p %d\n", this, gCounter);
238 gCounter += 1; 238 gCounter += 1;
239 #endif 239 #endif
240 } 240 }
(...skipping 19 matching lines...) Expand all
260 if (!scaler->getPackedGlyphDFBounds(packed, &bounds)) { 260 if (!scaler->getPackedGlyphDFBounds(packed, &bounds)) {
261 return NULL; 261 return NULL;
262 } 262 }
263 } else { 263 } else {
264 if (!scaler->getPackedGlyphBounds(packed, &bounds)) { 264 if (!scaler->getPackedGlyphBounds(packed, &bounds)) {
265 return NULL; 265 return NULL;
266 } 266 }
267 } 267 }
268 GrMaskFormat format = scaler->getPackedGlyphMaskFormat(packed); 268 GrMaskFormat format = scaler->getPackedGlyphMaskFormat(packed);
269 269
270 GrGlyph* glyph = fPool.alloc(); 270 GrGlyph* glyph = (GrGlyph*)fPool.alloc(sizeof(GrGlyph), SK_MALLOC_THROW);
271 glyph->init(packed, bounds, format); 271 glyph->init(packed, bounds, format);
272 fCache.add(glyph); 272 fCache.add(glyph);
273 return glyph; 273 return glyph;
274 } 274 }
275 275
276 void GrTextStrike::removePlot(const GrPlot* plot) { 276 void GrTextStrike::removePlot(const GrPlot* plot) {
277 SkTDynamicHash<GrGlyph, GrGlyph::PackedID>::Iter iter(&fCache); 277 SkTDynamicHash<GrGlyph, GrGlyph::PackedID>::Iter iter(&fCache);
278 while (!iter.done()) { 278 while (!iter.done()) {
279 if (plot == (*iter).fPlot) { 279 if (plot == (*iter).fPlot) {
280 (*iter).fPlot = NULL; 280 (*iter).fPlot = NULL;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 glyph->width(), glyph->height(), 336 glyph->width(), glyph->height(),
337 storage.get(), &glyph->fAtlasLocation) ; 337 storage.get(), &glyph->fAtlasLocation) ;
338 338
339 if (NULL == plot) { 339 if (NULL == plot) {
340 return false; 340 return false;
341 } 341 }
342 342
343 glyph->fPlot = plot; 343 glyph->fPlot = plot;
344 return true; 344 return true;
345 } 345 }
OLDNEW
« no previous file with comments | « src/gpu/GrTextStrike.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698