Remove GrDrawState::setTexture/getTexture
Review URL: http://codereview.appspot.com/6455051/
git-svn-id: http://skia.googlecode.com/svn/trunk@4826 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index 471ae1c..0d81019 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -52,20 +52,12 @@
GrDrawState()
: fRenderTarget(NULL) {
- for (int i = 0; i < kNumStages; ++i) {
- fTextures[i] = NULL;
- }
-
this->reset();
}
GrDrawState(const GrDrawState& state)
: fRenderTarget(NULL) {
- for (int i = 0; i < kNumStages; ++i) {
- fTextures[i] = NULL;
- }
-
*this = state;
}
@@ -109,8 +101,8 @@
// are tightly packed
GrAssert(this->memsetSize() + sizeof(fColor) + sizeof(fCoverage) +
sizeof(fFirstCoverageStage) + sizeof(fColorFilterMode) +
- sizeof(fSrcBlend) + sizeof(fDstBlend) + sizeof(fTextures) +
- sizeof(fRenderTarget) == this->podSize());
+ sizeof(fSrcBlend) + sizeof(fDstBlend) + sizeof(fRenderTarget) ==
+ this->podSize());
}
///////////////////////////////////////////////////////////////////////////
@@ -182,25 +174,7 @@
////
/**
- * Sets the texture used at the next drawing call
- *
- * @param stage The texture stage for which the texture will be set
- *
- * @param texture The texture to set. Can be NULL though there is no
- * advantage to settings a NULL texture if doing non-textured drawing
- *
- * @deprecated
- */
- void setTexture(int stage, GrTexture* texture) {
- GrAssert((unsigned)stage < kNumStages);
-
- GrSafeAssign(fTextures[stage], texture);
- }
-
- /**
* Creates a GrSingleTextureEffect.
- *
- * Replacement for setTexture.
*/
void createTextureEffect(int stage, GrTexture* texture) {
GrAssert(!this->getSampler(stage).getCustomStage());
@@ -208,38 +182,9 @@
SkNEW_ARGS(GrSingleTextureEffect, (texture)))->unref();
}
- /**
- * Retrieves the currently set texture.
- *
- * @return The currently set texture. The return value will be NULL if no
- * texture has been set, NULL was most recently passed to
- * setTexture, or the last setTexture was destroyed.
- */
- const GrTexture* getTexture(int stage) const {
- GrAssert((unsigned)stage < kNumStages);
- GrAssert(!this->getSampler(stage).getCustomStage() ||
- !fTextures[stage] ||
- fTextures[stage] == this->getSampler(stage).getCustomStage()->texture(0));
- if (this->getSampler(stage).getCustomStage()) {
- return this->getSampler(stage).getCustomStage()->texture(0);
- }
- return fTextures[stage];
- }
- GrTexture* getTexture(int stage) {
- GrAssert((unsigned)stage < kNumStages);
- GrAssert(!this->getSampler(stage).getCustomStage() ||
- !fTextures[stage] ||
- fTextures[stage] == this->getSampler(stage).getCustomStage()->texture(0));
- if (this->getSampler(stage).getCustomStage()) {
- return this->getSampler(stage).getCustomStage()->texture(0);
- }
- return fTextures[stage];
- }
-
bool stagesDisabled() {
for (int i = 0; i < kNumStages; ++i) {
- if (NULL != fTextures[i] ||
- NULL != fSamplerStates[i].getCustomStage()) {
+ if (NULL != fSamplerStates[i].getCustomStage()) {
return false;
}
}
@@ -247,7 +192,6 @@
}
void disableStage(int index) {
- GrSafeSetNull(fTextures[index]);
fSamplerStates[index].setCustomStage(NULL);
}
@@ -809,8 +753,7 @@
bool isStageEnabled(int s) const {
GrAssert((unsigned)s < kNumStages);
- return (NULL != fTextures[s]) ||
- (NULL != fSamplerStates[s].getCustomStage());
+ return (NULL != fSamplerStates[s].getCustomStage());
}
// Most stages are usually not used, so conditionals here
@@ -853,7 +796,6 @@
fViewMatrix = s.fViewMatrix;
for (int i = 0; i < kNumStages; i++) {
- SkSafeRef(fTextures[i]); // already copied by memcpy
if (s.isStageEnabled(i)) {
this->fSamplerStates[i] = s.fSamplerStates[i];
}
@@ -905,7 +847,6 @@
// @{ Initialized to values other than zero, but memcmp'ed in operator==
// and memcpy'ed in operator=.
- GrTexture* fTextures[kNumStages];
GrRenderTarget* fRenderTarget;
int fFirstCoverageStage;