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

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

Issue 858343002: Rename GrOptDrawState to GrPipeline and GrDrawState to GrPipelineBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more nits Created 5 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/GrDefaultPathRenderer.cpp ('k') | src/gpu/GrDrawState.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 "GrDistanceFieldTextContext.h" 8 #include "GrDistanceFieldTextContext.h"
9 #include "GrAtlas.h" 9 #include "GrAtlas.h"
10 #include "GrBitmapTextContext.h" 10 #include "GrBitmapTextContext.h"
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 629
630 return true; 630 return true;
631 } 631 }
632 632
633 void GrDistanceFieldTextContext::flush() { 633 void GrDistanceFieldTextContext::flush() {
634 if (NULL == fDrawTarget) { 634 if (NULL == fDrawTarget) {
635 return; 635 return;
636 } 636 }
637 637
638 if (fCurrVertex > 0) { 638 if (fCurrVertex > 0) {
639 GrDrawState drawState; 639 GrPipelineBuilder pipelineBuilder;
640 drawState.setFromPaint(fPaint, fContext->getRenderTarget()); 640 pipelineBuilder.setFromPaint(fPaint, fContext->getRenderTarget());
641 641
642 // setup our sampler state for our text texture/atlas 642 // setup our sampler state for our text texture/atlas
643 SkASSERT(SkIsAlign4(fCurrVertex)); 643 SkASSERT(SkIsAlign4(fCurrVertex));
644 644
645 // get our current color 645 // get our current color
646 SkColor filteredColor; 646 SkColor filteredColor;
647 SkColorFilter* colorFilter = fSkPaint.getColorFilter(); 647 SkColorFilter* colorFilter = fSkPaint.getColorFilter();
648 if (colorFilter) { 648 if (colorFilter) {
649 filteredColor = colorFilter->filterColor(fSkPaint.getColor()); 649 filteredColor = colorFilter->filterColor(fSkPaint.getColor());
650 } else { 650 } else {
651 filteredColor = fSkPaint.getColor(); 651 filteredColor = fSkPaint.getColor();
652 } 652 }
653 this->setupCoverageEffect(filteredColor); 653 this->setupCoverageEffect(filteredColor);
654 654
655 // Set draw state 655 // Set draw state
656 if (fUseLCDText) { 656 if (fUseLCDText) {
657 // TODO: move supportsRGBCoverage check to setupCoverageEffect and o nly add LCD 657 // TODO: move supportsRGBCoverage check to setupCoverageEffect and o nly add LCD
658 // processor if the xp can support it. For now we will simply assume that if 658 // processor if the xp can support it. For now we will simply assume that if
659 // fUseLCDText is true, then we have a known color output. 659 // fUseLCDText is true, then we have a known color output.
660 if (!drawState.getXPFactory()->supportsRGBCoverage(0, kRGBA_GrColorC omponentFlags)) { 660 const GrXPFactory* xpFactory = pipelineBuilder.getXPFactory();
661 if (!xpFactory->supportsRGBCoverage(0, kRGBA_GrColorComponentFlags)) {
661 SkDebugf("LCD Text will not draw correctly.\n"); 662 SkDebugf("LCD Text will not draw correctly.\n");
662 } 663 }
663 SkASSERT(!fCachedGeometryProcessor->hasVertexColor()); 664 SkASSERT(!fCachedGeometryProcessor->hasVertexColor());
664 } else { 665 } else {
665 // We're using per-vertex color. 666 // We're using per-vertex color.
666 SkASSERT(fCachedGeometryProcessor->hasVertexColor()); 667 SkASSERT(fCachedGeometryProcessor->hasVertexColor());
667 } 668 }
668 int nGlyphs = fCurrVertex / kVerticesPerGlyph; 669 int nGlyphs = fCurrVertex / kVerticesPerGlyph;
669 fDrawTarget->setIndexSourceToBuffer(fContext->getQuadIndexBuffer()); 670 fDrawTarget->setIndexSourceToBuffer(fContext->getQuadIndexBuffer());
670 fDrawTarget->drawIndexedInstances(&drawState, 671 fDrawTarget->drawIndexedInstances(&pipelineBuilder,
671 fCachedGeometryProcessor.get(), 672 fCachedGeometryProcessor.get(),
672 kTriangles_GrPrimitiveType, 673 kTriangles_GrPrimitiveType,
673 nGlyphs, 674 nGlyphs,
674 kVerticesPerGlyph, 675 kVerticesPerGlyph,
675 kIndicesPerGlyph, 676 kIndicesPerGlyph,
676 &fVertexBounds); 677 &fVertexBounds);
677 fDrawTarget->resetVertexSource(); 678 fDrawTarget->resetVertexSource();
678 fVertices = NULL; 679 fVertices = NULL;
679 fTotalVertexCount -= fCurrVertex; 680 fTotalVertexCount -= fCurrVertex;
680 fCurrVertex = 0; 681 fCurrVertex = 0;
681 SkSafeSetNull(fCurrTexture); 682 SkSafeSetNull(fCurrTexture);
682 fVertexBounds.setLargestInverted(); 683 fVertexBounds.setLargestInverted();
683 } 684 }
684 } 685 }
685 686
686 inline void GrDistanceFieldTextContext::finish() { 687 inline void GrDistanceFieldTextContext::finish() {
687 this->flush(); 688 this->flush();
688 fTotalVertexCount = 0; 689 fTotalVertexCount = 0;
689 690
690 GrTextContext::finish(); 691 GrTextContext::finish();
691 } 692 }
692 693
OLDNEW
« no previous file with comments | « src/gpu/GrDefaultPathRenderer.cpp ('k') | src/gpu/GrDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698