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

Side by Side Diff: src/effects/gradients/SkGradientShaderPriv.h

Issue 2221133002: Refactor various gradient effect classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
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 #ifndef SkGradientShaderPriv_DEFINED 8 #ifndef SkGradientShaderPriv_DEFINED
9 #define SkGradientShaderPriv_DEFINED 9 #define SkGradientShaderPriv_DEFINED
10 10
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 * SweepGradient 319 * SweepGradient
320 * The angle from the origin of texture coordinates in post-matrix space 320 * The angle from the origin of texture coordinates in post-matrix space
321 * determines the gradient value. 321 * determines the gradient value.
322 */ 322 */
323 323
324 class GrTextureStripAtlas; 324 class GrTextureStripAtlas;
325 325
326 // Base class for Gr gradient effects 326 // Base class for Gr gradient effects
327 class GrGradientEffect : public GrFragmentProcessor { 327 class GrGradientEffect : public GrFragmentProcessor {
328 public: 328 public:
329 class GLSLProcessor;
329 330
330 GrGradientEffect(GrContext* ctx, 331 GrGradientEffect(GrContext* ctx,
331 const SkGradientShaderBase& shader, 332 const SkGradientShaderBase& shader,
332 const SkMatrix& matrix, 333 const SkMatrix& matrix,
333 SkShader::TileMode tileMode); 334 SkShader::TileMode tileMode);
334 335
335 virtual ~GrGradientEffect(); 336 virtual ~GrGradientEffect();
336 337
337 bool useAtlas() const { return SkToBool(-1 != fRow); } 338 bool useAtlas() const { return SkToBool(-1 != fRow); }
338 SkScalar getYCoord() const { return fYCoord; }; 339 SkScalar getYCoord() const { return fYCoord; };
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 SkGradientShaderBase::GpuColorType fColorType; 386 SkGradientShaderBase::GpuColorType fColorType;
386 SkColor fColors[3]; // More than 3 colors we use texture 387 SkColor fColors[3]; // More than 3 colors we use texture
387 PremulType fPremulType; // This only changes behavior for two and three colo r special cases. 388 PremulType fPremulType; // This only changes behavior for two and three colo r special cases.
388 // It is already baked into to the table for texture gradients. 389 // It is already baked into to the table for texture gradients.
389 typedef GrFragmentProcessor INHERITED; 390 typedef GrFragmentProcessor INHERITED;
390 391
391 }; 392 };
392 393
393 /////////////////////////////////////////////////////////////////////////////// 394 ///////////////////////////////////////////////////////////////////////////////
394 395
395 // Base class for GL gradient effects 396 // Base class for GL gradient effects
bsalomon 2016/08/09 13:47:05 Can you change GL in the comment to GLSL?
396 class GrGLGradientEffect : public GrGLSLFragmentProcessor { 397 class GrGradientEffect::GLSLProcessor : public GrGLSLFragmentProcessor {
397 public: 398 public:
398 GrGLGradientEffect(); 399 GLSLProcessor();
399 400
400 protected: 401 protected:
401 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override ; 402 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override ;
402 403
403 protected: 404 protected:
404 /** 405 /**
405 * Subclasses must call this. It will return a key for the part of the shade r code controlled 406 * Subclasses must call this. It will return a key for the part of the shade r code controlled
406 * by the base class. The subclasses must stick it in their key and then pas s it to the below 407 * by the base class. The subclasses must stick it in their key and then pas s it to the below
407 * emit* functions from their emitCode function. 408 * emit* functions from their emitCode function.
408 */ 409 */
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 GrGLSLProgramDataManager::UniformHandle fColorStartUni; 441 GrGLSLProgramDataManager::UniformHandle fColorStartUni;
441 GrGLSLProgramDataManager::UniformHandle fColorMidUni; 442 GrGLSLProgramDataManager::UniformHandle fColorMidUni;
442 GrGLSLProgramDataManager::UniformHandle fColorEndUni; 443 GrGLSLProgramDataManager::UniformHandle fColorEndUni;
443 444
444 typedef GrGLSLFragmentProcessor INHERITED; 445 typedef GrGLSLFragmentProcessor INHERITED;
445 }; 446 };
446 447
447 #endif 448 #endif
448 449
449 #endif 450 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698