OLD | NEW |
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 "GrTextStrike.h" | 10 #include "GrTextStrike.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 #if 0 // testing hack to force us to flush our cache often | 286 #if 0 // testing hack to force us to flush our cache often |
287 static int gCounter; | 287 static int gCounter; |
288 if ((++gCounter % 10) == 0) return false; | 288 if ((++gCounter % 10) == 0) return false; |
289 #endif | 289 #endif |
290 | 290 |
291 SkASSERT(glyph); | 291 SkASSERT(glyph); |
292 SkASSERT(scaler); | 292 SkASSERT(scaler); |
293 SkASSERT(fCache.contains(glyph)); | 293 SkASSERT(fCache.contains(glyph)); |
294 SkASSERT(NULL == glyph->fPlot); | 294 SkASSERT(NULL == glyph->fPlot); |
295 | 295 |
296 SkAutoRef ar(scaler); | 296 SkAutoUnref ar(SkSafeRef(scaler)); |
297 | 297 |
298 int bytesPerPixel = GrMaskFormatBytesPerPixel(fMaskFormat); | 298 int bytesPerPixel = GrMaskFormatBytesPerPixel(fMaskFormat); |
299 | 299 |
300 size_t size = glyph->fBounds.area() * bytesPerPixel; | 300 size_t size = glyph->fBounds.area() * bytesPerPixel; |
301 SkAutoSMalloc<1024> storage(size); | 301 SkAutoSMalloc<1024> storage(size); |
302 if (fUseDistanceField) { | 302 if (fUseDistanceField) { |
303 if (!scaler->getPackedGlyphDFImage(glyph->fPackedID, glyph->width(), | 303 if (!scaler->getPackedGlyphDFImage(glyph->fPackedID, glyph->width(), |
304 glyph->height(), | 304 glyph->height(), |
305 storage.get())) { | 305 storage.get())) { |
306 return false; | 306 return false; |
(...skipping 11 matching lines...) Expand all Loading... |
318 glyph->height(), storage.get(), | 318 glyph->height(), storage.get(), |
319 &glyph->fAtlasLocation); | 319 &glyph->fAtlasLocation); |
320 | 320 |
321 if (NULL == plot) { | 321 if (NULL == plot) { |
322 return false; | 322 return false; |
323 } | 323 } |
324 | 324 |
325 glyph->fPlot = plot; | 325 glyph->fPlot = plot; |
326 return true; | 326 return true; |
327 } | 327 } |
OLD | NEW |