| Index: src/gpu/GrProcessor.cpp
|
| diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp
|
| index 45298b522d3ef9e1bf367c19ea8989a8b02f900e..26e00530be848491e87d9ecb82035f29dd4c680f 100644
|
| --- a/src/gpu/GrProcessor.cpp
|
| +++ b/src/gpu/GrProcessor.cpp
|
| @@ -88,4 +88,46 @@ void GrProcessor::assertEquality(const GrProcessor& other) const {
|
| SkASSERT(this->textureAccess(i) == other.textureAccess(i));
|
| }
|
| }
|
| +
|
| +void GrProcessor::InvariantOutput::validate() const {
|
| + if (fIsSingleComponent) {
|
| + SkASSERT(0 == fValidFlags || kRGBA_GrColorComponentFlags == fValidFlags);
|
| + if (kRGBA_GrColorComponentFlags == fValidFlags) {
|
| + SkASSERT(this->colorComponentsAllEqual());
|
| + }
|
| + }
|
| +
|
| + SkASSERT(this->validPreMulColor());
|
| +}
|
| +
|
| +bool GrProcessor::InvariantOutput::colorComponentsAllEqual() const {
|
| + unsigned colorA = GrColorUnpackA(fColor);
|
| + return(GrColorUnpackR(fColor) == colorA &&
|
| + GrColorUnpackG(fColor) == colorA &&
|
| + GrColorUnpackB(fColor) == colorA);
|
| +}
|
| +
|
| +bool GrProcessor::InvariantOutput::validPreMulColor() const {
|
| + if (kA_GrColorComponentFlag & fValidFlags) {
|
| + float c[4];
|
| + GrColorToRGBAFloat(fColor, c);
|
| + if (kR_GrColorComponentFlag & fValidFlags) {
|
| + if (c[0] > c[3]) {
|
| + return false;
|
| + }
|
| + }
|
| + if (kG_GrColorComponentFlag & fValidFlags) {
|
| + if (c[1] > c[3]) {
|
| + return false;
|
| + }
|
| + }
|
| + if (kB_GrColorComponentFlag & fValidFlags) {
|
| + if (c[2] > c[3]) {
|
| + return false;
|
| + }
|
| + }
|
| + }
|
| + return true;
|
| +}
|
| #endif
|
| +
|
|
|