summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2015-11-10 10:56:57 +0200
committerTor Lillqvist <tml@collabora.com>2015-11-10 10:58:31 +0200
commitecc421cab986a26fb250beba228cf0cb49fba5b0 (patch)
tree4afa22f415f638e33e6922c237a1fa2b160fde08
parent3042270bc54aee2dd4ea14d5996e2ee2960577ce (diff)
Add some assertions and improve comments
Make sure the hardcoded indexes into the iAttributes array that we use mean what they are supposed to. Add comments about that, and fix one misleading comment. Change-Id: Ibb748b00782db4fcaf34f6c717075f6aff50651e
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index f389f88e92ad..ed035cb02035 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -298,16 +298,22 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat,
};
if (!bUseDoubleBufferedRendering)
+ {
+ // Use asserts to make sure the iAttributes array is not changed without changing these ugly
+ // hardcode indexes into it.
+ assert(iAttributes[0] == WGL_DOUBLE_BUFFER_ARB);
iAttributes[1] = GL_FALSE;
+ }
if (bRequestVirtualDevice)
{
+ assert(iAttributes[2] == WGL_DRAW_TO_WINDOW_ARB);
iAttributes[2] = WGL_DRAW_TO_BITMAP_ARB;
}
bool bArbMultisampleSupported = true;
- // First we check to see if we can get a pixel format for 4 samples
+ // First we check to see if we can get a pixel format for 8 samples
valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats);
// If we returned true, and our format count is greater than 1
if (valid && numFormats >= 1)
@@ -320,7 +326,8 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat,
DestroyWindow(hWnd);
return bArbMultisampleSupported;
}
- // Our pixel format with 4 samples failed, test for 2 samples
+ // Our pixel format with 8 samples failed, test for 2 samples
+ assert(iAttributes[18] == WGL_SAMPLES_ARB);
iAttributes[19] = 2;
valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats);
if (valid && numFormats >= 1)