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
This commit is contained in:
jvanverth@google.com 2013-03-01 18:54:50 +00:00
parent 9b855c7c95
commit 9b98c1b7d0
2 changed files with 13 additions and 9 deletions

View File

@ -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);

View File

@ -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;
};