diff options
Diffstat (limited to 'include/utils/SkWGL.h')
-rw-r--r-- | include/utils/SkWGL.h | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/include/utils/SkWGL.h b/include/utils/SkWGL.h index 8eae5af6a3..619b8e0ff1 100644 --- a/include/utils/SkWGL.h +++ b/include/utils/SkWGL.h @@ -33,28 +33,30 @@ #undef SK_LOCAL_LEAN_AND_MEAN #endif -#define SK_WGL_DRAW_TO_WINDOW 0x2001 -#define SK_WGL_ACCELERATION 0x2003 -#define SK_WGL_SUPPORT_OPENGL 0x2010 -#define SK_WGL_DOUBLE_BUFFER 0x2011 -#define SK_WGL_COLOR_BITS 0x2014 -#define SK_WGL_ALPHA_BITS 0x201B -#define SK_WGL_STENCIL_BITS 0x2023 -#define SK_WGL_FULL_ACCELERATION 0x2027 -#define SK_WGL_SAMPLE_BUFFERS 0x2041 -#define SK_WGL_SAMPLES 0x2042 -#define SK_WGL_CONTEXT_MAJOR_VERSION 0x2091 -#define SK_WGL_CONTEXT_MINOR_VERSION 0x2092 -#define SK_WGL_CONTEXT_LAYER_PLANE 0x2093 -#define SK_WGL_CONTEXT_FLAGS 0x2094 -#define SK_WGL_CONTEXT_PROFILE_MASK 0x9126 -#define SK_WGL_CONTEXT_DEBUG_BIT 0x0001 -#define SK_WGL_CONTEXT_FORWARD_COMPATIBLE_BIT 0x0002 -#define SK_WGL_CONTEXT_CORE_PROFILE_BIT 0x00000001 -#define SK_WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 -#define SK_WGL_CONTEXT_ES2_PROFILE_BIT 0x00000004 -#define SK_ERROR_INVALID_VERSION 0x2095 -#define SK_ERROR_INVALID_PROFILE 0x2096 +#define SK_WGL_DRAW_TO_WINDOW 0x2001 +#define SK_WGL_ACCELERATION 0x2003 +#define SK_WGL_SUPPORT_OPENGL 0x2010 +#define SK_WGL_DOUBLE_BUFFER 0x2011 +#define SK_WGL_COLOR_BITS 0x2014 +#define SK_WGL_ALPHA_BITS 0x201B +#define SK_WGL_STENCIL_BITS 0x2023 +#define SK_WGL_FULL_ACCELERATION 0x2027 +#define SK_WGL_SAMPLE_BUFFERS 0x2041 +#define SK_WGL_SAMPLES 0x2042 +#define SK_WGL_COVERAGE_SAMPLES 0x2042 /* same as SAMPLES */ +#define SK_WGL_COLOR_SAMPLES 0x20B9 +#define SK_WGL_CONTEXT_MAJOR_VERSION 0x2091 +#define SK_WGL_CONTEXT_MINOR_VERSION 0x2092 +#define SK_WGL_CONTEXT_LAYER_PLANE 0x2093 +#define SK_WGL_CONTEXT_FLAGS 0x2094 +#define SK_WGL_CONTEXT_PROFILE_MASK 0x9126 +#define SK_WGL_CONTEXT_DEBUG_BIT 0x0001 +#define SK_WGL_CONTEXT_FORWARD_COMPATIBLE_BIT 0x0002 +#define SK_WGL_CONTEXT_CORE_PROFILE_BIT 0x00000001 +#define SK_WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 +#define SK_WGL_CONTEXT_ES2_PROFILE_BIT 0x00000004 +#define SK_ERROR_INVALID_VERSION 0x2095 +#define SK_ERROR_INVALID_PROFILE 0x2096 class SkWGLExtensions { public: @@ -73,6 +75,23 @@ public: BOOL getPixelFormatAttribfv(HDC hdc, int, int, UINT, const int*, FLOAT*) const; HGLRC createContextAttribs(HDC, HGLRC, const int *) const; + /** + * WGL doesn't have precise rules for the ordering of formats returned + * by wglChoosePixelFormat. This function helps choose among the set of + * formats returned by wglChoosePixelFormat. The rules in decreasing + * priority are: + * * Choose formats with the smallest sample count that is >= + * desiredSampleCount (or the largest sample count if all formats have + * fewer samples than desiredSampleCount.) + * * Choose formats with the fewest color samples when coverage sampling + * is available. + * * If the above rules leave multiple formats, choose the one that + * appears first in the formats array parameter. + */ + int selectFormat(const int formats[], + int formatCount, + HDC dc, + int desiredSampleCount); private: typedef const char* (WINAPI *GetExtensionsStringProc)(HDC hdc); typedef BOOL (WINAPI *ChoosePixelFormatProc)(HDC hdc, const int *, const FLOAT *, UINT, int *, UINT *); |