aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar jvanverth@google.com <jvanverth@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-01 18:54:50 +0000
committerGravatar jvanverth@google.com <jvanverth@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-01 18:54:50 +0000
commit9b98c1b7d099249384782807731dd5f8256f3f60 (patch)
tree0ac8576514d6fe7ae92f3b1c39bb2d10783dc85c /src/gpu
parent9b855c7c95ce9fff7a447e4a6bdf8a469c1f3097 (diff)
Make global static variable kVertexAttribs in GrAARectRenderer local to functions.
Chrome was choking on this static variable because it's global and initialized using a constructor. Moved it inside the two functions that use it, so it's no longer global. In addition, made the constructors for GrVertexAttrib inline so hopefully they will be optimized away. git-svn-id: http://skia.googlecode.com/svn/trunk@7930 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrAARectRenderer.cpp16
-rw-r--r--src/gpu/GrDrawState.h6
2 files changed, 13 insertions, 9 deletions
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index 741b83d080..9bf61958dd 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -30,12 +30,6 @@ static void set_inset_fan(GrPoint* pts, size_t stride,
r.fRight - dx, r.fBottom - dy, stride);
}
-// position + color/coverage
-static const GrVertexAttrib kVertexAttribs[] = {
- GrVertexAttrib(kVec2f_GrVertexAttribType, 0),
- GrVertexAttrib(kVec4ub_GrVertexAttribType, sizeof(GrPoint))
-};
-
};
void GrAARectRenderer::reset() {
@@ -134,6 +128,11 @@ void GrAARectRenderer::fillAARect(GrGpu* gpu,
bool useVertexCoverage) {
GrDrawState* drawState = target->drawState();
+ // position + color/coverage
+ static const GrVertexAttrib kVertexAttribs[] = {
+ GrVertexAttrib(kVec2f_GrVertexAttribType, 0),
+ GrVertexAttrib(kVec4ub_GrVertexAttribType, sizeof(GrPoint))
+ };
GrAttribBindings bindings;
GrDrawState::AttribIndex attribIndex;
aa_rect_attributes(useVertexCoverage, &bindings, &attribIndex);
@@ -213,6 +212,11 @@ void GrAARectRenderer::strokeAARect(GrGpu* gpu,
return;
}
+ // position + color/coverage
+ static const GrVertexAttrib kVertexAttribs[] = {
+ GrVertexAttrib(kVec2f_GrVertexAttribType, 0),
+ GrVertexAttrib(kVec4ub_GrVertexAttribType, sizeof(GrPoint))
+ };
GrAttribBindings bindings;
GrDrawState::AttribIndex attribIndex;
aa_rect_attributes(useVertexCoverage, &bindings, &attribIndex);
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index 53c575d3af..b4d130648b 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -38,9 +38,9 @@ enum GrVertexAttribType {
static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1;
struct GrVertexAttrib {
- GrVertexAttrib() {}
- GrVertexAttrib(GrVertexAttribType type, size_t offset) :
- fType(type), fOffset(offset) {}
+ inline GrVertexAttrib() {}
+ inline GrVertexAttrib(GrVertexAttribType type, size_t offset) :
+ fType(type), fOffset(offset) {}
bool operator==(const GrVertexAttrib& other) const {
return fType == other.fType && fOffset == other.fOffset;
};