summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-05-06 19:58:08 +0100
committerKeith Whitwell <keithw@vmware.com>2009-05-08 10:04:13 +0100
commit26ffd445861f405e295644df1cbac29458a6054f (patch)
treee403362f7268121c8b09d844e77bd5438a0fed08 /src/gallium
parent3a43ea4946bc5965267f9b689378697fcab020c6 (diff)
wgl: Enforce a minimum 1x1 framebuffer size.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_context.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c
index d532b1563b..b61f74f69b 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_context.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_context.c
@@ -278,19 +278,30 @@ stw_release_context(
/* Find the width and height of the window named by hdc.
*/
static void
-stw_get_window_size( HDC hdc, GLuint *width, GLuint *height )
+stw_get_window_size( HDC hdc, GLuint *pwidth, GLuint *pheight )
{
- if (WindowFromDC( hdc )) {
- RECT rect;
+ GLuint width, height;
+ HWND hwnd;
- GetClientRect( WindowFromDC( hdc ), &rect );
- *width = rect.right - rect.left;
- *height = rect.bottom - rect.top;
+ hwnd = WindowFromDC( hdc );
+ if (hwnd) {
+ RECT rect;
+ GetClientRect( hwnd, &rect );
+ width = rect.right - rect.left;
+ height = rect.bottom - rect.top;
}
else {
- *width = GetDeviceCaps( hdc, HORZRES );
- *height = GetDeviceCaps( hdc, VERTRES );
+ width = GetDeviceCaps( hdc, HORZRES );
+ height = GetDeviceCaps( hdc, VERTRES );
}
+
+ if(width < 1)
+ width = 1;
+ if(height < 1)
+ height = 1;
+
+ *pwidth = width;
+ *pheight = height;
}
UINT_PTR