Extract GrDrawTarget::DrState into independent GrDrawState struct.
This is intended to be a first step towards making the stack of states
maintained by GrDrawTarget cheaper to maintain.



git-svn-id: http://skia.googlecode.com/svn/trunk@2544 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrGpuGLFixed.cpp b/src/gpu/GrGpuGLFixed.cpp
index 336b687..0c01f77 100644
--- a/src/gpu/GrGpuGLFixed.cpp
+++ b/src/gpu/GrGpuGLFixed.cpp
@@ -72,7 +72,7 @@
 
     GL_CALL(Disable(GR_GL_TEXTURE_2D));
 
-    for (int s = 0; s < kNumStages; ++s) {
+    for (int s = 0; s < GrDrawState::kNumStages; ++s) {
         setTextureUnit(s);
         GL_CALL(EnableClientState(GR_GL_VERTEX_ARRAY));
         GL_CALL(TexEnvi(GR_GL_TEXTURE_ENV,
@@ -150,9 +150,9 @@
 
 bool GrGpuGLFixed::flushGraphicsState(GrPrimitiveType type) {
 
-    bool usingTextures[kNumStages];
+    bool usingTextures[GrDrawState::kNumStages];
 
-    for (int s = 0; s < kNumStages; ++s) {
+    for (int s = 0; s < GrDrawState::kNumStages; ++s) {
         usingTextures[s] = this->isStageEnabled(s);
         if (usingTextures[s] && fCurrDrawState.fSamplerStates[s].isGradient()) {
             unimpl("Fixed pipe doesn't support radial/sweep gradients");
@@ -184,7 +184,7 @@
         flushProjectionMatrix();
     }
 
-    for (int s = 0; s < kNumStages; ++s) {
+    for (int s = 0; s < GrDrawState::kNumStages; ++s) {
         bool wasUsingTexture = StageWillBeUsed(s, fHWGeometryState.fVertexLayout, fHWDrawState);
         if (usingTextures[s] != wasUsingTexture) {
             setTextureUnit(s);
@@ -220,7 +220,7 @@
     }
 
     // set texture environment, decide whether we are modulating by RGB or A.
-    for (int s = 0; s < kNumStages; ++s) {
+    for (int s = 0; s < GrDrawState::kNumStages; ++s) {
         if (usingTextures[s]) {
             GrGLTexture* texture = (GrGLTexture*)fCurrDrawState.fTextures[s];
             if (NULL != texture) {
@@ -279,7 +279,7 @@
 
     int newColorOffset;
     int newCoverageOffset;
-    int newTexCoordOffsets[kNumStages];
+    int newTexCoordOffsets[GrDrawState::kNumStages];
     int newEdgeOffset;
 
     GrGLsizei newStride = VertexSizeAndOffsetsByStage(this->getGeomSrc().fVertexLayout,
@@ -292,7 +292,7 @@
 
     int oldColorOffset;
     int oldCoverageOffset;
-    int oldTexCoordOffsets[kNumStages];
+    int oldTexCoordOffsets[GrDrawState::kNumStages];
     int oldEdgeOffset;
     GrGLsizei oldStride = VertexSizeAndOffsetsByStage(fHWGeometryState.fVertexLayout,
                                                       oldTexCoordOffsets,
@@ -340,7 +340,7 @@
         fHWGeometryState.fVertexOffset = vertexOffset;
     }
 
-    for (int s = 0; s < kNumStages; ++s) {
+    for (int s = 0; s < GrDrawState::kNumStages; ++s) {
         // need to enable array if tex coord offset is 0
         // (using positions as coords)
         if (newTexCoordOffsets[s] >= 0) {