blob: ee64d333abd5636c1084a15b14caaf8083ae8818 [file] [log] [blame]
egdaniel605dd0f2014-11-12 08:35:25 -08001/*
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
12void 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
egdaniel605dd0f2014-11-12 08:35:25 -080020 // If we claim that we are not using the input color we must not be modulating the input.
21 SkASSERT(fNonMulStageFound || fWillUseInputColor);
22}
23
24bool GrInvariantOutput::colorComponentsAllEqual() const {
25 unsigned colorA = GrColorUnpackA(fColor);
26 return(GrColorUnpackR(fColor) == colorA &&
27 GrColorUnpackG(fColor) == colorA &&
28 GrColorUnpackB(fColor) == colorA);
29}
30
egdaniel605dd0f2014-11-12 08:35:25 -080031#endif // end DEBUG