OLD | NEW |
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 "glsl/GrGLSLXferProcessor.h" | 8 #include "glsl/GrGLSLXferProcessor.h" |
9 | 9 |
10 #include "GrXferProcessor.h" | 10 #include "GrXferProcessor.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } else { | 81 } else { |
82 SkASSERT(!fDstScaleUni.isValid()); | 82 SkASSERT(!fDstScaleUni.isValid()); |
83 } | 83 } |
84 } else { | 84 } else { |
85 SkASSERT(!fDstTopLeftUni.isValid()); | 85 SkASSERT(!fDstTopLeftUni.isValid()); |
86 SkASSERT(!fDstScaleUni.isValid()); | 86 SkASSERT(!fDstScaleUni.isValid()); |
87 } | 87 } |
88 this->onSetData(pdm, xp); | 88 this->onSetData(pdm, xp); |
89 } | 89 } |
90 | 90 |
91 void GrGLSLXferProcessor::DefaultCoverageModulation(GrGLSLXPFragmentBuilder* fra
gBuilder, | |
92 const char* srcCoverage, | |
93 const char* dstColor, | |
94 const char* outColor, | |
95 const char* outColorSecondar
y, | |
96 const GrXferProcessor& proc)
{ | |
97 if (proc.dstReadUsesMixedSamples()) { | |
98 if (srcCoverage) { | |
99 fragBuilder->codeAppendf("%s *= %s;", outColor, srcCoverage); | |
100 fragBuilder->codeAppendf("%s = %s;", outColorSecondary, srcCoverage)
; | |
101 } else { | |
102 fragBuilder->codeAppendf("%s = vec4(1.0);", outColorSecondary); | |
103 } | |
104 } else if (srcCoverage) { | |
105 fragBuilder->codeAppendf("%s = %s * %s + (vec4(1.0) - %s) * %s;", | |
106 outColor, srcCoverage, outColor, srcCoverage, d
stColor); | |
107 } | |
108 } | |
OLD | NEW |