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

Side by Side Diff: src/gpu/text/GrBatchFontCache.cpp

Issue 1979193009: Remove unneeded reference count churn. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | 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 2015 Google Inc. 2 * Copyright 2015 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 "GrBatchFontCache.h" 8 #include "GrBatchFontCache.h"
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 203 }
204 204
205 bool GrBatchTextStrike::addGlyphToAtlas(GrDrawBatch::Target* target, 205 bool GrBatchTextStrike::addGlyphToAtlas(GrDrawBatch::Target* target,
206 GrGlyph* glyph, 206 GrGlyph* glyph,
207 GrFontScaler* scaler, 207 GrFontScaler* scaler,
208 GrMaskFormat expectedMaskFormat) { 208 GrMaskFormat expectedMaskFormat) {
209 SkASSERT(glyph); 209 SkASSERT(glyph);
210 SkASSERT(scaler); 210 SkASSERT(scaler);
211 SkASSERT(fCache.find(glyph->fPackedID)); 211 SkASSERT(fCache.find(glyph->fPackedID));
212 212
213 SkAutoUnref ar(SkSafeRef(scaler));
214
215 int bytesPerPixel = GrMaskFormatBytesPerPixel(expectedMaskFormat); 213 int bytesPerPixel = GrMaskFormatBytesPerPixel(expectedMaskFormat);
216 214
217 size_t size = glyph->fBounds.area() * bytesPerPixel; 215 size_t size = glyph->fBounds.area() * bytesPerPixel;
218 SkAutoSMalloc<1024> storage(size); 216 SkAutoSMalloc<1024> storage(size);
219 217
220 const SkGlyph& skGlyph = scaler->grToSkGlyph(glyph->fPackedID); 218 const SkGlyph& skGlyph = scaler->grToSkGlyph(glyph->fPackedID);
221 if (GrGlyph::kDistance_MaskStyle == GrGlyph::UnpackMaskStyle(glyph->fPackedI D)) { 219 if (GrGlyph::kDistance_MaskStyle == GrGlyph::UnpackMaskStyle(glyph->fPackedI D)) {
222 if (!scaler->getPackedGlyphDFImage(skGlyph, glyph->width(), glyph->heigh t(), 220 if (!scaler->getPackedGlyphDFImage(skGlyph, glyph->width(), glyph->heigh t(),
223 storage.get())) { 221 storage.get())) {
224 return false; 222 return false;
225 } 223 }
226 } else { 224 } else {
227 if (!scaler->getPackedGlyphImage(skGlyph, glyph->width(), glyph->height( ), 225 if (!scaler->getPackedGlyphImage(skGlyph, glyph->width(), glyph->height( ),
228 glyph->width() * bytesPerPixel, expecte dMaskFormat, 226 glyph->width() * bytesPerPixel, expecte dMaskFormat,
229 storage.get())) { 227 storage.get())) {
230 return false; 228 return false;
231 } 229 }
232 } 230 }
233 231
234 bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, target, expect edMaskFormat, 232 bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, target, expect edMaskFormat,
235 glyph->width(), glyph->height(), 233 glyph->width(), glyph->height(),
236 storage.get(), &glyph->fAtlasLoca tion); 234 storage.get(), &glyph->fAtlasLoca tion);
237 if (success) { 235 if (success) {
238 SkASSERT(GrBatchAtlas::kInvalidAtlasID != glyph->fID); 236 SkASSERT(GrBatchAtlas::kInvalidAtlasID != glyph->fID);
239 fAtlasedGlyphs++; 237 fAtlasedGlyphs++;
240 } 238 }
241 return success; 239 return success;
242 } 240 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698