Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(594)

Side by Side Diff: src/gpu/GrInvariantOutput.cpp

Issue 699943003: Move GrInvariantOutput out of GrProcessor and into its own class. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Cleanup Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrDrawState.cpp ('k') | src/gpu/GrOptDrawState.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
12 void 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 SkASSERT(this->validPreMulColor());
21
22 // If we claim that we are not using the input color we must not be modulati ng the input.
23 SkASSERT(fNonMulStageFound || fWillUseInputColor);
24 }
25
26 bool GrInvariantOutput::colorComponentsAllEqual() const {
27 unsigned colorA = GrColorUnpackA(fColor);
28 return(GrColorUnpackR(fColor) == colorA &&
29 GrColorUnpackG(fColor) == colorA &&
30 GrColorUnpackB(fColor) == colorA);
31 }
32
33 bool GrInvariantOutput::validPreMulColor() const {
34 if (kA_GrColorComponentFlag & fValidFlags) {
35 float c[4];
36 GrColorToRGBAFloat(fColor, c);
37 if (kR_GrColorComponentFlag & fValidFlags) {
38 if (c[0] > c[3]) {
39 return false;
40 }
41 }
42 if (kG_GrColorComponentFlag & fValidFlags) {
43 if (c[1] > c[3]) {
44 return false;
45 }
46 }
47 if (kB_GrColorComponentFlag & fValidFlags) {
48 if (c[2] > c[3]) {
49 return false;
50 }
51 }
52 }
53 return true;
54 }
55 #endif // end DEBUG
56
OLDNEW
« no previous file with comments | « src/gpu/GrDrawState.cpp ('k') | src/gpu/GrOptDrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698