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

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

Issue 1416423003: Make GrGLSLProgramBuilder base class for ProgramBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit Created 5 years, 1 month 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 | « src/effects/gradients/SkGradientShaderPriv.h ('k') | src/gpu/GrDefaultGeoProcFactory.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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « src/effects/gradients/SkGradientShaderPriv.h ('k') | src/gpu/GrDefaultGeoProcFactory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698