From da18bebf74ae3502cbf3c414cd65b1a2fee9c723 Mon Sep 17 00:00:00 2001
From: Morgan Armand <morgan.devel@gmail.com>
Date: Wed, 2 Nov 2011 08:30:35 +0100
Subject: [PATCH] fix windows code path

---
 tests/glean/dsconfig.cpp |   42 +++++++++++++++++++++---------------------
 tests/glean/dsconfig.h   |    2 +-
 tests/glean/dsurf.cpp    |    3 +--
 tests/glean/rc.cpp       |    4 +---
 4 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/tests/glean/dsconfig.cpp b/tests/glean/dsconfig.cpp
index 9a4336c..69b549d 100644
--- a/tests/glean/dsconfig.cpp
+++ b/tests/glean/dsconfig.cpp
@@ -367,48 +367,48 @@ DrawingSurfaceConfig::DrawingSurfaceConfig(int id, ::PIXELFORMATDESCRIPTOR *ppfd
 	if (!mapsInitialized)
 		initializeMaps();
 
-	pfd = ppfd;
+	pfd = *ppfd;
 	pfdID = id;
 	
-	canRGBA = pfd->iPixelType == PFD_TYPE_RGBA;			
-	canCI = pfd->iPixelType == PFD_TYPE_COLORINDEX;			
+	canRGBA = pfd.iPixelType == PFD_TYPE_RGBA;
+	canCI = pfd.iPixelType == PFD_TYPE_COLORINDEX;
 
-	bufSize = pfd->cColorBits + pfd->cAlphaBits;
+	bufSize = pfd.cColorBits + pfd.cAlphaBits;
 
 	level = 0;
 
-	db = pfd->dwFlags & PFD_DOUBLEBUFFER;
+	db = pfd.dwFlags & PFD_DOUBLEBUFFER;
 
-	stereo = pfd->dwFlags & PFD_STEREO;
+	stereo = pfd.dwFlags & PFD_STEREO;
 
-	aux = pfd->cAuxBuffers;
+	aux = pfd.cAuxBuffers;
 
 	if (canRGBA)	{
-		r = pfd->cRedBits;
-		g = pfd->cGreenBits;
-		b = pfd->cBlueBits;
-		a = pfd->cAlphaBits;
+		r = pfd.cRedBits;
+		g = pfd.cGreenBits;
+		b = pfd.cBlueBits;
+		a = pfd.cAlphaBits;
 	}
 	else
 		r = g = b = a = 0;
 
-	z = pfd->cDepthBits;
-	s = pfd->cStencilBits;
+	z = pfd.cDepthBits;
+	s = pfd.cStencilBits;
 
-	accR = pfd->cAccumRedBits;
-	accG = pfd->cAccumGreenBits;
-	accB = pfd->cAccumBlueBits;
-	accA = pfd->cAccumAlphaBits;
+	accR = pfd.cAccumRedBits;
+	accG = pfd.cAccumGreenBits;
+	accB = pfd.cAccumBlueBits;
+	accA = pfd.cAccumAlphaBits;
 
 	samples = 0; // XXX implement properly for Windows!
 
-	canWindow = pfd->dwFlags & PFD_DRAW_TO_WINDOW;			
+	canWindow = pfd.dwFlags & PFD_DRAW_TO_WINDOW;
 
-	canWinSysRender = pfd->dwFlags & PFD_SUPPORT_GDI;		
+	canWinSysRender = pfd.dwFlags & PFD_SUPPORT_GDI;
 
-	if (pfd->dwFlags & PFD_GENERIC_FORMAT)
+	if (pfd.dwFlags & PFD_GENERIC_FORMAT)
 	{
-		if (pfd->dwFlags & PFD_GENERIC_ACCELERATED)
+		if (pfd.dwFlags & PFD_GENERIC_ACCELERATED)
 		{
 			// it's an MCD - at least it has some acceleration
 			fast = true;
diff --git a/tests/glean/dsconfig.h b/tests/glean/dsconfig.h
index 3827662..8df2abc 100644
--- a/tests/glean/dsconfig.h
+++ b/tests/glean/dsconfig.h
@@ -93,7 +93,7 @@ class DrawingSurfaceConfig {
 	::XID fbcID;			// Framebuffer Config ID.
 #     endif
 #   elif defined(__WIN__)
-	::PIXELFORMATDESCRIPTOR *pfd;
+	::PIXELFORMATDESCRIPTOR pfd;
 	int pfdID;
 #   elif defined(__AGL__)
 	AGLPixelFormat    pf;
diff --git a/tests/glean/dsurf.cpp b/tests/glean/dsurf.cpp
index 2a3bea1..4e4cfd7 100644
--- a/tests/glean/dsurf.cpp
+++ b/tests/glean/dsurf.cpp
@@ -155,8 +155,7 @@ legacyMethod:
 
 	hDC = GetDC(hWindow);
 
-	PIXELFORMATDESCRIPTOR pfd;
-	SetPixelFormat(hDC,config->pfdID,&pfd);
+	SetPixelFormat(hDC,config->pfdID,&config->pfd);
 	
 #elif defined(__BEWIN__)
 
diff --git a/tests/glean/rc.cpp b/tests/glean/rc.cpp
index 8cc95b3..e432d99 100644
--- a/tests/glean/rc.cpp
+++ b/tests/glean/rc.cpp
@@ -66,9 +66,7 @@ HGLRC create_context(GLEAN::DrawingSurfaceConfig &c)
 	if (!hDC)
 		return 0;
 
-	PIXELFORMATDESCRIPTOR pfd; 
-
-	if (!SetPixelFormat(hDC,c.pfdID,&pfd))
+	if (!SetPixelFormat(hDC,c.pfdID,&c.pfd))
 	{
 		ReleaseDC(hwnd,hDC);
 		DestroyWindow(hwnd);
-- 
1.7.7.1.msysgit.0
