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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 | 270 |
271 void GrGLSweepGradient::emitCode(GrGLFPBuilder* builder, | 271 void GrGLSweepGradient::emitCode(GrGLFPBuilder* builder, |
272 const GrFragmentProcessor& fp, | 272 const GrFragmentProcessor& fp, |
273 const char* outputColor, | 273 const char* outputColor, |
274 const char* inputColor, | 274 const char* inputColor, |
275 const TransformedCoordsArray& coords, | 275 const TransformedCoordsArray& coords, |
276 const TextureSamplerArray& samplers) { | 276 const TextureSamplerArray& samplers) { |
277 const GrSweepGradient& ge = fp.cast<GrSweepGradient>(); | 277 const GrSweepGradient& ge = fp.cast<GrSweepGradient>(); |
278 this->emitUniforms(builder, ge); | 278 this->emitUniforms(builder, ge); |
279 SkString coords2D = builder->getFragmentShaderBuilder()->ensureFSCoords2D(co ords, 0); | 279 SkString coords2D = builder->getFragmentShaderBuilder()->ensureFSCoords2D(co ords, 0); |
280 const GrGLContextInfo ctxInfo = builder->ctxInfo(); | 280 const GrGLContextInfo& ctxInfo = builder->ctxInfo(); |
joshualitt
2015/05/22 17:29:47
lol
| |
281 SkString t; | 281 SkString t; |
282 // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi] | 282 // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi] |
283 // On Intel GPU there is an issue where it reads the second arguement to ata n "- %s.x" as an int | 283 // On Intel GPU there is an issue where it reads the second arguement to ata n "- %s.x" as an int |
284 // thus must us -1.0 * %s.x to work correctly | 284 // thus must us -1.0 * %s.x to work correctly |
285 if (kIntel_GrGLVendor != ctxInfo.vendor()){ | 285 if (kIntel_GrGLVendor != ctxInfo.vendor()){ |
286 t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", | 286 t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", |
287 coords2D.c_str(), coords2D.c_str()); | 287 coords2D.c_str(), coords2D.c_str()); |
288 } else { | 288 } else { |
289 t.printf("atan(- %s.y, -1.0 * %s.x) * 0.1591549430918 + 0.5", | 289 t.printf("atan(- %s.y, -1.0 * %s.x) * 0.1591549430918 + 0.5", |
290 coords2D.c_str(), coords2D.c_str()); | 290 coords2D.c_str(), coords2D.c_str()); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 str->appendScalar(fCenter.fX); | 337 str->appendScalar(fCenter.fX); |
338 str->append(", "); | 338 str->append(", "); |
339 str->appendScalar(fCenter.fY); | 339 str->appendScalar(fCenter.fY); |
340 str->append(") "); | 340 str->append(") "); |
341 | 341 |
342 this->INHERITED::toString(str); | 342 this->INHERITED::toString(str); |
343 | 343 |
344 str->append(")"); | 344 str->append(")"); |
345 } | 345 } |
346 #endif | 346 #endif |
OLD | NEW |