diff --git a/include/core/SkString.h b/include/core/SkString.h index 4366630ef2..db32dcab39 100644 --- a/include/core/SkString.h +++ b/include/core/SkString.h @@ -51,7 +51,7 @@ static bool SkStrContains(const char string[], const char subchar) { static inline char *SkStrDup(const char string[]) { char *ret = (char *) sk_malloc_throw(strlen(string)+1); - memcpy(ret,string,strlen(string)); + memcpy(ret,string,strlen(string)+1); return ret; } diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index 60bae63feb..5c88441615 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -202,8 +202,12 @@ void GrGLProgram::BuildDesc(const GrDrawState& drawState, } else { desc->fCoverageAttributeIndex = GrDrawState::kCoverageOverrideAttribIndexValue; } - desc->fEdgeAttributeIndex = drawState.getAttribIndex(GrDrawState::kEdge_AttribIndex); - desc->fTexCoordAttributeIndex = drawState.getAttribIndex(GrDrawState::kTexCoord_AttribIndex); + if (desc->fAttribBindings & GrDrawState::kEdge_AttribBindingsBit) { + desc->fEdgeAttributeIndex = drawState.getAttribIndex(GrDrawState::kEdge_AttribIndex); + } + if (GrDrawState::AttributesBindExplicitTexCoords(desc->fAttribBindings)) { + desc->fTexCoordAttributeIndex = drawState.getAttribIndex(GrDrawState::kTexCoord_AttribIndex); + } #if GR_DEBUG // verify valid vertex attribute state diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h index a859d18595..a0194151c7 100644 --- a/src/gpu/gl/GrGpuGL.h +++ b/src/gpu/gl/GrGpuGL.h @@ -10,6 +10,7 @@ #ifndef GrGpuGL_DEFINED #define GrGpuGL_DEFINED + #include "GrBinHashKey.h" #include "GrDrawState.h" #include "GrGpu.h" @@ -292,7 +293,7 @@ private: this->setVertexBufferID(0); } for (int i = 0; i < fAttribArrayCount; ++i) { - if (fAttribArrays[i].vertexBufferID() == id) { + if (fAttribArrays[i].isVertexBufferIDBound(id)) { fAttribArrays[i].invalidate(); } } @@ -379,7 +380,9 @@ private: fAttribPointerIsValid = false; } - GrGLuint vertexBufferID() const { return fVertexBufferID; } + bool isVertexBufferIDBound(GrGLuint id) const { + return fAttribPointerIsValid && id == fVertexBufferID; + } private: bool fEnableIsValid; bool fAttribPointerIsValid; diff --git a/tests/GradientTest.cpp b/tests/GradientTest.cpp index e60c9ed856..41724b68ee 100644 --- a/tests/GradientTest.cpp +++ b/tests/GradientTest.cpp @@ -52,6 +52,7 @@ static void color_gradproc(skiatest::Reporter* reporter, const GradRec& rec) { REPORTER_ASSERT(reporter, SkShader::kColor_GradientType == s->asAGradient(NULL)); SkShader::GradientInfo info; + info.fColors = NULL; info.fColorCount = 0; s->asAGradient(&info); REPORTER_ASSERT(reporter, 1 == info.fColorCount);