SkObjectParser::SaveFlagsToString() should handle SaveFlags as a bitmask.

Test one SaveFlags bit at a time instead of exploring the whole value space.

R=robertphillips@google.com

Review URL: https://codereview.chromium.org/18034028

git-svn-id: http://skia.googlecode.com/svn/trunk@10014 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
fmalita@google.com 2013-07-11 16:25:55 +00:00
parent 6a9d436260
commit d3ae1d6231

View File

@ -298,24 +298,20 @@ SkString* SkObjectParser::RegionToString(const SkRegion& region) {
SkString* SkObjectParser::SaveFlagsToString(SkCanvas::SaveFlags flags) {
SkString* mFlags = new SkString("SkCanvas::SaveFlags: ");
if(flags == SkCanvas::kMatrixClip_SaveFlag) {
mFlags->append("kMatrixClip_SaveFlag");
} else if (flags == SkCanvas::kClip_SaveFlag) {
mFlags->append("kClip_SaveFlag");
} else if (flags == SkCanvas::kHasAlphaLayer_SaveFlag) {
mFlags->append("kHasAlphaLayer_SaveFlag");
} else if (flags == SkCanvas::kFullColorLayer_SaveFlag) {
mFlags->append("kFullColorLayer_SaveFlag");
} else if (flags == SkCanvas::kClipToLayer_SaveFlag) {
mFlags->append("kClipToLayer_SaveFlag");
} else if (flags == SkCanvas::kMatrixClip_SaveFlag) {
mFlags->append("kMatrixClip_SaveFlag");
} else if (flags == SkCanvas::kARGB_NoClipLayer_SaveFlag) {
mFlags->append("kARGB_NoClipLayer_SaveFlag");
} else if (flags == SkCanvas::kARGB_ClipLayer_SaveFlag) {
mFlags->append("kARGB_ClipLayer_SaveFlag");
} else {
mFlags->append("Data Unavailable");
if (flags & SkCanvas::kMatrix_SaveFlag) {
mFlags->append("kMatrix_SaveFlag ");
}
if (flags & SkCanvas::kClip_SaveFlag) {
mFlags->append("kClip_SaveFlag ");
}
if (flags & SkCanvas::kHasAlphaLayer_SaveFlag) {
mFlags->append("kHasAlphaLayer_SaveFlag ");
}
if (flags & SkCanvas::kFullColorLayer_SaveFlag) {
mFlags->append("kFullColorLayer_SaveFlag ");
}
if (flags & SkCanvas::kClipToLayer_SaveFlag) {
mFlags->append("kClipToLayer_SaveFlag ");
}
return mFlags;
}