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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 SkSourceGammaTreatment::kRespect)); | 205 SkSourceGammaTreatment::kRespect)); |
206 GrAlwaysAssert(fp); | 206 GrAlwaysAssert(fp); |
207 return fp; | 207 return fp; |
208 } | 208 } |
209 | 209 |
210 ///////////////////////////////////////////////////////////////////// | 210 ///////////////////////////////////////////////////////////////////// |
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->ensureCoords2D(args.fTransformedCoord
s[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()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |