1 /* 2 * Copyright 2014 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "GrInvariantOutput.h" 9 10 #ifdef SK_DEBUG 11 validate() const12void GrInvariantOutput::validate() const { 13 if (fIsSingleComponent) { 14 SkASSERT(0 == fValidFlags || kRGBA_GrColorComponentFlags == fValidFlags); 15 if (kRGBA_GrColorComponentFlags == fValidFlags) { 16 SkASSERT(this->colorComponentsAllEqual()); 17 } 18 } 19 20 // If we claim that we are not using the input color we must not be modulating the input. 21 SkASSERT(fNonMulStageFound || fWillUseInputColor); 22 } 23 colorComponentsAllEqual() const24bool GrInvariantOutput::colorComponentsAllEqual() const { 25 unsigned colorA = GrColorUnpackA(fColor); 26 return(GrColorUnpackR(fColor) == colorA && 27 GrColorUnpackG(fColor) == colorA && 28 GrColorUnpackB(fColor) == colorA); 29 } 30 31 #endif // end DEBUG 32 33