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

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

Issue 2155983003: Push GrPipelineBuilder down to the drawBatch calls in the TextContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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.h ('k') | src/gpu/text/GrStencilAndCoverTextContext.h » ('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 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 "GrAtlasTextBlob.h" 8 #include "GrAtlasTextBlob.h"
9 9
10 #include "GrBlurUtils.h" 10 #include "GrBlurUtils.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 geometry.fSubRun = subRun; 295 geometry.fSubRun = subRun;
296 geometry.fColor = subRunColor; 296 geometry.fColor = subRunColor;
297 geometry.fX = x; 297 geometry.fX = x;
298 geometry.fY = y; 298 geometry.fY = y;
299 batch->init(); 299 batch->init();
300 300
301 return batch; 301 return batch;
302 } 302 }
303 303
304 inline 304 inline
305 void GrAtlasTextBlob::flushRun(GrDrawContext* dc, GrPipelineBuilder* pipelineBui lder, 305 void GrAtlasTextBlob::flushRun(GrDrawContext* dc, const GrPaint& grPaint,
306 const GrClip& clip, int run, const SkMatrix& view Matrix, SkScalar x, 306 const GrClip& clip, int run, const SkMatrix& view Matrix, SkScalar x,
307 SkScalar y, GrColor color, 307 SkScalar y,
308 const SkPaint& skPaint, const SkSurfaceProps& pro ps, 308 const SkPaint& skPaint, const SkSurfaceProps& pro ps,
309 const GrDistanceFieldAdjustTable* distanceAdjustT able, 309 const GrDistanceFieldAdjustTable* distanceAdjustT able,
310 GrBatchFontCache* cache) { 310 GrBatchFontCache* cache) {
311 for (int subRun = 0; subRun < fRuns[run].fSubRunInfo.count(); subRun++) { 311 for (int subRun = 0; subRun < fRuns[run].fSubRunInfo.count(); subRun++) {
312 const Run::SubRunInfo& info = fRuns[run].fSubRunInfo[subRun]; 312 const Run::SubRunInfo& info = fRuns[run].fSubRunInfo[subRun];
313 int glyphCount = info.glyphCount(); 313 int glyphCount = info.glyphCount();
314 if (0 == glyphCount) { 314 if (0 == glyphCount) {
315 continue; 315 continue;
316 } 316 }
317 317
318 GrColor color = grPaint.getColor();
319
318 SkAutoTUnref<GrDrawBatch> batch(this->createBatch(info, glyphCount, run, 320 SkAutoTUnref<GrDrawBatch> batch(this->createBatch(info, glyphCount, run,
319 subRun, viewMatrix, x, y, color, 321 subRun, viewMatrix, x, y, color,
320 skPaint, props, 322 skPaint, props,
321 distanceAdjustTable, d c->isGammaCorrect(), 323 distanceAdjustTable, d c->isGammaCorrect(),
322 cache)); 324 cache));
323 dc->drawBatch(*pipelineBuilder, clip, batch); 325
326 GrPipelineBuilder pipelineBuilder(grPaint, dc->mustUseHWAA(grPaint));
327
328 dc->drawBatch(pipelineBuilder, clip, batch);
324 } 329 }
325 } 330 }
326 331
327 static void calculate_translation(bool applyVM, 332 static void calculate_translation(bool applyVM,
328 const SkMatrix& newViewMatrix, SkScalar newX, SkScalar newY, 333 const SkMatrix& newViewMatrix, SkScalar newX, SkScalar newY,
329 const SkMatrix& currentViewMatrix, SkScalar cu rrentX, 334 const SkMatrix& currentViewMatrix, SkScalar cu rrentX,
330 SkScalar currentY, SkScalar* transX, SkScalar* transY) { 335 SkScalar currentY, SkScalar* transX, SkScalar* transY) {
331 if (applyVM) { 336 if (applyVM) {
332 *transX = newViewMatrix.getTranslateX() + 337 *transX = newViewMatrix.getTranslateX() +
333 newViewMatrix.getScaleX() * (newX - currentX) + 338 newViewMatrix.getScaleX() * (newX - currentX) +
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 const GrDistanceFieldAdjustTable* distanceAdju stTable, 417 const GrDistanceFieldAdjustTable* distanceAdju stTable,
413 const SkPaint& skPaint, 418 const SkPaint& skPaint,
414 const GrPaint& grPaint, 419 const GrPaint& grPaint,
415 SkDrawFilter* drawFilter, 420 SkDrawFilter* drawFilter,
416 const GrClip& clip, 421 const GrClip& clip,
417 const SkMatrix& viewMatrix, 422 const SkMatrix& viewMatrix,
418 const SkIRect& clipBounds, 423 const SkIRect& clipBounds,
419 SkScalar x, SkScalar y) { 424 SkScalar x, SkScalar y) {
420 // We loop through the runs of the blob, flushing each. If any run is too l arge, then we flush 425 // We loop through the runs of the blob, flushing each. If any run is too l arge, then we flush
421 // it as paths 426 // it as paths
422 GrPipelineBuilder pipelineBuilder(grPaint, dc->mustUseHWAA(grPaint));
423
424 GrColor color = grPaint.getColor();
425
426 SkTextBlobRunIterator it(blob); 427 SkTextBlobRunIterator it(blob);
427 for (int run = 0; !it.done(); it.next(), run++) { 428 for (int run = 0; !it.done(); it.next(), run++) {
428 if (fRuns[run].fDrawAsPaths) { 429 if (fRuns[run].fDrawAsPaths) {
429 this->flushRunAsPaths(context, dc, props, it, clip, skPaint, 430 this->flushRunAsPaths(context, dc, props, it, clip, skPaint,
430 drawFilter, viewMatrix, clipBounds, x, y); 431 drawFilter, viewMatrix, clipBounds, x, y);
431 continue; 432 continue;
432 } 433 }
433 this->flushRun(dc, &pipelineBuilder, clip, run, viewMatrix, x, y, color, skPaint, props, 434 this->flushRun(dc, grPaint, clip, run, viewMatrix, x, y, skPaint, props,
434 distanceAdjustTable, context->getBatchFontCache()); 435 distanceAdjustTable, context->getBatchFontCache());
435 } 436 }
436 437
437 // Now flush big glyphs 438 // Now flush big glyphs
438 this->flushBigGlyphs(context, dc, clip, skPaint, viewMatrix, x, y, clipBound s); 439 this->flushBigGlyphs(context, dc, clip, skPaint, viewMatrix, x, y, clipBound s);
439 } 440 }
440 441
441 void GrAtlasTextBlob::flushThrowaway(GrContext* context, 442 void GrAtlasTextBlob::flushThrowaway(GrContext* context,
442 GrDrawContext* dc, 443 GrDrawContext* dc,
443 const SkSurfaceProps& props, 444 const SkSurfaceProps& props,
444 const GrDistanceFieldAdjustTable* distanceA djustTable, 445 const GrDistanceFieldAdjustTable* distanceA djustTable,
445 const SkPaint& skPaint, 446 const SkPaint& skPaint,
446 const GrPaint& grPaint, 447 const GrPaint& grPaint,
447 const GrClip& clip, 448 const GrClip& clip,
448 const SkMatrix& viewMatrix, 449 const SkMatrix& viewMatrix,
449 const SkIRect& clipBounds, 450 const SkIRect& clipBounds,
450 SkScalar x, SkScalar y) { 451 SkScalar x, SkScalar y) {
451 GrPipelineBuilder pipelineBuilder(grPaint, dc->mustUseHWAA(grPaint));
452
453 GrColor color = grPaint.getColor();
454 for (int run = 0; run < fRunCount; run++) { 452 for (int run = 0; run < fRunCount; run++) {
455 this->flushRun(dc, &pipelineBuilder, clip, run, viewMatrix, x, y, color, skPaint, props, 453 this->flushRun(dc, grPaint, clip, run, viewMatrix, x, y, skPaint, props,
456 distanceAdjustTable, context->getBatchFontCache()); 454 distanceAdjustTable, context->getBatchFontCache());
457 } 455 }
458 456
459 // Now flush big glyphs 457 // Now flush big glyphs
460 this->flushBigGlyphs(context, dc, clip, skPaint, viewMatrix, x, y, clipBound s); 458 this->flushBigGlyphs(context, dc, clip, skPaint, viewMatrix, x, y, clipBound s);
461 } 459 }
462 460
463 GrDrawBatch* GrAtlasTextBlob::test_createBatch( 461 GrDrawBatch* GrAtlasTextBlob::test_createBatch(
464 int glyphCount, int run, int subRu n, 462 int glyphCount, int run, int subRu n,
465 const SkMatrix& viewMatrix, SkScal ar x, SkScalar y, 463 const SkMatrix& viewMatrix, SkScal ar x, SkScalar y,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 558
561 void GrAtlasTextBlob::Run::SubRunInfo::computeTranslation(const SkMatrix& viewMa trix, 559 void GrAtlasTextBlob::Run::SubRunInfo::computeTranslation(const SkMatrix& viewMa trix,
562 SkScalar x, SkScalar y , SkScalar* transX, 560 SkScalar x, SkScalar y , SkScalar* transX,
563 SkScalar* transY) { 561 SkScalar* transY) {
564 calculate_translation(!this->drawAsDistanceFields(), viewMatrix, x, y, 562 calculate_translation(!this->drawAsDistanceFields(), viewMatrix, x, y,
565 fCurrentViewMatrix, fX, fY, transX, transY); 563 fCurrentViewMatrix, fX, fY, transX, transY);
566 fCurrentViewMatrix = viewMatrix; 564 fCurrentViewMatrix = viewMatrix;
567 fX = x; 565 fX = x;
568 fY = y; 566 fY = y;
569 } 567 }
OLDNEW
« no previous file with comments | « src/gpu/text/GrAtlasTextBlob.h ('k') | src/gpu/text/GrStencilAndCoverTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698