| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrProcessor.h" | 8 #include "GrProcessor.h" |
| 9 #include "GrBackendProcessorFactory.h" | 9 #include "GrBackendProcessorFactory.h" |
| 10 #include "GrContext.h" | 10 #include "GrContext.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 void GrProcessor::InvariantOutput::validate() const { | 136 void GrProcessor::InvariantOutput::validate() const { |
| 137 if (fIsSingleComponent) { | 137 if (fIsSingleComponent) { |
| 138 SkASSERT(0 == fValidFlags || kRGBA_GrColorComponentFlags == fValidFlags)
; | 138 SkASSERT(0 == fValidFlags || kRGBA_GrColorComponentFlags == fValidFlags)
; |
| 139 if (kRGBA_GrColorComponentFlags == fValidFlags) { | 139 if (kRGBA_GrColorComponentFlags == fValidFlags) { |
| 140 SkASSERT(this->colorComponentsAllEqual()); | 140 SkASSERT(this->colorComponentsAllEqual()); |
| 141 } | 141 } |
| 142 } | 142 } |
| 143 | 143 |
| 144 SkASSERT(this->validPreMulColor()); | 144 SkASSERT(this->validPreMulColor()); |
| 145 |
| 146 // If we claim that we are not using the input color we must not be modulati
ng the input. |
| 147 SkASSERT(!fInputIsOnlyModulated || fWillUseInputColor); |
| 145 } | 148 } |
| 146 | 149 |
| 147 bool GrProcessor::InvariantOutput::colorComponentsAllEqual() const { | 150 bool GrProcessor::InvariantOutput::colorComponentsAllEqual() const { |
| 148 unsigned colorA = GrColorUnpackA(fColor); | 151 unsigned colorA = GrColorUnpackA(fColor); |
| 149 return(GrColorUnpackR(fColor) == colorA && | 152 return(GrColorUnpackR(fColor) == colorA && |
| 150 GrColorUnpackG(fColor) == colorA && | 153 GrColorUnpackG(fColor) == colorA && |
| 151 GrColorUnpackB(fColor) == colorA); | 154 GrColorUnpackB(fColor) == colorA); |
| 152 } | 155 } |
| 153 | 156 |
| 154 bool GrProcessor::InvariantOutput::validPreMulColor() const { | 157 bool GrProcessor::InvariantOutput::validPreMulColor() const { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 168 if (kB_GrColorComponentFlag & fValidFlags) { | 171 if (kB_GrColorComponentFlag & fValidFlags) { |
| 169 if (c[2] > c[3]) { | 172 if (c[2] > c[3]) { |
| 170 return false; | 173 return false; |
| 171 } | 174 } |
| 172 } | 175 } |
| 173 } | 176 } |
| 174 return true; | 177 return true; |
| 175 } | 178 } |
| 176 #endif | 179 #endif |
| 177 | 180 |
| OLD | NEW |