Fix GrTextureAccess::operator ==
compare the textures, correctly intepret memcmp result, don't compare last byte of swizzle array which must be 0.
BUG=895
Review URL: https://codereview.appspot.com/6542048
git-svn-id: http://skia.googlecode.com/svn/trunk@5605 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrTextureAccess.h b/include/gpu/GrTextureAccess.h
index 7f47b6e..0d0860f 100644
--- a/include/gpu/GrTextureAccess.h
+++ b/include/gpu/GrTextureAccess.h
@@ -145,11 +145,12 @@
bool operator== (const GrTextureAccess& other) const {
#if GR_DEBUG
// below assumes all chars in fSwizzle are initialized even if string is < 4 chars long.
- GrAssert(memcmp(fSwizzle, other.fSwizzle, sizeof(fSwizzle)) ==
+ GrAssert(memcmp(fSwizzle, other.fSwizzle, sizeof(fSwizzle)-1) ==
strcmp(fSwizzle, other.fSwizzle));
#endif
return fParams == other.fParams &&
- memcmp(fSwizzle, other.fSwizzle, sizeof(fSwizzle));
+ (fTexture.get() == other.fTexture.get()) &&
+ (0 == memcmp(fSwizzle, other.fSwizzle, sizeof(fSwizzle)-1));
}
bool operator!= (const GrTextureAccess& other) const { return !(*this == other); }