| 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.fSamplers[0], "_dstTexCoord", kVec
2f_GrSLType); | 60 fragBuilder->appendTextureLookup(args.fTexSamplers[0], "_dstTexCoord", k
Vec2f_GrSLType); |
| 61 fragBuilder->codeAppend(";"); | 61 fragBuilder->codeAppend(";"); |
| 62 } | 62 } |
| 63 | 63 |
| 64 this->emitBlendCodeForDstRead(fragBuilder, | 64 this->emitBlendCodeForDstRead(fragBuilder, |
| 65 uniformHandler, | 65 uniformHandler, |
| 66 args.fInputColor, | 66 args.fInputColor, |
| 67 args.fInputCoverage, | 67 args.fInputCoverage, |
| 68 dstColor, | 68 dstColor, |
| 69 args.fOutputPrimary, | 69 args.fOutputPrimary, |
| 70 args.fOutputSecondary, | 70 args.fOutputSecondary, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 99 fragBuilder->codeAppendf("%s *= %s;", outColor, srcCoverage); | 99 fragBuilder->codeAppendf("%s *= %s;", outColor, srcCoverage); |
| 100 fragBuilder->codeAppendf("%s = %s;", outColorSecondary, srcCoverage)
; | 100 fragBuilder->codeAppendf("%s = %s;", outColorSecondary, srcCoverage)
; |
| 101 } else { | 101 } else { |
| 102 fragBuilder->codeAppendf("%s = vec4(1.0);", outColorSecondary); | 102 fragBuilder->codeAppendf("%s = vec4(1.0);", outColorSecondary); |
| 103 } | 103 } |
| 104 } else if (srcCoverage) { | 104 } else if (srcCoverage) { |
| 105 fragBuilder->codeAppendf("%s = %s * %s + (vec4(1.0) - %s) * %s;", | 105 fragBuilder->codeAppendf("%s = %s * %s + (vec4(1.0) - %s) * %s;", |
| 106 outColor, srcCoverage, outColor, srcCoverage, d
stColor); | 106 outColor, srcCoverage, outColor, srcCoverage, d
stColor); |
| 107 } | 107 } |
| 108 } | 108 } |
| OLD | NEW |