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

Unified Diff: src/effects/gradients/SkGradientShaderPriv.h

Issue 241173005: Get gradient information for gpu effect directly from SkGradientShader instead of calling asAGradie… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Minor change Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/gradients/SkGradientShader.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkGradientShaderPriv.h
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h
index 1d0f008917d42d974c393d3fb4c31dbd580d8572..69d584225f68df366efccd2b2a7b32f6b0162ac6 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -185,6 +185,19 @@ public:
kDitherStride16 = kCache16Count,
};
+ enum ColorType {
bsalomon 2014/04/17 20:43:40 Since this is a GPU notion in a non-GPU-specific c
+ kTwo_ColorType,
+ kThree_ColorType, // Symmetric three color
+ kTexture_ColorType
+ };
+
+ // Determines and returns the gradient is a two color gradient, three color gradient
bsalomon 2014/04/17 20:43:40 *symmetric* three color?
+ // or other (texture gradient). If it is two or three color, the colors array will
+ // also be filled with the gradient colors
+ ColorType getGradientColorType(SkColor colors[3]) const;
bsalomon 2014/04/17 20:43:40 getGpuColorType()?
+
+ uint32_t getGradientFlags() const { return fGradFlags; }
bsalomon 2014/04/17 20:43:40 getFlags()?
+
protected:
SkGradientShaderBase(SkReadBuffer& );
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
@@ -293,13 +306,7 @@ public:
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
- enum ColorType {
- kTwo_ColorType,
- kThree_ColorType,
- kTexture_ColorType
- };
-
- ColorType getColorType() const { return fColorType; }
+ SkGradientShaderBase::ColorType getColorType() const { return fColorType; }
enum PremulType {
kBeforeInterp_PremulType,
@@ -309,7 +316,7 @@ public:
PremulType getPremulType() const { return fPremulType; }
const SkColor* getColors(int pos) const {
- SkASSERT(fColorType != kTexture_ColorType);
+ SkASSERT(fColorType != SkGradientShaderBase::kTexture_ColorType);
SkASSERT((pos-1) <= fColorType);
return &fColors[pos];
}
@@ -336,18 +343,14 @@ protected:
private:
static const GrCoordSet kCoordSet = kLocal_GrCoordSet;
- enum {
- kMaxAnalyticColors = 3 // if more colors use texture
- };
-
GrCoordTransform fCoordTransform;
GrTextureAccess fTextureAccess;
SkScalar fYCoord;
GrTextureStripAtlas* fAtlas;
int fRow;
bool fIsOpaque;
- ColorType fColorType;
- SkColor fColors[kMaxAnalyticColors];
+ SkGradientShaderBase::ColorType fColorType;
+ SkColor fColors[3]; // More than 3 colors we use texture
PremulType fPremulType; // This only changes behavior for two and three color special cases.
// It is already baked into to the table for texture gradients.
typedef GrEffect INHERITED;
@@ -380,12 +383,12 @@ protected:
kBaseKeyBitCnt = (kPremulTypeKeyBitCnt + kColorKeyBitCnt)
};
- static GrGradientEffect::ColorType ColorTypeFromKey(EffectKey key){
+ static SkGradientShaderBase::ColorType ColorTypeFromKey(EffectKey key){
if (kTwoColorKey == (key & kColorKeyMask)) {
- return GrGradientEffect::kTwo_ColorType;
+ return SkGradientShaderBase::kTwo_ColorType;
} else if (kThreeColorKey == (key & kColorKeyMask)) {
- return GrGradientEffect::kThree_ColorType;
- } else {return GrGradientEffect::kTexture_ColorType;}
+ return SkGradientShaderBase::kThree_ColorType;
+ } else {return SkGradientShaderBase::kTexture_ColorType;}
}
static GrGradientEffect::PremulType PremulTypeFromKey(EffectKey key){
« no previous file with comments | « src/effects/gradients/SkGradientShader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698