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

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

Issue 1348583002: Make skpaint->grpaint flow work for composing draws (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove unused inheriteds to satisfy clang Created 5 years, 2 months 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/GrFragmentProcessor.cpp ('k') | src/gpu/GrTextContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "GrInvariantOutput.h" 8 #include "GrInvariantOutput.h"
9 9
10 #ifdef SK_DEBUG 10 #ifdef SK_DEBUG
11 11
12 void GrInvariantOutput::validate() const { 12 void GrInvariantOutput::validate() const {
13 if (fIsSingleComponent) { 13 if (fIsSingleComponent) {
14 SkASSERT(0 == fValidFlags || kRGBA_GrColorComponentFlags == fValidFlags) ; 14 SkASSERT(0 == fValidFlags || kRGBA_GrColorComponentFlags == fValidFlags) ;
15 if (kRGBA_GrColorComponentFlags == fValidFlags) { 15 if (kRGBA_GrColorComponentFlags == fValidFlags) {
16 SkASSERT(this->colorComponentsAllEqual()); 16 SkASSERT(this->colorComponentsAllEqual());
17 } 17 }
18 } 18 }
19 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. 20 // If we claim that we are not using the input color we must not be modulati ng the input.
23 SkASSERT(fNonMulStageFound || fWillUseInputColor); 21 SkASSERT(fNonMulStageFound || fWillUseInputColor);
24 } 22 }
25 23
26 bool GrInvariantOutput::colorComponentsAllEqual() const { 24 bool GrInvariantOutput::colorComponentsAllEqual() const {
27 unsigned colorA = GrColorUnpackA(fColor); 25 unsigned colorA = GrColorUnpackA(fColor);
28 return(GrColorUnpackR(fColor) == colorA && 26 return(GrColorUnpackR(fColor) == colorA &&
29 GrColorUnpackG(fColor) == colorA && 27 GrColorUnpackG(fColor) == colorA &&
30 GrColorUnpackB(fColor) == colorA); 28 GrColorUnpackB(fColor) == colorA);
31 } 29 }
32 30
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
56 #endif // end DEBUG 31 #endif // end DEBUG
57 32
OLDNEW
« no previous file with comments | « src/gpu/GrFragmentProcessor.cpp ('k') | src/gpu/GrTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698