blob: 234e65c256093ca86a2df1c63a164f659e6893f7 [file] [log] [blame]
Scroggof33d1532011-05-31 17:10:21 +00001/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00002 * Copyright 2011 Skia
Scroggof33d1532011-05-31 17:10:21 +00003 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00004 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
Scroggof33d1532011-05-31 17:10:21 +00006 */
7
8#ifndef SkOSWindow_Android_DEFINED
9#define SkOSWindow_Android_DEFINED
10
11#include "SkWindow.h"
Scroggof33d1532011-05-31 17:10:21 +000012
joshualitt030dc842015-06-12 12:51:44 -070013#include <EGL/egl.h>
14
15struct SkAndroidWindow {
16 EGLDisplay fDisplay;
17 EGLSurface fSurface;
18 EGLContext fContext;
19};
20
Scroggof33d1532011-05-31 17:10:21 +000021class SkOSWindow : public SkWindow {
22public:
joshualitt030dc842015-06-12 12:51:44 -070023 SkOSWindow(void*);
24 ~SkOSWindow();
robertphillips@google.comb442a6d2012-04-02 19:24:21 +000025
26 enum SkBackEndTypes {
27 kNone_BackEndType,
28 kNativeGL_BackEndType,
29 };
30
brianosman2d1ee792016-05-05 12:24:31 -070031 bool attach(SkBackEndTypes attachType, int msaaSampleCount, bool deepColor,
32 AttachmentInfo* info);
mtklein18300a32016-03-16 13:53:35 -070033 void release();
joshualitt030dc842015-06-12 12:51:44 -070034 void present();
bsalomon85ab5512015-06-16 12:47:25 -070035 bool makeFullscreen() { return true; }
36 void closeWindow();
37 void setVsync(bool);
joshualitt030dc842015-06-12 12:51:44 -070038 bool destroyRequested() { return fDestroyRequested; }
Scroggo2c8208f2011-06-15 16:49:08 +000039
Scroggof33d1532011-05-31 17:10:21 +000040protected:
41 // overrides from SkWindow
42 virtual void onHandleInval(const SkIRect&);
43 virtual void onSetTitle(const char title[]);
44
45private:
joshualitt030dc842015-06-12 12:51:44 -070046 SkAndroidWindow fWindow;
47 ANativeWindow* fNativeWindow;
48 bool fDestroyRequested;
49
Scroggof33d1532011-05-31 17:10:21 +000050 typedef SkWindow INHERITED;
51};
52
53#endif