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

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

Issue 751283002: Add XferProcessor factory in GrPaint and GrDrawState. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Review changes Created 6 years 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
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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 filteredColor = fSkPaint.getColor(); 653 filteredColor = fSkPaint.getColor();
654 } 654 }
655 this->setupCoverageEffect(filteredColor); 655 this->setupCoverageEffect(filteredColor);
656 656
657 // Effects could be stored with one of the cache objects (atlas?) 657 // Effects could be stored with one of the cache objects (atlas?)
658 drawState.setGeometryProcessor(fCachedGeometryProcessor.get()); 658 drawState.setGeometryProcessor(fCachedGeometryProcessor.get());
659 659
660 // Set draw state 660 // Set draw state
661 if (fUseLCDText) { 661 if (fUseLCDText) {
662 GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredCol or); 662 GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredCol or);
663 if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() || 663
664 kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || 664 // TODO: move supportsRGBCoverage check to setupCoverageEffect and o nly add LCD
665 fPaint.numColorStages()) { 665 // processor if the xp can support it. For now we will simply assume that if
666 // fUseLCDText is true, then we have a known color output.
667 if (!drawState.getXPFactory()->supportsRGBCoverage(0, kRGBA_GrColorC omponentFlags)) {
666 SkDebugf("LCD Text will not draw correctly.\n"); 668 SkDebugf("LCD Text will not draw correctly.\n");
667 } 669 }
668 SkASSERT(!drawState.hasColorVertexAttribute()); 670 SkASSERT(!drawState.hasColorVertexAttribute());
669 // We don't use the GrPaint's color in this case because it's been p remultiplied by 671 // We don't use the GrPaint's color in this case because it's been p remultiplied by
670 // alpha. Instead we feed in a non-premultiplied color, and multiply its alpha by 672 // alpha. Instead we feed in a non-premultiplied color, and multiply its alpha by
671 // the mask texture color. The end result is that we get 673 // the mask texture color. The end result is that we get
672 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*dstCo lor 674 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*dstCo lor
673 int a = SkColorGetA(fSkPaint.getColor()); 675 int a = SkColorGetA(fSkPaint.getColor());
674 // paintAlpha 676 // paintAlpha
675 drawState.setColor(SkColorSetARGB(a, a, a, a)); 677 drawState.setColor(SkColorSetARGB(a, a, a, a));
(...skipping 26 matching lines...) Expand all
702 } 704 }
703 } 705 }
704 706
705 inline void GrDistanceFieldTextContext::finish() { 707 inline void GrDistanceFieldTextContext::finish() {
706 this->flush(); 708 this->flush();
707 fTotalVertexCount = 0; 709 fTotalVertexCount = 0;
708 710
709 GrTextContext::finish(); 711 GrTextContext::finish();
710 } 712 }
711 713
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698