1 #ifndef SkEGLContext_DEFINED 2 #define SkEGLContext_DEFINED 3 4 #if defined(SK_MESA) 5 #include "GL/osmesa.h" 6 #elif defined(SK_BUILD_FOR_MAC) 7 #include <AGL/agl.h> 8 #elif defined(SK_BUILD_FOR_ANDROID) 9 #include "GLES2/gl2.h" 10 #include "EGL/egl.h" 11 #elif defined(SK_BUILD_FOR_UNIX) 12 #include <X11/Xlib.h> 13 #include <GL/glx.h> 14 #elif defined(SK_BUILD_FOR_WIN32) 15 #include <Windows.h> 16 #include <GL/GL.h> 17 #else 18 19 #endif 20 21 /** 22 * Create an offscreen opengl context 23 */ 24 class SkEGLContext { 25 public: 26 SkEGLContext(); 27 ~SkEGLContext(); 28 29 bool init(const int width, const int height); 30 31 private: 32 #if defined(SK_MESA) 33 OSMesaContext context; 34 GLfloat *image; 35 #elif defined(SK_BUILD_FOR_MAC) 36 AGLContext context; 37 #elif defined(SK_BUILD_FOR_ANDROID) 38 39 #elif defined(SK_BUILD_FOR_UNIX) 40 GLXContext context; 41 Display *display; 42 Pixmap pixmap; 43 GLXPixmap glxPixmap; 44 #elif defined(SK_BUILD_FOR_WIN32) 45 HWND fWindow; 46 HDC fDeviceContext; 47 HGLRC fGlRenderContext; 48 #else 49 50 #endif 51 }; 52 53 #endif 54