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

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

Issue 914723002: Small change to use a GrGeometryProcessor for all BitmapText draw calls (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: adding bench Created 5 years, 10 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/GrBitmapTextContext.h ('k') | src/gpu/effects/GrBitmapTextGeoProc.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 2013 Google Inc. 2 * Copyright 2013 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 "GrBitmapTextContext.h" 8 #include "GrBitmapTextContext.h"
9 #include "GrAtlas.h" 9 #include "GrAtlas.h"
10 #include "GrDefaultGeoProcFactory.h" 10 #include "GrDefaultGeoProcFactory.h"
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 break; 554 break;
555 } 555 }
556 // Grayscale/BW text 556 // Grayscale/BW text
557 case kA8_GrMaskFormat: 557 case kA8_GrMaskFormat:
558 break; 558 break;
559 default: 559 default:
560 SkFAIL("Unexpected mask format."); 560 SkFAIL("Unexpected mask format.");
561 } 561 }
562 562
563 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNon e_FilterMode); 563 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNon e_FilterMode);
564 if (kARGB_GrMaskFormat == fCurrMaskFormat) { 564 uint32_t textureUniqueID = fCurrTexture->getUniqueID();
565 uint32_t textureUniqueID = fCurrTexture->getUniqueID(); 565 if (textureUniqueID != fEffectTextureUniqueID ||
566 if (textureUniqueID != fEffectTextureUniqueID || 566 fCachedGeometryProcessor->color() != color ||
567 fCachedGeometryProcessor->color() != color) { 567 !fCachedGeometryProcessor->localMatrix().cheapEqualTo(fLocalMatrix)) {
568 uint32_t flags = GrDefaultGeoProcFactory::kLocalCoord_GPType; 568 // This will be ignored in the non A8 case
569 fCachedGeometryProcessor.reset(GrDefaultGeoProcFactory::Create(f lags, color)); 569 bool opaqueVertexColors = GrColorIsOpaque(fPaint.getColor());
570 fCachedTextureProcessor.reset(GrSimpleTextureEffect::Create(fCur rTexture, 570 fCachedGeometryProcessor.reset(GrBitmapTextGeoProc::Create(color,
571 SkMa trix::I(), 571 fCurrText ure,
572 para ms)); 572 params,
573 fEffectTextureUniqueID = textureUniqueID; 573 fCurrMask Format,
574 } 574 opaqueVer texColors,
575 pipelineBuilder.addColorProcessor(fCachedTextureProcessor.get()); 575 fLocalMat rix));
576 } else { 576 fEffectTextureUniqueID = textureUniqueID;
577 uint32_t textureUniqueID = fCurrTexture->getUniqueID();
578 if (textureUniqueID != fEffectTextureUniqueID ||
579 fCachedGeometryProcessor->color() != color ||
580 !fCachedGeometryProcessor->localMatrix().cheapEqualTo(fLocalMatr ix)) {
581 bool hasColor = kA8_GrMaskFormat == fCurrMaskFormat;
582 bool opaqueVertexColors = GrColorIsOpaque(fPaint.getColor());
583 fCachedGeometryProcessor.reset(GrBitmapTextGeoProc::Create(color ,
584 fCurr Texture,
585 param s,
586 hasCo lor,
587 opaqu eVertexColors,
588 fLoca lMatrix));
589 fEffectTextureUniqueID = textureUniqueID;
590 }
591 } 577 }
592 578
593 int nGlyphs = fCurrVertex / kVerticesPerGlyph; 579 int nGlyphs = fCurrVertex / kVerticesPerGlyph;
594 fDrawTarget->setIndexSourceToBuffer(fContext->getQuadIndexBuffer()); 580 fDrawTarget->setIndexSourceToBuffer(fContext->getQuadIndexBuffer());
595 fDrawTarget->drawIndexedInstances(&pipelineBuilder, 581 fDrawTarget->drawIndexedInstances(&pipelineBuilder,
596 fCachedGeometryProcessor.get(), 582 fCachedGeometryProcessor.get(),
597 kTriangles_GrPrimitiveType, 583 kTriangles_GrPrimitiveType,
598 nGlyphs, 584 nGlyphs,
599 kVerticesPerGlyph, 585 kVerticesPerGlyph,
600 kIndicesPerGlyph, 586 kIndicesPerGlyph,
(...skipping 10 matching lines...) Expand all
611 } 597 }
612 } 598 }
613 599
614 inline void GrBitmapTextContext::finish() { 600 inline void GrBitmapTextContext::finish() {
615 this->flush(); 601 this->flush();
616 fTotalVertexCount = 0; 602 fTotalVertexCount = 0;
617 603
618 GrTextContext::finish(); 604 GrTextContext::finish();
619 } 605 }
620 606
OLDNEW
« no previous file with comments | « src/gpu/GrBitmapTextContext.h ('k') | src/gpu/effects/GrBitmapTextGeoProc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698