bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame^] | 1 | |
| 2 | /* |
| 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | #ifndef SkNativeGLContext_DEFINED |
| 9 | #define SkNativeGLContext_DEFINED |
| 10 | |
| 11 | #include "SkGLContext.h" |
| 12 | |
| 13 | #if defined(SK_BUILD_FOR_MAC) |
| 14 | #include <AGL/agl.h> |
| 15 | #elif defined(SK_BUILD_FOR_UNIX) |
| 16 | #include <X11/Xlib.h> |
| 17 | #include <GL/glx.h> |
| 18 | #elif defined(SK_BUILD_FOR_WIN32) |
| 19 | #include <Windows.h> |
| 20 | #include <GL/GL.h> |
| 21 | #endif |
| 22 | |
| 23 | class SkNativeGLContext : public SkGLContext { |
| 24 | public: |
| 25 | SkNativeGLContext(); |
| 26 | |
| 27 | virtual ~SkNativeGLContext(); |
| 28 | |
| 29 | virtual void makeCurrent() const SK_OVERRIDE; |
| 30 | |
| 31 | protected: |
| 32 | virtual const GrGLInterface* createGLContext() SK_OVERRIDE; |
| 33 | void destroyGLContext() SK_OVERRIDE; |
| 34 | |
| 35 | private: |
| 36 | #if defined(SK_BUILD_FOR_MAC) |
| 37 | AGLContext fContext; |
| 38 | #elif defined(SK_BUILD_FOR_UNIX) |
| 39 | GLXContext fContext; |
| 40 | Display* fDisplay; |
| 41 | Pixmap fPixmap; |
| 42 | GLXPixmap fGlxPixmap; |
| 43 | #elif defined(SK_BUILD_FOR_WIN32) |
| 44 | HWND fWindow; |
| 45 | HDC fDeviceContext; |
| 46 | HGLRC fGlRenderContext; |
| 47 | static ATOM gWC; |
| 48 | #endif |
| 49 | }; |
| 50 | |
| 51 | #endif |