Add convenience function on GrDrawState to set state bit based on a bool.

R=robertphillips@google.com
Review URL: https://codereview.appspot.com/6615044

git-svn-id: http://skia.googlecode.com/svn/trunk@5815 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 26bef45..b038a9d 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -570,11 +570,7 @@
 void GrContext::setClip(const GrClipData* clipData) {
     fGpu->setClip(clipData);
 
-    if (clipData->fClipStack->isWideOpen()) {
-        fDrawState->disableState(GrDrawState::kClip_StateBit);
-    } else {
-        fDrawState->enableState(GrDrawState::kClip_StateBit);
-    }
+    fDrawState->setState(GrDrawState::kClip_StateBit, !clipData->fClipStack->isWideOpen());
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1618,16 +1614,9 @@
 
     fDrawState->setColor(paint.fColor);
 
-    if (paint.fDither) {
-        fDrawState->enableState(GrDrawState::kDither_StateBit);
-    } else {
-        fDrawState->disableState(GrDrawState::kDither_StateBit);
-    }
-    if (paint.fAntiAlias) {
-        fDrawState->enableState(GrDrawState::kHWAntialias_StateBit);
-    } else {
-        fDrawState->disableState(GrDrawState::kHWAntialias_StateBit);
-    }
+    fDrawState->setState(GrDrawState::kDither_StateBit, paint.fDither);
+    fDrawState->setState(GrDrawState::kHWAntialias_StateBit, paint.fAntiAlias);
+
     if (paint.fColorMatrixEnabled) {
         fDrawState->enableState(GrDrawState::kColorMatrix_StateBit);
         fDrawState->setColorMatrix(paint.fColorMatrix);