OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkSweepGradient.h" | 9 #include "SkSweepGradient.h" |
10 | 10 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 return fp; | 243 return fp; |
244 } | 244 } |
245 | 245 |
246 ///////////////////////////////////////////////////////////////////// | 246 ///////////////////////////////////////////////////////////////////// |
247 | 247 |
248 void GrGLSweepGradient::emitCode(EmitArgs& args) { | 248 void GrGLSweepGradient::emitCode(EmitArgs& args) { |
249 const GrSweepGradient& ge = args.fFp.cast<GrSweepGradient>(); | 249 const GrSweepGradient& ge = args.fFp.cast<GrSweepGradient>(); |
250 this->emitUniforms(args.fBuilder, ge); | 250 this->emitUniforms(args.fBuilder, ge); |
251 SkString coords2D = args.fBuilder->getFragmentShaderBuilder() | 251 SkString coords2D = args.fBuilder->getFragmentShaderBuilder() |
252 ->ensureFSCoords2D(args.fCoords, 0); | 252 ->ensureFSCoords2D(args.fCoords, 0); |
253 const GrGLContextInfo& ctxInfo = args.fBuilder->ctxInfo(); | |
254 SkString t; | 253 SkString t; |
255 // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi] | 254 // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi] |
256 // On Intel GPU there is an issue where it reads the second arguement to ata
n "- %s.x" as an int | 255 // On Intel GPU there is an issue where it reads the second arguement to ata
n "- %s.x" as an int |
257 // thus must us -1.0 * %s.x to work correctly | 256 // thus must us -1.0 * %s.x to work correctly |
258 if (kIntel_GrGLVendor != ctxInfo.vendor()){ | 257 if (args.fBuilder->glslCaps()->mustForceNegatedAtanParamToFloat()){ |
259 t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", | 258 t.printf("atan(- %s.y, -1.0 * %s.x) * 0.1591549430918 + 0.5", |
260 coords2D.c_str(), coords2D.c_str()); | 259 coords2D.c_str(), coords2D.c_str()); |
261 } else { | 260 } else { |
262 t.printf("atan(- %s.y, -1.0 * %s.x) * 0.1591549430918 + 0.5", | 261 t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", |
263 coords2D.c_str(), coords2D.c_str()); | 262 coords2D.c_str(), coords2D.c_str()); |
264 } | 263 } |
265 this->emitColor(args.fBuilder, ge, t.c_str(), args.fOutputColor, args.fInput
Color, | 264 this->emitColor(args.fBuilder, ge, t.c_str(), args.fOutputColor, args.fInput
Color, |
266 args.fSamplers); | 265 args.fSamplers); |
267 } | 266 } |
268 | 267 |
269 ///////////////////////////////////////////////////////////////////// | 268 ///////////////////////////////////////////////////////////////////// |
270 | 269 |
271 const GrFragmentProcessor* SkSweepGradient::asFragmentProcessor( | 270 const GrFragmentProcessor* SkSweepGradient::asFragmentProcessor( |
272 GrContext* context, | 271 GrContext* context, |
(...skipping 29 matching lines...) Expand all Loading... |
302 str->appendScalar(fCenter.fX); | 301 str->appendScalar(fCenter.fX); |
303 str->append(", "); | 302 str->append(", "); |
304 str->appendScalar(fCenter.fY); | 303 str->appendScalar(fCenter.fY); |
305 str->append(") "); | 304 str->append(") "); |
306 | 305 |
307 this->INHERITED::toString(str); | 306 this->INHERITED::toString(str); |
308 | 307 |
309 str->append(")"); | 308 str->append(")"); |
310 } | 309 } |
311 #endif | 310 #endif |
OLD | NEW |