Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Side by Side Diff: src/effects/gradients/SkSweepGradient.cpp

Issue 152233006: Bug Fix for Intel atan on gpu sweep gradient (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/gl/GrGLUtil.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 242
243 void GrGLSweepGradient::emitCode(GrGLShaderBuilder* builder, 243 void GrGLSweepGradient::emitCode(GrGLShaderBuilder* builder,
244 const GrDrawEffect&, 244 const GrDrawEffect&,
245 EffectKey key, 245 EffectKey key,
246 const char* outputColor, 246 const char* outputColor,
247 const char* inputColor, 247 const char* inputColor,
248 const TransformedCoordsArray& coords, 248 const TransformedCoordsArray& coords,
249 const TextureSamplerArray& samplers) { 249 const TextureSamplerArray& samplers) {
250 this->emitUniforms(builder, key); 250 this->emitUniforms(builder, key);
251 SkString coords2D = builder->ensureFSCoords2D(coords, 0); 251 SkString coords2D = builder->ensureFSCoords2D(coords, 0);
252 const GrGLContextInfo ctxInfo = builder->ctxInfo();
252 SkString t; 253 SkString t;
253 t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", coords2D.c_str(), c oords2D.c_str()); 254 // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi]
255 // On Intel GPU there is an issue where it reads the second arguement to ata n "- %s.x" as an int
256 // thus must us -1.0 * %s.x to work correctly
257 if (kIntel_GrGLVendor != ctxInfo.vendor()){
258 t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5",
259 coords2D.c_str(), coords2D.c_str());
260 } else {
261 t.printf("atan(- %s.y, -1.0 * %s.x) * 0.1591549430918 + 0.5",
262 coords2D.c_str(), coords2D.c_str());
263 }
254 this->emitColor(builder, t.c_str(), key, 264 this->emitColor(builder, t.c_str(), key,
255 outputColor, inputColor, samplers); 265 outputColor, inputColor, samplers);
256 } 266 }
257 267
258 ///////////////////////////////////////////////////////////////////// 268 /////////////////////////////////////////////////////////////////////
259 269
260 GrEffectRef* SkSweepGradient::asNewEffect(GrContext* context, const SkPaint&) co nst { 270 GrEffectRef* SkSweepGradient::asNewEffect(GrContext* context, const SkPaint&) co nst {
261 SkMatrix matrix; 271 SkMatrix matrix;
262 if (!this->getLocalMatrix().invert(&matrix)) { 272 if (!this->getLocalMatrix().invert(&matrix)) {
263 return NULL; 273 return NULL;
(...skipping 19 matching lines...) Expand all
283 str->appendScalar(fCenter.fX); 293 str->appendScalar(fCenter.fX);
284 str->append(", "); 294 str->append(", ");
285 str->appendScalar(fCenter.fY); 295 str->appendScalar(fCenter.fY);
286 str->append(") "); 296 str->append(") ");
287 297
288 this->INHERITED::toString(str); 298 this->INHERITED::toString(str);
289 299
290 str->append(")"); 300 str->append(")");
291 } 301 }
292 #endif 302 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/gl/GrGLUtil.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698