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

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

Issue 1457543003: Add ShaderBuilders to EmitArgs and remove gettings from ProgBuilder. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 NULL, kNone_SkFi lterQuality); 241 NULL, kNone_SkFi lterQuality);
242 GrAlwaysAssert(fp); 242 GrAlwaysAssert(fp);
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.fFragBuilder->ensureFSCoords2D(args.fCoords, 0);
252 ->ensureFSCoords2D(args.fCoords, 0);
253 SkString t; 252 SkString t;
254 // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi] 253 // 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 254 // 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 255 // thus must us -1.0 * %s.x to work correctly
257 if (args.fBuilder->glslCaps()->mustForceNegatedAtanParamToFloat()){ 256 if (args.fBuilder->glslCaps()->mustForceNegatedAtanParamToFloat()){
258 t.printf("atan(- %s.y, -1.0 * %s.x) * 0.1591549430918 + 0.5", 257 t.printf("atan(- %s.y, -1.0 * %s.x) * 0.1591549430918 + 0.5",
259 coords2D.c_str(), coords2D.c_str()); 258 coords2D.c_str(), coords2D.c_str());
260 } else { 259 } else {
261 t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", 260 t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5",
262 coords2D.c_str(), coords2D.c_str()); 261 coords2D.c_str(), coords2D.c_str());
263 } 262 }
264 this->emitColor(args.fBuilder, ge, t.c_str(), args.fOutputColor, args.fInput Color, 263 this->emitColor(args.fBuilder,
264 args.fFragBuilder,
265 ge, t.c_str(),
266 args.fOutputColor,
267 args.fInputColor,
265 args.fSamplers); 268 args.fSamplers);
266 } 269 }
267 270
268 ///////////////////////////////////////////////////////////////////// 271 /////////////////////////////////////////////////////////////////////
269 272
270 const GrFragmentProcessor* SkSweepGradient::asFragmentProcessor( 273 const GrFragmentProcessor* SkSweepGradient::asFragmentProcessor(
271 GrContext* context, 274 GrContext* context,
272 const SkMatrix& viewM, 275 const SkMatrix& viewM,
273 const SkMatrix* localMatrix, 276 const SkMatrix* localMatrix,
274 SkFilterQuality) const { 277 SkFilterQuality) const {
(...skipping 26 matching lines...) Expand all
301 str->appendScalar(fCenter.fX); 304 str->appendScalar(fCenter.fX);
302 str->append(", "); 305 str->append(", ");
303 str->appendScalar(fCenter.fY); 306 str->appendScalar(fCenter.fY);
304 str->append(") "); 307 str->append(") ");
305 308
306 this->INHERITED::toString(str); 309 this->INHERITED::toString(str);
307 310
308 str->append(")"); 311 str->append(")");
309 } 312 }
310 #endif 313 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkRadialGradient.cpp ('k') | src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698