blob: 512e66a3ab93f33cbc57975dd723aa26e9e2743e [file] [log] [blame]
bsalomon@google.com373a6632011-10-19 20:43:20 +00001
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
23class SkNativeGLContext : public SkGLContext {
24public:
25 SkNativeGLContext();
26
27 virtual ~SkNativeGLContext();
28
29 virtual void makeCurrent() const SK_OVERRIDE;
30
bsalomon@google.com373a6632011-10-19 20:43:20 +000031protected:
32 virtual const GrGLInterface* createGLContext() SK_OVERRIDE;
33 void destroyGLContext() SK_OVERRIDE;
34
35private:
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