Refactor OpenGLRenderer to simplify OpenGL drawing code.

This is the first step of the refactoring:
- drawColorRect
- drawTextureMesh

Remaining methods to refactor:
- setupTextureAlpha8
- drawPath
- setupShadow
- drawText
- drawLines
- composeLayerRegion

Change-Id: I0fced6a05b6b6eee10ee7cef0c3fbdaa6cefab20
diff --git a/libs/hwui/ProgramCache.h b/libs/hwui/ProgramCache.h
index fc3e248..3acd18a 100644
--- a/libs/hwui/ProgramCache.h
+++ b/libs/hwui/ProgramCache.h
@@ -102,14 +102,8 @@
         kGradientSweep
     };
 
-    ProgramDescription():
-        hasTexture(false), hasAlpha8Texture(false), modulate(false),
-        hasBitmap(false), isBitmapNpot(false), hasGradient(false),
-        gradientType(kGradientLinear),
-        shadersMode(SkXfermode::kClear_Mode), isBitmapFirst(false),
-        bitmapWrapS(GL_CLAMP_TO_EDGE), bitmapWrapT(GL_CLAMP_TO_EDGE),
-        colorOp(kColorNone), colorMode(SkXfermode::kClear_Mode),
-        framebufferMode(SkXfermode::kClear_Mode), swapSrcDst(false) {
+    ProgramDescription() {
+        reset();
     }
 
     // Texturing
@@ -142,6 +136,35 @@
     bool swapSrcDst;
 
     /**
+     * Resets this description. All fields are reset back to the default
+     * values they hold after building a new instance.
+     */
+    void reset() {
+        hasTexture = false;
+        hasAlpha8Texture = false;
+
+        modulate = false;
+
+        hasBitmap = false;
+        isBitmapNpot = false;
+
+        hasGradient = false;
+        gradientType = kGradientLinear;
+
+        shadersMode = SkXfermode::kClear_Mode;
+
+        isBitmapFirst = false;
+        bitmapWrapS = GL_CLAMP_TO_EDGE;
+        bitmapWrapT = GL_CLAMP_TO_EDGE;
+
+        colorOp = kColorNone;
+        colorMode = SkXfermode::kClear_Mode;
+
+        framebufferMode = SkXfermode::kClear_Mode;
+        swapSrcDst = false;
+    }
+
+    /**
      * Indicates, for a given color, whether color modulation is required in
      * the fragment shader. When this method returns true, the program should
      * be provided with a modulation color.