Add MSAA option to SampleApp

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


git-svn-id: http://skia.googlecode.com/svn/trunk@3627 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/views/SkOSWindow_Android.h b/include/views/SkOSWindow_Android.h
index 5818a0a..9b72b48 100644
--- a/include/views/SkOSWindow_Android.h
+++ b/include/views/SkOSWindow_Android.h
@@ -24,7 +24,9 @@
         kNativeGL_BackEndType,
     };
 
-    bool attach(SkBackEndTypes /* attachType */) { return true; }
+    bool attach(SkBackEndTypes /* attachType */, int /* msaaSampleCount */) {
+        return true;
+    }
     void detach() {}
     void present() {}
 
diff --git a/include/views/SkOSWindow_Mac.h b/include/views/SkOSWindow_Mac.h
index 01fa29f..e3bcea9 100644
--- a/include/views/SkOSWindow_Mac.h
+++ b/include/views/SkOSWindow_Mac.h
@@ -16,19 +16,18 @@
     SkOSWindow(void* hwnd);
     ~SkOSWindow();
     void*   getHWND() const { return fHWND; }
-    
+
     virtual bool onDispatchClick(int x, int y, Click::State state, 
                                  void* owner);
-
     enum SkBackEndTypes {
         kNone_BackEndType,
         kNativeGL_BackEndType,
     };
 
     void    detach();
-    bool    attach(SkBackEndTypes attachType);
+    bool    attach(SkBackEndTypes attachType, int msaaSampleCount);
     void    present();
-    
+
 protected:
     // overrides from SkEventSink
     virtual bool onEvent(const SkEvent& evt);
diff --git a/include/views/SkOSWindow_Unix.h b/include/views/SkOSWindow_Unix.h
index 384cc7b..d967579 100644
--- a/include/views/SkOSWindow_Unix.h
+++ b/include/views/SkOSWindow_Unix.h
@@ -39,10 +39,12 @@
         kNativeGL_BackEndType,
     };
 
-    bool attach(SkBackEndTypes attachType);
+    bool attach(SkBackEndTypes attachType, int msaaSampleCount);
     void detach();
     void present();
 
+    int getMSAASampleCount() const { return fMSAASampleCount; }
+
     //static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay);
 
     //static bool WndProc(SkUnixWindow* w,  XEvent &e);
@@ -60,10 +62,15 @@
     void doPaint();
     void mapWindowAndWait();
 
+    void closeWindow();
+    void initWindow(int newMSAASampleCount);
+
     SkUnixWindow fUnixWindow;
 
     // Needed for GL
     XVisualInfo* fVi;
+    // we recreate the underlying xwindow if this changes
+    int fMSAASampleCount;
 
     typedef SkWindow INHERITED;
 };
diff --git a/include/views/SkOSWindow_Win.h b/include/views/SkOSWindow_Win.h
index 9c76d5c..f61c80a 100644
--- a/include/views/SkOSWindow_Win.h
+++ b/include/views/SkOSWindow_Win.h
@@ -35,7 +35,7 @@
 #endif
     };
 
-    bool attach(SkBackEndTypes attachType);
+    bool attach(SkBackEndTypes attachType, int msaaSampleCount);
     void detach();
     void present();
 
@@ -73,12 +73,12 @@
 
     SkBackEndTypes      fAttached;
 
-    bool attachGL();
+    bool attachGL(int msaaSampleCount);
     void detachGL();
     void presentGL();
 
 #if SK_ANGLE
-    bool attachANGLE();
+    bool attachANGLE(int msaaSampleCount);
     void detachANGLE();
     void presentANGLE();
 #endif
diff --git a/include/views/SkOSWindow_iOS.h b/include/views/SkOSWindow_iOS.h
index 34ce421..33f014c 100755
--- a/include/views/SkOSWindow_iOS.h
+++ b/include/views/SkOSWindow_iOS.h
@@ -25,7 +25,7 @@
     };
 
     void    detach();
-    bool    attach(SkBackEndTypes attachType);
+    bool    attach(SkBackEndTypes attachType, int msaaSampleCount);
     void    present();
 
 protected: