Home | History | Annotate | Download | only in views
      1 /*
      2  * Copyright 2011 Skia
      3  *
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  */
      7 
      8 #ifndef SkOSWindow_Android_DEFINED
      9 #define SkOSWindow_Android_DEFINED
     10 
     11 #include "SkWindow.h"
     12 
     13 #include <EGL/egl.h>
     14 
     15 struct SkAndroidWindow {
     16     EGLDisplay fDisplay;
     17     EGLSurface fSurface;
     18     EGLContext fContext;
     19 };
     20 
     21 class SkOSWindow : public SkWindow {
     22 public:
     23     SkOSWindow(void*);
     24     ~SkOSWindow();
     25 
     26     enum SkBackEndTypes {
     27         kNone_BackEndType,
     28         kNativeGL_BackEndType,
     29     };
     30 
     31     bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo* info);
     32     void detach();
     33     void present();
     34     bool makeFullscreen() { return true; }
     35     void closeWindow();
     36     void setVsync(bool);
     37     bool destroyRequested() { return fDestroyRequested; }
     38 
     39 protected:
     40     // overrides from SkWindow
     41     virtual void onHandleInval(const SkIRect&);
     42     virtual void onSetTitle(const char title[]);
     43 
     44 private:
     45     SkAndroidWindow fWindow;
     46     ANativeWindow* fNativeWindow;
     47     bool fDestroyRequested;
     48 
     49     typedef SkWindow INHERITED;
     50 };
     51 
     52 #endif
     53