Fix per-vertex coverage on Macs with aligned attrib bug

Review URL: http://codereview.appspot.com/5250067



git-svn-id: http://skia.googlecode.com/svn/trunk@2458 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrContext.cpp b/gpu/src/GrContext.cpp
index 93a0a88..5921838 100644
--- a/gpu/src/GrContext.cpp
+++ b/gpu/src/GrContext.cpp
@@ -1059,7 +1059,7 @@
 
     GrColor innerColor;
     if (useVertexCoverage) {
-        innerColor = GrColorPackRGBA(0,0,0,0xff);
+        innerColor = 0xffffffff;
     } else {
         innerColor = target->getColor();
     }
@@ -1130,7 +1130,7 @@
 
     GrColor innerColor;
     if (useVertexCoverage) {
-        innerColor = GrColorPackRGBA(0,0,0,0xff);
+        innerColor = 0xffffffff;
     } else {
         innerColor = target->getColor();
     }
diff --git a/gpu/src/GrDrawTarget.h b/gpu/src/GrDrawTarget.h
index 86aa3b4..e411338 100644
--- a/gpu/src/GrDrawTarget.h
+++ b/gpu/src/GrDrawTarget.h
@@ -679,12 +679,18 @@
     enum VertexLayoutBits {
         /* vertices have colors (GrColor) */
         kColor_VertexLayoutBit              = 1 << (STAGE_BIT_CNT + 0),
-        /* vertices have coverage (GrColor where only the alpha chan is used */
+        /* vertices have coverage (GrColor where all channels should have the 
+         * same value)
+         */
         kCoverage_VertexLayoutBit           = 1 << (STAGE_BIT_CNT + 1),
         /* Use text vertices. (Pos and tex coords may be a different type for
-           text [GrGpuTextVertex vs GrPoint].) */
+         * text [GrGpuTextVertex vs GrPoint].)
+         */
         kTextFormat_VertexLayoutBit         = 1 << (STAGE_BIT_CNT + 2),
 
+        /* Each vertex specificies an edge. Distance to the edge is used to
+         * compute a coverage. See setVertexEdgeType().
+         */
         kEdge_VertexLayoutBit               = 1 << (STAGE_BIT_CNT + 3),
         // for below assert
         kDummyVertexLayoutBit,
diff --git a/gpu/src/GrGpuGLShaders.cpp b/gpu/src/GrGpuGLShaders.cpp
index 3ca4346..9c0c9cc 100644
--- a/gpu/src/GrGpuGLShaders.cpp
+++ b/gpu/src/GrGpuGLShaders.cpp
@@ -802,9 +802,8 @@
     }
 
     if (newCoverageOffset > 0) {
-        // bind just alpha channel.
-        GrGLvoid* coverageOffset = (int8_t*)(vertexOffset + newCoverageOffset +
-                                             GrColor_INDEX_A);
+        // bind a single channel, they should all have the same value.
+        GrGLvoid* coverageOffset = (int8_t*)(vertexOffset + newCoverageOffset);
         int idx = GrGLProgram::CoverageAttributeIdx();
         if (oldCoverageOffset <= 0) {
             GL_CALL(EnableVertexAttribArray(idx));