reed@google.com | 873cb1e | 2010-12-23 15:00:45 +0000 | [diff] [blame] | 1 | #ifndef SkEGLContext_DEFINED |
| 2 | #define SkEGLContext_DEFINED |
reed@google.com | c31ce10 | 2010-12-21 16:26:39 +0000 | [diff] [blame] | 3 | |
bungeman@google.com | 16bab87 | 2011-05-17 14:24:46 +0000 | [diff] [blame] | 4 | #if defined(SK_BUILD_FOR_MAC) |
| 5 | #include <AGL/agl.h> |
| 6 | #elif defined(SK_BUILD_FOR_UNIX) |
| 7 | #include <X11/Xlib.h> |
| 8 | #include <GL/glx.h> |
| 9 | #else |
| 10 | |
| 11 | #endif |
reed@google.com | c31ce10 | 2010-12-21 16:26:39 +0000 | [diff] [blame] | 12 | |
reed@google.com | 873cb1e | 2010-12-23 15:00:45 +0000 | [diff] [blame] | 13 | /** |
| 14 | * Create an offscreen opengl context |
| 15 | */ |
reed@google.com | c31ce10 | 2010-12-21 16:26:39 +0000 | [diff] [blame] | 16 | class SkEGLContext { |
| 17 | public: |
bungeman@google.com | 16bab87 | 2011-05-17 14:24:46 +0000 | [diff] [blame] | 18 | SkEGLContext(); |
| 19 | ~SkEGLContext(); |
reed@google.com | c31ce10 | 2010-12-21 16:26:39 +0000 | [diff] [blame] | 20 | |
bungeman@google.com | 16bab87 | 2011-05-17 14:24:46 +0000 | [diff] [blame] | 21 | bool init(int width, int height); |
reed@google.com | c31ce10 | 2010-12-21 16:26:39 +0000 | [diff] [blame] | 22 | |
| 23 | private: |
bungeman@google.com | 16bab87 | 2011-05-17 14:24:46 +0000 | [diff] [blame] | 24 | #if defined(SK_BUILD_FOR_MAC) |
| 25 | AGLContext context; |
| 26 | #elif defined(SK_BUILD_FOR_UNIX) |
| 27 | GLXContext context; |
| 28 | Display *display; |
| 29 | Pixmap pixmap; |
| 30 | GLXPixmap glxPixmap; |
| 31 | #else |
| 32 | |
| 33 | #endif |
reed@google.com | c31ce10 | 2010-12-21 16:26:39 +0000 | [diff] [blame] | 34 | }; |
| 35 | |
reed@google.com | 873cb1e | 2010-12-23 15:00:45 +0000 | [diff] [blame] | 36 | #endif |