OLD | NEW |
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor, | 54 bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor, |
55 uint32_t* solidColorKnownComponents) const
{ | 55 uint32_t* solidColorKnownComponents) const
{ |
56 | 56 |
57 // TODO: Share this implementation with GrDrawState | 57 // TODO: Share this implementation with GrDrawState |
58 | 58 |
59 GrColor coverage = GrColorPackRGBA(fCoverage, fCoverage, fCoverage, fCoverag
e); | 59 GrColor coverage = GrColorPackRGBA(fCoverage, fCoverage, fCoverage, fCoverag
e); |
60 uint32_t coverageComps = kRGBA_GrColorComponentFlags; | 60 uint32_t coverageComps = kRGBA_GrColorComponentFlags; |
61 int count = fCoverageStages.count(); | 61 int count = fCoverageStages.count(); |
62 for (int i = 0; i < count; ++i) { | 62 for (int i = 0; i < count; ++i) { |
63 (*fCoverageStages[i].getEffect())->getConstantColorComponents(&coverage,
&coverageComps); | 63 fCoverageStages[i].getEffect()->getConstantColorComponents(&coverage, &c
overageComps); |
64 } | 64 } |
65 if (kRGBA_GrColorComponentFlags != coverageComps || 0xffffffff != coverage)
{ | 65 if (kRGBA_GrColorComponentFlags != coverageComps || 0xffffffff != coverage)
{ |
66 return false; | 66 return false; |
67 } | 67 } |
68 | 68 |
69 GrColor color = fColor; | 69 GrColor color = fColor; |
70 uint32_t colorComps = kRGBA_GrColorComponentFlags; | 70 uint32_t colorComps = kRGBA_GrColorComponentFlags; |
71 count = fColorStages.count(); | 71 count = fColorStages.count(); |
72 for (int i = 0; i < count; ++i) { | 72 for (int i = 0; i < count; ++i) { |
73 (*fColorStages[i].getEffect())->getConstantColorComponents(&color, &colo
rComps); | 73 fColorStages[i].getEffect()->getConstantColorComponents(&color, &colorCo
mps); |
74 } | 74 } |
75 | 75 |
76 SkASSERT((NULL == solidColor) == (NULL == solidColorKnownComponents)); | 76 SkASSERT((NULL == solidColor) == (NULL == solidColorKnownComponents)); |
77 | 77 |
78 GrBlendCoeff srcCoeff = fSrcBlendCoeff; | 78 GrBlendCoeff srcCoeff = fSrcBlendCoeff; |
79 GrBlendCoeff dstCoeff = fDstBlendCoeff; | 79 GrBlendCoeff dstCoeff = fDstBlendCoeff; |
80 GrSimplifyBlend(&srcCoeff, &dstCoeff, color, colorComps, 0, 0, 0); | 80 GrSimplifyBlend(&srcCoeff, &dstCoeff, color, colorComps, 0, 0, 0); |
81 | 81 |
82 bool opaque = kZero_GrBlendCoeff == dstCoeff && !GrBlendCoeffRefsDst(srcCoef
f); | 82 bool opaque = kZero_GrBlendCoeff == dstCoeff && !GrBlendCoeffRefsDst(srcCoef
f); |
83 if (NULL != solidColor) { | 83 if (NULL != solidColor) { |
(...skipping 30 matching lines...) Expand all Loading... |
114 case kIConstA_GrBlendCoeff: | 114 case kIConstA_GrBlendCoeff: |
115 *solidColorKnownComponents = 0; | 115 *solidColorKnownComponents = 0; |
116 break; | 116 break; |
117 } | 117 } |
118 } else { | 118 } else { |
119 solidColorKnownComponents = 0; | 119 solidColorKnownComponents = 0; |
120 } | 120 } |
121 } | 121 } |
122 return opaque; | 122 return opaque; |
123 } | 123 } |
OLD | NEW |