From d3ae1d62312791b4355d47f41562de7b11e95636 Mon Sep 17 00:00:00 2001 From: "fmalita@google.com" Date: Thu, 11 Jul 2013 16:25:55 +0000 Subject: [PATCH] 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 --- src/utils/debugger/SkObjectParser.cpp | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/utils/debugger/SkObjectParser.cpp b/src/utils/debugger/SkObjectParser.cpp index f405e87..504cd08 100644 --- a/src/utils/debugger/SkObjectParser.cpp +++ b/src/utils/debugger/SkObjectParser.cpp @@ -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; } -- 2.7.4