diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-07-26 19:39:06 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-07-26 19:39:06 +0000 |
commit | 1c31f633232df572f89a3bc1b0fee3e46d22cb5b (patch) | |
tree | a2e615f86b0a4c53009f60fc9a27b5c6b79d012e /include/gpu/GrPaint.h | |
parent | ea5488b9655fc7d71345c3a823de85f8b74e3279 (diff) |
Remove texture/mask setters on GrPaint
Review URL: http://codereview.appspot.com/6446052/
git-svn-id: http://skia.googlecode.com/svn/trunk@4790 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/gpu/GrPaint.h')
-rw-r--r-- | include/gpu/GrPaint.h | 67 |
1 files changed, 4 insertions, 63 deletions
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h index f1dd2021a1..90bd9a7c73 100644 --- a/include/gpu/GrPaint.h +++ b/include/gpu/GrPaint.h @@ -42,21 +42,6 @@ public: SkXfermode::Mode fColorFilterXfermode; float fColorMatrix[20]; - void setTexture(int i, GrTexture* texture) { - GrAssert((unsigned)i < kMaxTextures); - GrSafeRef(texture); - GrSafeUnref(fTextures[i]); - fTextures[i] = texture; - } - - GrTexture* getTexture(int i) const { - GrAssert((unsigned)i < kMaxTextures); - //if (this->getTextureSampler(i).getCustomStage()) { - //return this->getTextureSampler(i).getCustomStage()->texture(i); - //} - return fTextures[i]; - } - GrSamplerState* textureSampler(int i) { GrAssert((unsigned)i < kMaxTextures); return fTextureSamplers + i; @@ -69,26 +54,9 @@ public: bool isTextureStageEnabled(int i) const { GrAssert((unsigned)i < kMaxTextures); - return (NULL != fTextures[i]) || - (NULL != fTextureSamplers[i].getCustomStage()); - } - - // The mask can be alpha-only or per channel. It is applied - // after the colorfilter - void setMask(int i, GrTexture* mask) { - GrAssert((unsigned)i < kMaxMasks); - GrSafeRef(mask); - GrSafeUnref(fMaskTextures[i]); - fMaskTextures[i] = mask; + return (NULL != fTextureSamplers[i].getCustomStage()); } - GrTexture* getMask(int i) const { - GrAssert((unsigned)i < kMaxMasks); - //if (this->getMaskSampler(i).getCustomStage()) { - //return this->getMaskSampler(i).getCustomStage()->texture(i); - //} - return fMaskTextures[i]; - } // mask's sampler matrix is always applied to the positions // (i.e. no explicit texture coordinates) @@ -104,8 +72,7 @@ public: bool isMaskStageEnabled(int i) const { GrAssert((unsigned)i < kMaxTextures); - return (NULL != fMaskTextures[i]) || - (NULL != fMaskSamplers[i].getCustomStage()); + return (NULL != fMaskSamplers[i].getCustomStage()); } bool hasMask() const { @@ -161,24 +128,14 @@ public: // uninitialized GrPaint() { - for (int i = 0; i < kMaxTextures; ++i) { - fTextures[i] = NULL; - } - for (int i = 0; i < kMaxMasks; ++i) { - fMaskTextures[i] = NULL; - } } GrPaint(const GrPaint& paint) { - for (int i = 0; i < kMaxTextures; ++i) { - fTextures[i] = NULL; - } - for (int i = 0; i < kMaxMasks; ++i) { - fMaskTextures[i] = NULL; - } *this = paint; } + ~GrPaint() {} + GrPaint& operator=(const GrPaint& paint) { fSrcBlendCoeff = paint.fSrcBlendCoeff; fDstBlendCoeff = paint.fDstBlendCoeff; @@ -196,13 +153,11 @@ public: } for (int i = 0; i < kMaxTextures; ++i) { - GrSafeAssign(fTextures[i], paint.fTextures[i]); if (paint.isTextureStageEnabled(i)) { fTextureSamplers[i] = paint.fTextureSamplers[i]; } } for (int i = 0; i < kMaxMasks; ++i) { - GrSafeAssign(fMaskTextures[i], paint.fMaskTextures[i]); if (paint.isMaskStageEnabled(i)) { fMaskSamplers[i] = paint.fMaskSamplers[i]; } @@ -210,15 +165,6 @@ public: return *this; } - ~GrPaint() { - for (int i = 0; i < kMaxTextures; ++i) { - GrSafeUnref(fTextures[i]); - } - for (int i = 0; i < kMaxMasks; ++i) { - GrSafeUnref(fMaskTextures[i]); - } - } - // sets paint to src-over, solid white, no texture, no mask void reset() { this->resetBlend(); @@ -250,9 +196,6 @@ private: GrSamplerState fTextureSamplers[kMaxTextures]; GrSamplerState fMaskSamplers[kMaxMasks]; - GrTexture* fTextures[kMaxTextures]; - GrTexture* fMaskTextures[kMaxMasks]; - void resetBlend() { fSrcBlendCoeff = kOne_GrBlendCoeff; fDstBlendCoeff = kZero_GrBlendCoeff; @@ -273,14 +216,12 @@ private: void resetTextures() { for (int i = 0; i < kMaxTextures; ++i) { - this->setTexture(i, NULL); fTextureSamplers[i].reset(); } } void resetMasks() { for (int i = 0; i < kMaxMasks; ++i) { - this->setMask(i, NULL); fMaskSamplers[i].reset(); } } |