DXGL r31 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r30‎ | r31 | r32 >
Date:21:29, 18 December 2011
Author:admin
Status:new
Tags:
Comment:
Fix DXGLTest and render window repainting
Fix render window messages not being processed by glDirectDraw7 class
Modified paths:
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /dxgltest/Tests2D.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirectDraw.cpp
@@ -1272,7 +1272,7 @@
12731273 wndclass.hInstance = (HINSTANCE)GetWindowLongPtr(hWnd,GWLP_HINSTANCE);
12741274 wndclass.hIcon = NULL;
12751275 wndclass.hCursor = NULL;
1276 - wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE+1);
 1276+ wndclass.hbrBackground = NULL;
12771277 wndclass.lpszMenuName = NULL;
12781278 wndclass.lpszClassName = "DXGLRenderWindow";
12791279 wndclass.hIconSm = NULL;
@@ -1388,7 +1388,12 @@
13891389 }
13901390 LRESULT glDirectDraw7::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
13911391 {
1392 - return DefWindowProcA(hWnd,msg,wParam,lParam);
 1392+ if(msg == WM_CREATE)
 1393+ {
 1394+ SetWindowLongPtr(hwnd,GWLP_USERDATA,(LONG_PTR)this);
 1395+ return 0;
 1396+ }
 1397+ return DefWindowProc(hwnd,msg,wParam,lParam);
13931398 }
13941399 void glDirectDraw7::GetHandles(HWND *hwnd, HWND *hrender)
13951400 {
Index: dxgltest/Tests2D.cpp
@@ -68,6 +68,7 @@
6969
7070 LRESULT CALLBACK DDWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
7171 {
 72+ bool paintwnd = true;
7273 POINT p;
7374 RECT srcrect,destrect;
7475 HRESULT error;
@@ -115,8 +116,9 @@
116117 RunTestTimed(testnum);
117118 break;
118119 case WM_SIZE:
 120+ paintwnd = false;
119121 case WM_PAINT:
120 - BeginPaint(hWnd,&paintstruct);
 122+ if(paintwnd) BeginPaint(hWnd,&paintstruct);
121123 if(!fullscreen)
122124 {
123125 p.x = 0;
@@ -127,7 +129,7 @@
128130 SetRect(&srcrect,0,0,width,height);
129131 if(ddsurface && ddsrender)error = ddsurface->Blt(&destrect,ddsrender,&srcrect,DDBLT_WAIT,NULL);
130132 }
131 - EndPaint(hWnd,&paintstruct);
 133+ if(paintwnd) EndPaint(hWnd,&paintstruct);
132134 return 0;
133135 case WM_MOUSEMOVE:
134136 RunTestMouse(testnum,WM_MOUSEMOVE,wParam,lParam);
@@ -268,7 +270,7 @@
269271 wc.hIconSm = LoadIcon(hinstance,MAKEINTRESOURCE(IDI_DXGLSM));
270272 if(testnum == 6) wc.hCursor = LoadCursor(NULL,IDC_CROSS);
271273 else wc.hCursor = LoadCursor(NULL,IDC_ARROW);
272 - wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
 274+ wc.hbrBackground = NULL;
273275 wc.lpszClassName = wndclassname2d;
274276 if(!RegisterClassEx(&wc))
275277 {