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
This commit is contained in:
bsalomon@google.com 2012-09-20 15:37:30 +00:00
parent 81f9d2e05b
commit db545aec72

View File

@ -145,11 +145,12 @@ public:
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); }