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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 fragBuilder->codeAppend("// Read color from copy of the destination.\n")
; | 51 fragBuilder->codeAppend("// Read color from copy of the destination.\n")
; |
52 fragBuilder->codeAppendf("vec2 _dstTexCoord = (%s.xy - %s) * %s;", | 52 fragBuilder->codeAppendf("vec2 _dstTexCoord = (%s.xy - %s) * %s;", |
53 fragPos, dstTopLeftName, dstCoordScaleName); | 53 fragPos, dstTopLeftName, dstCoordScaleName); |
54 | 54 |
55 if (!topDown) { | 55 if (!topDown) { |
56 fragBuilder->codeAppend("_dstTexCoord.y = 1.0 - _dstTexCoord.y;"); | 56 fragBuilder->codeAppend("_dstTexCoord.y = 1.0 - _dstTexCoord.y;"); |
57 } | 57 } |
58 | 58 |
59 fragBuilder->codeAppendf("vec4 %s = ", dstColor); | 59 fragBuilder->codeAppendf("vec4 %s = ", dstColor); |
60 fragBuilder->appendTextureLookup(args.fTexSamplers[0], "_dstTexCoord", k
Vec2f_GrSLType); | 60 fragBuilder->appendTextureLookup(uniformHandler->getSampler(args.fTexSam
plers[0]), |
| 61 "_dstTexCoord", |
| 62 kVec2f_GrSLType); |
61 fragBuilder->codeAppend(";"); | 63 fragBuilder->codeAppend(";"); |
62 } | 64 } |
63 | 65 |
64 this->emitBlendCodeForDstRead(fragBuilder, | 66 this->emitBlendCodeForDstRead(fragBuilder, |
65 uniformHandler, | 67 uniformHandler, |
66 args.fInputColor, | 68 args.fInputColor, |
67 args.fInputCoverage, | 69 args.fInputCoverage, |
68 dstColor, | 70 dstColor, |
69 args.fOutputPrimary, | 71 args.fOutputPrimary, |
70 args.fOutputSecondary, | 72 args.fOutputSecondary, |
(...skipping 28 matching lines...) Expand all Loading... |
99 fragBuilder->codeAppendf("%s *= %s;", outColor, srcCoverage); | 101 fragBuilder->codeAppendf("%s *= %s;", outColor, srcCoverage); |
100 fragBuilder->codeAppendf("%s = %s;", outColorSecondary, srcCoverage)
; | 102 fragBuilder->codeAppendf("%s = %s;", outColorSecondary, srcCoverage)
; |
101 } else { | 103 } else { |
102 fragBuilder->codeAppendf("%s = vec4(1.0);", outColorSecondary); | 104 fragBuilder->codeAppendf("%s = vec4(1.0);", outColorSecondary); |
103 } | 105 } |
104 } else if (srcCoverage) { | 106 } else if (srcCoverage) { |
105 fragBuilder->codeAppendf("%s = %s * %s + (vec4(1.0) - %s) * %s;", | 107 fragBuilder->codeAppendf("%s = %s * %s + (vec4(1.0) - %s) * %s;", |
106 outColor, srcCoverage, outColor, srcCoverage, d
stColor); | 108 outColor, srcCoverage, outColor, srcCoverage, d
stColor); |
107 } | 109 } |
108 } | 110 } |
OLD | NEW |