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

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

Issue 1615473002: Revert of Fix GrAtlasTextBlob bounds management (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanuptext17
Patch Set: Created 4 years, 11 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/text/GrAtlasTextBlob.cpp ('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 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 #include "GrAtlasTextContext.h" 7 #include "GrAtlasTextContext.h"
8 8
9 #include "GrDrawContext.h" 9 #include "GrDrawContext.h"
10 #include "GrDrawTarget.h" 10 #include "GrDrawTarget.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 } 274 }
275 275
276 inline GrAtlasTextBlob* 276 inline GrAtlasTextBlob*
277 GrAtlasTextContext::createDrawTextBlob(const GrPaint& paint, const SkPaint& skPa int, 277 GrAtlasTextContext::createDrawTextBlob(const GrPaint& paint, const SkPaint& skPa int,
278 const SkMatrix& viewMatrix, 278 const SkMatrix& viewMatrix,
279 const char text[], size_t byteLength, 279 const char text[], size_t byteLength,
280 SkScalar x, SkScalar y) { 280 SkScalar x, SkScalar y) {
281 int glyphCount = skPaint.countText(text, byteLength); 281 int glyphCount = skPaint.countText(text, byteLength);
282 282
283 GrAtlasTextBlob* blob = fCache->createBlob(glyphCount, 1, GrAtlasTextBlob::k GrayTextVASize); 283 GrAtlasTextBlob* blob = fCache->createBlob(glyphCount, 1, GrAtlasTextBlob::k GrayTextVASize);
284 blob->initThrowawayBlob(viewMatrix, x, y); 284 blob->initThrowawayBlob(viewMatrix);
285 285
286 if (GrTextUtils::CanDrawAsDistanceFields(skPaint, viewMatrix, fSurfaceProps, 286 if (GrTextUtils::CanDrawAsDistanceFields(skPaint, viewMatrix, fSurfaceProps,
287 *fContext->caps()->shaderCaps())) { 287 *fContext->caps()->shaderCaps())) {
288 GrTextUtils::DrawDFText(blob, 0, fContext->getBatchFontCache(), fSurface Props, 288 GrTextUtils::DrawDFText(blob, 0, fContext->getBatchFontCache(), fSurface Props,
289 skPaint, paint.getColor(), viewMatrix, text, 289 skPaint, paint.getColor(), viewMatrix, text,
290 byteLength, x, y); 290 byteLength, x, y);
291 } else { 291 } else {
292 GrTextUtils::DrawBmpText(blob, 0, fContext->getBatchFontCache(), fSurfac eProps, skPaint, 292 GrTextUtils::DrawBmpText(blob, 0, fContext->getBatchFontCache(), fSurfac eProps, skPaint,
293 paint.getColor(), viewMatrix, text, byteLength, x, y); 293 paint.getColor(), viewMatrix, text, byteLength, x, y);
294 } 294 }
295 return blob; 295 return blob;
296 } 296 }
297 297
298 inline GrAtlasTextBlob* 298 inline GrAtlasTextBlob*
299 GrAtlasTextContext::createDrawPosTextBlob(const GrPaint& paint, const SkPaint& s kPaint, 299 GrAtlasTextContext::createDrawPosTextBlob(const GrPaint& paint, const SkPaint& s kPaint,
300 const SkMatrix& viewMatrix, 300 const SkMatrix& viewMatrix,
301 const char text[], size_t byteLength, 301 const char text[], size_t byteLength,
302 const SkScalar pos[], int scalarsPerPo sition, 302 const SkScalar pos[], int scalarsPerPo sition,
303 const SkPoint& offset) { 303 const SkPoint& offset) {
304 int glyphCount = skPaint.countText(text, byteLength); 304 int glyphCount = skPaint.countText(text, byteLength);
305 305
306 GrAtlasTextBlob* blob = fCache->createBlob(glyphCount, 1, GrAtlasTextBlob::k GrayTextVASize); 306 GrAtlasTextBlob* blob = fCache->createBlob(glyphCount, 1, GrAtlasTextBlob::k GrayTextVASize);
307 blob->initThrowawayBlob(viewMatrix, offset.x(), offset.y()); 307 blob->initThrowawayBlob(viewMatrix);
308 308
309 if (GrTextUtils::CanDrawAsDistanceFields(skPaint, viewMatrix, fSurfaceProps, 309 if (GrTextUtils::CanDrawAsDistanceFields(skPaint, viewMatrix, fSurfaceProps,
310 *fContext->caps()->shaderCaps())) { 310 *fContext->caps()->shaderCaps())) {
311 GrTextUtils::DrawDFPosText(blob, 0, fContext->getBatchFontCache(), fSurf aceProps, 311 GrTextUtils::DrawDFPosText(blob, 0, fContext->getBatchFontCache(), fSurf aceProps,
312 skPaint, paint.getColor(), viewMatrix, text, 312 skPaint, paint.getColor(), viewMatrix, text,
313 byteLength, pos, scalarsPerPosition, offset); 313 byteLength, pos, scalarsPerPosition, offset);
314 } else { 314 } else {
315 GrTextUtils::DrawBmpPosText(blob, 0, fContext->getBatchFontCache(), fSur faceProps, skPaint, 315 GrTextUtils::DrawBmpPosText(blob, 0, fContext->getBatchFontCache(), fSur faceProps, skPaint,
316 paint.getColor(), viewMatrix, text, 316 paint.getColor(), viewMatrix, text,
317 byteLength, pos, scalarsPerPosition, offset) ; 317 byteLength, pos, scalarsPerPosition, offset) ;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 static_cast<size_t>(textLen), 0, 0) ); 394 static_cast<size_t>(textLen), 0, 0) );
395 395
396 SkScalar transX = static_cast<SkScalar>(random->nextU()); 396 SkScalar transX = static_cast<SkScalar>(random->nextU());
397 SkScalar transY = static_cast<SkScalar>(random->nextU()); 397 SkScalar transY = static_cast<SkScalar>(random->nextU());
398 return blob->test_createBatch(textLen, 0, 0, color, transX, transY, skPaint, 398 return blob->test_createBatch(textLen, 0, 0, color, transX, transY, skPaint,
399 gSurfaceProps, gTextContext->dfAdjustTable(), 399 gSurfaceProps, gTextContext->dfAdjustTable(),
400 context->getBatchFontCache()); 400 context->getBatchFontCache());
401 } 401 }
402 402
403 #endif 403 #endif
OLDNEW
« no previous file with comments | « src/gpu/text/GrAtlasTextBlob.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698