Fix GL attach/detach in Mac SampleApp

Review URL: http://codereview.appspot.com/5984043/


git-svn-id: http://skia.googlecode.com/svn/trunk@3587 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 8214b6e..08ab47a 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -1848,6 +1848,7 @@
 
         // we prefer smooth lines over multisampled lines
         // msaa should be disabled if drawing smooth lines.
+        bool handledMSAA = false;
         if (GrIsPrimTypeLines(type)) {
             bool smooth = this->willUseHWAALines();
             if (!fHWAAState.fSmoothLineEnabled && smooth) {
@@ -1857,14 +1858,15 @@
                 GL_CALL(Disable(GR_GL_LINE_SMOOTH));
                 fHWAAState.fSmoothLineEnabled = false;
             }
-            if (rt->isMultisampled() && 
-                fHWAAState.fMSAAEnabled) {
+            if (smooth && rt->isMultisampled() && fHWAAState.fMSAAEnabled) {
                 GL_CALL(Disable(GR_GL_MULTISAMPLE));
                 fHWAAState.fMSAAEnabled = false;
+                handledMSAA = true;
             }
-        } else if (rt->isMultisampled() &&
-                   this->getDrawState().isHWAntialiasState() !=
-                   fHWAAState.fMSAAEnabled) {
+        }
+        if (!handledMSAA && rt->isMultisampled() &&
+            this->getDrawState().isHWAntialiasState() !=
+            fHWAAState.fMSAAEnabled) {
             if (fHWAAState.fMSAAEnabled) {
                 GL_CALL(Disable(GR_GL_MULTISAMPLE));
                 fHWAAState.fMSAAEnabled = false;