OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkSweepGradient.h" | 8 #include "SkSweepGradient.h" |
9 | 9 |
10 static SkMatrix translate(SkScalar dx, SkScalar dy) { | 10 static SkMatrix translate(SkScalar dx, SkScalar dy) { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 211 |
212 void GrSweepGradient::GLSLSweepProcessor::emitCode(EmitArgs& args) { | 212 void GrSweepGradient::GLSLSweepProcessor::emitCode(EmitArgs& args) { |
213 const GrSweepGradient& ge = args.fFp.cast<GrSweepGradient>(); | 213 const GrSweepGradient& ge = args.fFp.cast<GrSweepGradient>(); |
214 this->emitUniforms(args.fUniformHandler, ge); | 214 this->emitUniforms(args.fUniformHandler, ge); |
215 SkString coords2D = args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0); | 215 SkString coords2D = args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0); |
216 SkString t; | 216 SkString t; |
217 // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi] | 217 // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi] |
218 // On Intel GPU there is an issue where it reads the second arguement to ata
n "- %s.x" as an int | 218 // On Intel GPU there is an issue where it reads the second arguement to ata
n "- %s.x" as an int |
219 // thus must us -1.0 * %s.x to work correctly | 219 // thus must us -1.0 * %s.x to work correctly |
220 if (args.fGLSLCaps->mustForceNegatedAtanParamToFloat()){ | 220 if (args.fGLSLCaps->mustForceNegatedAtanParamToFloat()){ |
221 t.printf("(atan(- %s.y, -1.0 * %s.x) * 0.1591549430918 + 0.5)", | 221 t.printf("atan(- %s.y, -1.0 * %s.x) * 0.1591549430918 + 0.5", |
222 coords2D.c_str(), coords2D.c_str()); | 222 coords2D.c_str(), coords2D.c_str()); |
223 } else { | 223 } else { |
224 t.printf("(atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5)", | 224 t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", |
225 coords2D.c_str(), coords2D.c_str()); | 225 coords2D.c_str(), coords2D.c_str()); |
226 } | 226 } |
227 this->emitColor(args.fFragBuilder, | 227 this->emitColor(args.fFragBuilder, |
228 args.fUniformHandler, | 228 args.fUniformHandler, |
229 args.fGLSLCaps, | 229 args.fGLSLCaps, |
230 ge, t.c_str(), | 230 ge, t.c_str(), |
231 args.fOutputColor, | 231 args.fOutputColor, |
232 args.fInputColor, | 232 args.fInputColor, |
233 args.fTexSamplers); | 233 args.fTexSamplers); |
234 } | 234 } |
(...skipping 29 matching lines...) Expand all Loading... |
264 str->appendScalar(fCenter.fX); | 264 str->appendScalar(fCenter.fX); |
265 str->append(", "); | 265 str->append(", "); |
266 str->appendScalar(fCenter.fY); | 266 str->appendScalar(fCenter.fY); |
267 str->append(") "); | 267 str->append(") "); |
268 | 268 |
269 this->INHERITED::toString(str); | 269 this->INHERITED::toString(str); |
270 | 270 |
271 str->append(")"); | 271 str->append(")"); |
272 } | 272 } |
273 #endif | 273 #endif |
OLD | NEW |