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

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

Issue 617853003: Revert of Add isSingleComponent bool to getConstantColorComponent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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/GrOvalRenderer.cpp ('k') | src/gpu/GrProcessor.cpp » ('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 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrPaint.h" 9 #include "GrPaint.h"
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 } 46 }
47 return false; 47 return false;
48 } 48 }
49 49
50 bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor, 50 bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor,
51 uint32_t* solidColorKnownComponents) const { 51 uint32_t* solidColorKnownComponents) const {
52 52
53 // TODO: Share this implementation with GrDrawState 53 // TODO: Share this implementation with GrDrawState
54 54
55 GrProcessor::InvariantOutput inout; 55 GrColor coverage = GrColorPackRGBA(fCoverage, fCoverage, fCoverage, fCoverag e);
56 inout.fColor = GrColorPackRGBA(fCoverage, fCoverage, fCoverage, fCoverage); 56 uint32_t coverageComps = kRGBA_GrColorComponentFlags;
57 inout.fValidFlags = kRGBA_GrColorComponentFlags;
58 inout.fIsSingleComponent = false;
59 int count = fCoverageStages.count(); 57 int count = fCoverageStages.count();
60 for (int i = 0; i < count; ++i) { 58 for (int i = 0; i < count; ++i) {
61 fCoverageStages[i].getProcessor()->computeInvariantOutput(&inout); 59 fCoverageStages[i].getProcessor()->getConstantColorComponents(&coverage, &coverageComps);
62 } 60 }
63 if (!inout.isSolidWhite()) { 61 if (kRGBA_GrColorComponentFlags != coverageComps || 0xffffffff != coverage) {
64 return false; 62 return false;
65 } 63 }
66 64
67 inout.fColor = fColor; 65 GrColor color = fColor;
68 inout.fValidFlags = kRGBA_GrColorComponentFlags; 66 uint32_t colorComps = kRGBA_GrColorComponentFlags;
69 inout.fIsSingleComponent = false;
70 count = fColorStages.count(); 67 count = fColorStages.count();
71 for (int i = 0; i < count; ++i) { 68 for (int i = 0; i < count; ++i) {
72 fColorStages[i].getProcessor()->computeInvariantOutput(&inout); 69 fColorStages[i].getProcessor()->getConstantColorComponents(&color, &colo rComps);
73 } 70 }
74 71
75 SkASSERT((NULL == solidColor) == (NULL == solidColorKnownComponents)); 72 SkASSERT((NULL == solidColor) == (NULL == solidColorKnownComponents));
76 73
77 GrBlendCoeff srcCoeff = fSrcBlendCoeff; 74 GrBlendCoeff srcCoeff = fSrcBlendCoeff;
78 GrBlendCoeff dstCoeff = fDstBlendCoeff; 75 GrBlendCoeff dstCoeff = fDstBlendCoeff;
79 GrSimplifyBlend(&srcCoeff, &dstCoeff, inout.fColor, inout.fValidFlags, 76 GrSimplifyBlend(&srcCoeff, &dstCoeff, color, colorComps, 0, 0, 0);
80 0, 0, 0);
81 77
82 bool opaque = kZero_GrBlendCoeff == dstCoeff && !GrBlendCoeffRefsDst(srcCoef f); 78 bool opaque = kZero_GrBlendCoeff == dstCoeff && !GrBlendCoeffRefsDst(srcCoef f);
83 if (solidColor) { 79 if (solidColor) {
84 if (opaque) { 80 if (opaque) {
85 switch (srcCoeff) { 81 switch (srcCoeff) {
86 case kZero_GrBlendCoeff: 82 case kZero_GrBlendCoeff:
87 *solidColor = 0; 83 *solidColor = 0;
88 *solidColorKnownComponents = kRGBA_GrColorComponentFlags; 84 *solidColorKnownComponents = kRGBA_GrColorComponentFlags;
89 break; 85 break;
90 86
91 case kOne_GrBlendCoeff: 87 case kOne_GrBlendCoeff:
92 *solidColor = inout.fColor; 88 *solidColor = color;
93 *solidColorKnownComponents = inout.fValidFlags; 89 *solidColorKnownComponents = colorComps;
94 break; 90 break;
95 91
96 // The src coeff should never refer to the src and if it refers to dst then opaque 92 // The src coeff should never refer to the src and if it refers to dst then opaque
97 // should have been false. 93 // should have been false.
98 case kSC_GrBlendCoeff: 94 case kSC_GrBlendCoeff:
99 case kISC_GrBlendCoeff: 95 case kISC_GrBlendCoeff:
100 case kDC_GrBlendCoeff: 96 case kDC_GrBlendCoeff:
101 case kIDC_GrBlendCoeff: 97 case kIDC_GrBlendCoeff:
102 case kSA_GrBlendCoeff: 98 case kSA_GrBlendCoeff:
103 case kISA_GrBlendCoeff: 99 case kISA_GrBlendCoeff:
(...skipping 10 matching lines...) Expand all
114 case kIConstA_GrBlendCoeff: 110 case kIConstA_GrBlendCoeff:
115 *solidColorKnownComponents = 0; 111 *solidColorKnownComponents = 0;
116 break; 112 break;
117 } 113 }
118 } else { 114 } else {
119 solidColorKnownComponents = 0; 115 solidColorKnownComponents = 0;
120 } 116 }
121 } 117 }
122 return opaque; 118 return opaque;
123 } 119 }
OLDNEW
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/GrProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698