Some refactoring of GrCustomStage and friends
Review URL: http://codereview.appspot.com/6209071/
git-svn-id: http://skia.googlecode.com/svn/trunk@4003 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index e576163..755a2f8 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -629,10 +629,10 @@
}
if (NULL != customStages[s]) {
- GrProgramStageFactory* factory =
+ const GrProgramStageFactory& factory =
customStages[s]->getFactory();
programData->fCustomStage[s] =
- factory->createGLInstance(customStages[s]);
+ factory.createGLInstance(customStages[s]);
}
this->genStageCode(gl,
s,
@@ -755,10 +755,10 @@
}
if (NULL != customStages[s]) {
- GrProgramStageFactory* factory =
+ const GrProgramStageFactory& factory =
customStages[s]->getFactory();
programData->fCustomStage[s] =
- factory->createGLInstance(customStages[s]);
+ factory.createGLInstance(customStages[s]);
}
this->genStageCode(gl, s,
fProgramDesc.fStages[s],
diff --git a/src/gpu/gl/GrGLProgramStage.cpp b/src/gpu/gl/GrGLProgramStage.cpp
index 06c4d93..28a711d 100644
--- a/src/gpu/gl/GrGLProgramStage.cpp
+++ b/src/gpu/gl/GrGLProgramStage.cpp
@@ -25,7 +25,7 @@
}
-void GrGLProgramStage::setData(const GrGLInterface*, GrCustomStage*,
+void GrGLProgramStage::setData(const GrGLInterface*, const GrCustomStage*,
const GrGLTexture*) {
}
diff --git a/src/gpu/gl/GrGLProgramStage.h b/src/gpu/gl/GrGLProgramStage.h
index 61e62e5..2141640 100644
--- a/src/gpu/gl/GrGLProgramStage.h
+++ b/src/gpu/gl/GrGLProgramStage.h
@@ -9,12 +9,12 @@
#define GrGLCustomStage_DEFINED
#include "GrAllocator.h"
+#include "GrCustomStage.h"
#include "GrGLShaderBuilder.h"
#include "GrGLShaderVar.h"
#include "GrGLSL.h"
#include "GrStringBuilder.h"
-class GrCustomStage;
struct GrGLInterface;
class GrGLTexture;
@@ -31,6 +31,7 @@
class GrGLProgramStage {
public:
+ typedef GrCustomStage::StageKey StageKey ;
// TODO: redundant with GrGLProgram.cpp
enum {
kUnusedUniform = -1,
@@ -90,7 +91,7 @@
are to be read.
TODO: since we don't have a factory, we can't assert to enforce
this. Shouldn't we? */
- virtual void setData(const GrGLInterface*, GrCustomStage*,
+ virtual void setData(const GrGLInterface*, const GrCustomStage*,
const GrGLTexture*);
// TODO: needs a better name
diff --git a/src/gpu/gl/GrGpuGLShaders.cpp b/src/gpu/gl/GrGpuGLShaders.cpp
index d32c57e..08cfaf7 100644
--- a/src/gpu/gl/GrGpuGLShaders.cpp
+++ b/src/gpu/gl/GrGpuGLShaders.cpp
@@ -302,7 +302,7 @@
(GrSamplerState::FilterDirection)direction,
stage.fKernelWidth, kernel);
stage.fCustomStageKey =
- customStages[s]->getFactory()->stageKey(customStages[s]);
+ customStages[s]->getFactory().stageKey(customStages[s]);
}
}
CachedData cachedData;
@@ -933,8 +933,8 @@
GrGLProgram* program, int index) {
GrCustomStage* customStage = sampler.getCustomStage();
if (customStage) {
- GrProgramStageFactory* factory = customStage->getFactory();
- stage->fCustomStageKey = factory->stageKey(customStage);
+ const GrProgramStageFactory& factory = customStage->getFactory();
+ stage->fCustomStageKey = factory.stageKey(customStage);
customStages[index] = customStage;
} else {
stage->fCustomStageKey = 0;