| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkRefCnt.h" | 8 #include "SkRefCnt.h" |
| 9 | 9 |
| 10 #ifndef SkWGL_DEFINED | 10 #ifndef SkWGL_DEFINED |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #if defined(SK_LOCAL_LEAN_AND_MEAN) | 30 #if defined(SK_LOCAL_LEAN_AND_MEAN) |
| 31 #undef WIN32_LEAN_AND_MEAN | 31 #undef WIN32_LEAN_AND_MEAN |
| 32 #undef SK_LOCAL_LEAN_AND_MEAN | 32 #undef SK_LOCAL_LEAN_AND_MEAN |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 #define SK_WGL_DRAW_TO_WINDOW 0x2001 | 35 #define SK_WGL_DRAW_TO_WINDOW 0x2001 |
| 36 #define SK_WGL_ACCELERATION 0x2003 | 36 #define SK_WGL_ACCELERATION 0x2003 |
| 37 #define SK_WGL_SUPPORT_OPENGL 0x2010 | 37 #define SK_WGL_SUPPORT_OPENGL 0x2010 |
| 38 #define SK_WGL_DOUBLE_BUFFER 0x2011 | 38 #define SK_WGL_DOUBLE_BUFFER 0x2011 |
| 39 #define SK_WGL_COLOR_BITS 0x2014 | 39 #define SK_WGL_COLOR_BITS 0x2014 |
| 40 #define SK_WGL_RED_BITS 0x2015 |
| 41 #define SK_WGL_GREEN_BITS 0x2017 |
| 42 #define SK_WGL_BLUE_BITS 0x2019 |
| 40 #define SK_WGL_ALPHA_BITS 0x201B | 43 #define SK_WGL_ALPHA_BITS 0x201B |
| 41 #define SK_WGL_STENCIL_BITS 0x2023 | 44 #define SK_WGL_STENCIL_BITS 0x2023 |
| 42 #define SK_WGL_FULL_ACCELERATION 0x2027 | 45 #define SK_WGL_FULL_ACCELERATION 0x2027 |
| 43 #define SK_WGL_SAMPLE_BUFFERS 0x2041 | 46 #define SK_WGL_SAMPLE_BUFFERS 0x2041 |
| 44 #define SK_WGL_SAMPLES 0x2042 | 47 #define SK_WGL_SAMPLES 0x2042 |
| 45 #define SK_WGL_CONTEXT_MAJOR_VERSION 0x2091 | 48 #define SK_WGL_CONTEXT_MAJOR_VERSION 0x2091 |
| 46 #define SK_WGL_CONTEXT_MINOR_VERSION 0x2092 | 49 #define SK_WGL_CONTEXT_MINOR_VERSION 0x2092 |
| 47 #define SK_WGL_CONTEXT_LAYER_PLANE 0x2093 | 50 #define SK_WGL_CONTEXT_LAYER_PLANE 0x2093 |
| 48 #define SK_WGL_CONTEXT_FLAGS 0x2094 | 51 #define SK_WGL_CONTEXT_FLAGS 0x2094 |
| 49 #define SK_WGL_CONTEXT_PROFILE_MASK 0x9126 | 52 #define SK_WGL_CONTEXT_PROFILE_MASK 0x9126 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 kGLPreferCompatibilityProfile_SkWGLContextRequest, | 134 kGLPreferCompatibilityProfile_SkWGLContextRequest, |
| 132 /** Requests to create GL ES profile context. */ | 135 /** Requests to create GL ES profile context. */ |
| 133 kGLES_SkWGLContextRequest | 136 kGLES_SkWGLContextRequest |
| 134 }; | 137 }; |
| 135 /** | 138 /** |
| 136 * Helper to create an OpenGL context for a DC using WGL. Configs with a sample
count >= to | 139 * Helper to create an OpenGL context for a DC using WGL. Configs with a sample
count >= to |
| 137 * msaaSampleCount are preferred but if none is available then a context with a
lower sample count | 140 * msaaSampleCount are preferred but if none is available then a context with a
lower sample count |
| 138 * (including non-MSAA) will be created. If preferCoreProfile is true but a core
profile cannot be | 141 * (including non-MSAA) will be created. If preferCoreProfile is true but a core
profile cannot be |
| 139 * created then a compatible profile context will be created. | 142 * created then a compatible profile context will be created. |
| 140 */ | 143 */ |
| 141 HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, SkWGLContextRequest contex
t); | 144 HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, bool deepColor, SkWGLConte
xtRequest context); |
| 142 | 145 |
| 143 /** | 146 /** |
| 144 * Helper class for creating a pbuffer context and deleting all the handles when
finished. This | 147 * Helper class for creating a pbuffer context and deleting all the handles when
finished. This |
| 145 * requires that a device context has been created. However, the pbuffer gets it
s own device | 148 * requires that a device context has been created. However, the pbuffer gets it
s own device |
| 146 * context. The original device context can be released once the pbuffer context
is created. | 149 * context. The original device context can be released once the pbuffer context
is created. |
| 147 */ | 150 */ |
| 148 class SkWGLPbufferContext : public SkRefCnt { | 151 class SkWGLPbufferContext : public SkRefCnt { |
| 149 public: | 152 public: |
| 150 static SkWGLPbufferContext* Create(HDC parentDC, int msaaSampleCount, | 153 static SkWGLPbufferContext* Create(HDC parentDC, int msaaSampleCount, |
| 151 SkWGLContextRequest contextType); | 154 SkWGLContextRequest contextType); |
| 152 | 155 |
| 153 virtual ~SkWGLPbufferContext(); | 156 virtual ~SkWGLPbufferContext(); |
| 154 | 157 |
| 155 HDC getDC() const { return fDC; } | 158 HDC getDC() const { return fDC; } |
| 156 HGLRC getGLRC() const { return fGLRC; } | 159 HGLRC getGLRC() const { return fGLRC; } |
| 157 | 160 |
| 158 private: | 161 private: |
| 159 SkWGLPbufferContext(HPBUFFER pbuffer, HDC dc, HGLRC glrc); | 162 SkWGLPbufferContext(HPBUFFER pbuffer, HDC dc, HGLRC glrc); |
| 160 | 163 |
| 161 HPBUFFER fPbuffer; | 164 HPBUFFER fPbuffer; |
| 162 HDC fDC; | 165 HDC fDC; |
| 163 HGLRC fGLRC; | 166 HGLRC fGLRC; |
| 164 SkWGLExtensions fExtensions; | 167 SkWGLExtensions fExtensions; |
| 165 }; | 168 }; |
| 166 | 169 |
| 167 #endif | 170 #endif |
| OLD | NEW |