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

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

Issue 15733007: use Descriptor struct to encapsulate all the common paramaeters between our various gradient types.… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 static const TileProc gTileProcs[] = { 75 static const TileProc gTileProcs[] = {
76 clamp_tileproc, 76 clamp_tileproc,
77 repeat_tileproc, 77 repeat_tileproc,
78 mirror_tileproc 78 mirror_tileproc
79 }; 79 };
80 80
81 /////////////////////////////////////////////////////////////////////////////// 81 ///////////////////////////////////////////////////////////////////////////////
82 82
83 class SkGradientShaderBase : public SkShader { 83 class SkGradientShaderBase : public SkShader {
84 public: 84 public:
85 SkGradientShaderBase(const SkColor colors[], const SkScalar pos[], 85 struct Descriptor {
86 int colorCount, SkShader::TileMode mode, SkUnitMapper* mapper); 86 Descriptor() {
87 sk_bzero(this, sizeof(*this));
88 fTileMode = SkShader::kClamp_TileMode;
89 }
90
91 const SkColor* fColors;
92 const SkScalar* fPos;
93 int fCount;
94 SkShader::TileMode fTileMode;
95 SkUnitMapper* fMapper;
96 };
97
98 public:
99 SkGradientShaderBase(const Descriptor& desc);
87 virtual ~SkGradientShaderBase(); 100 virtual ~SkGradientShaderBase();
88 101
89 virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK _OVERRIDE; 102 virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK _OVERRIDE;
90 virtual uint32_t getFlags() SK_OVERRIDE { return fFlags; } 103 virtual uint32_t getFlags() SK_OVERRIDE { return fFlags; }
91 virtual bool isOpaque() const SK_OVERRIDE; 104 virtual bool isOpaque() const SK_OVERRIDE;
92 105
93 void getGradientTableBitmap(SkBitmap*) const; 106 void getGradientTableBitmap(SkBitmap*) const;
94 107
95 enum { 108 enum {
96 /// Seems like enough for visual accuracy. TODO: if pos[] deserves 109 /// Seems like enough for visual accuracy. TODO: if pos[] deserves
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 SkScalar fCachedYCoord; 338 SkScalar fCachedYCoord;
326 GrGLUniformManager::UniformHandle fFSYUni; 339 GrGLUniformManager::UniformHandle fFSYUni;
327 GrGLEffectMatrix fEffectMatrix; 340 GrGLEffectMatrix fEffectMatrix;
328 341
329 typedef GrGLEffect INHERITED; 342 typedef GrGLEffect INHERITED;
330 }; 343 };
331 344
332 #endif 345 #endif
333 346
334 #endif 347 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698