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

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

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 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/GrTextBlobCache.cpp ('k') | src/gpu/SkGpuDevice.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 * 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 "GrTextContext.h" 8 #include "GrTextContext.h"
9 #include "GrBlurUtils.h" 9 #include "GrBlurUtils.h"
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 10 matching lines...) Expand all
21 #include "SkTextToPathIter.h" 21 #include "SkTextToPathIter.h"
22 22
23 GrTextContext::GrTextContext(GrContext* context, GrDrawContext* drawContext, 23 GrTextContext::GrTextContext(GrContext* context, GrDrawContext* drawContext,
24 const SkSurfaceProps& surfaceProps) 24 const SkSurfaceProps& surfaceProps)
25 : fFallbackTextContext(NULL) 25 : fFallbackTextContext(NULL)
26 , fContext(context) 26 , fContext(context)
27 , fSurfaceProps(surfaceProps) 27 , fSurfaceProps(surfaceProps)
28 , fDrawContext(drawContext) { 28 , fDrawContext(drawContext) {
29 } 29 }
30 30
31 GrTextContext::~GrTextContext() { 31 GrTextContext::~GrTextContext() { delete fFallbackTextContext; }
32 SkDELETE(fFallbackTextContext);
33 }
34 32
35 void GrTextContext::drawText(GrRenderTarget* rt, const GrClip& clip, const GrPai nt& paint, 33 void GrTextContext::drawText(GrRenderTarget* rt, const GrClip& clip, const GrPai nt& paint,
36 const SkPaint& skPaint, const SkMatrix& viewMatrix, 34 const SkPaint& skPaint, const SkMatrix& viewMatrix,
37 const char text[], size_t byteLength, 35 const char text[], size_t byteLength,
38 SkScalar x, SkScalar y, const SkIRect& clipBounds) { 36 SkScalar x, SkScalar y, const SkIRect& clipBounds) {
39 if (fContext->abandoned() || !fDrawContext) { 37 if (fContext->abandoned() || !fDrawContext) {
40 return; 38 return;
41 } 39 }
42 40
43 GrTextContext* textContext = this; 41 GrTextContext* textContext = this;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 matrix[SkMatrix::kMTransX] = loc.fX; 227 matrix[SkMatrix::kMTransX] = loc.fX;
230 matrix[SkMatrix::kMTransY] = loc.fY; 228 matrix[SkMatrix::kMTransY] = loc.fY;
231 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext, rt, clip, *path, paint, 229 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext, rt, clip, *path, paint,
232 viewMatrix, &matrix, clipBou nds, false); 230 viewMatrix, &matrix, clipBou nds, false);
233 } 231 }
234 } 232 }
235 pos += scalarsPerPosition; 233 pos += scalarsPerPosition;
236 } 234 }
237 } 235 }
238 236
239 //*** change to output positions? 237 // *** change to output positions?
240 int GrTextContext::MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCachePr oc, 238 int GrTextContext::MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCachePr oc,
241 const char text[], size_t byteLength, SkVector* stopVector) { 239 const char text[], size_t byteLength, SkVector* stopVector) {
242 SkFixed x = 0, y = 0; 240 SkFixed x = 0, y = 0;
243 const char* stop = text + byteLength; 241 const char* stop = text + byteLength;
244 242
245 SkAutoKern autokern; 243 SkAutoKern autokern;
246 244
247 int numGlyphs = 0; 245 int numGlyphs = 0;
248 while (text < stop) { 246 while (text < stop) {
249 // don't need x, y here, since all subpixel variants will have the 247 // don't need x, y here, since all subpixel variants will have the
(...skipping 17 matching lines...) Expand all
267 } 265 }
268 266
269 GrFontScaler* GrTextContext::GetGrFontScaler(SkGlyphCache* cache) { 267 GrFontScaler* GrTextContext::GetGrFontScaler(SkGlyphCache* cache) {
270 void* auxData; 268 void* auxData;
271 GrFontScaler* scaler = NULL; 269 GrFontScaler* scaler = NULL;
272 270
273 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { 271 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) {
274 scaler = (GrFontScaler*)auxData; 272 scaler = (GrFontScaler*)auxData;
275 } 273 }
276 if (NULL == scaler) { 274 if (NULL == scaler) {
277 scaler = SkNEW_ARGS(GrFontScaler, (cache)); 275 scaler = new GrFontScaler(cache);
278 cache->setAuxProc(GlyphCacheAuxProc, scaler); 276 cache->setAuxProc(GlyphCacheAuxProc, scaler);
279 } 277 }
280 278
281 return scaler; 279 return scaler;
282 } 280 }
OLDNEW
« no previous file with comments | « src/gpu/GrTextBlobCache.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698