diff src/video/windib/SDL_dibvideo.c @ 4162:3b7fc3416601 SDL-1.2

GAPI fixes from Stefan Klug
author Sam Lantinga <slouken@libsdl.org>
date Mon, 16 Feb 2009 22:32:34 +0000
parents a1b03ba2fcd0
children b40d6e58a5e5
line wrap: on
line diff
--- a/src/video/windib/SDL_dibvideo.c	Fri Jan 30 01:40:44 2009 +0000
+++ b/src/video/windib/SDL_dibvideo.c	Mon Feb 16 22:32:34 2009 +0000
@@ -34,6 +34,7 @@
 #include "../SDL_pixels_c.h"
 #include "../../events/SDL_sysevents.h"
 #include "../../events/SDL_events_c.h"
+#include "SDL_gapidibvideo.h"
 #include "SDL_dibvideo.h"
 #include "../wincommon/SDL_syswm_c.h"
 #include "../wincommon/SDL_sysmouse_c.h"
@@ -128,6 +129,9 @@
 {
 	if ( device ) {
 		if ( device->hidden ) {
+			if ( device->hidden->dibInfo ) {
+				SDL_free( device->hidden->dibInfo );
+			}
 			SDL_free(device->hidden);
 		}
 		if ( device->gl_data ) {
@@ -147,6 +151,16 @@
 		SDL_memset(device, 0, (sizeof *device));
 		device->hidden = (struct SDL_PrivateVideoData *)
 				SDL_malloc((sizeof *device->hidden));
+		if(device->hidden){
+			SDL_memset(device->hidden, 0, (sizeof *device->hidden));
+			device->hidden->dibInfo = (DibInfo *)SDL_malloc((sizeof(DibInfo)));
+			if(device->hidden->dibInfo == NULL)
+			{
+				SDL_free(device->hidden);
+				device->hidden = NULL;
+			}
+		}
+		
 		device->gl_data = (struct SDL_PrivateGLData *)
 				SDL_malloc((sizeof *device->gl_data));
 	}
@@ -156,7 +170,7 @@
 		DIB_DeleteDevice(device);
 		return(NULL);
 	}
-	SDL_memset(device->hidden, 0, (sizeof *device->hidden));
+	SDL_memset(device->hidden->dibInfo, 0, (sizeof *device->hidden->dibInfo));
 	SDL_memset(device->gl_data, 0, (sizeof *device->gl_data));
 
 	/* Set the function pointers */
@@ -347,6 +361,8 @@
 	this->hidden->supportRotation = ChangeDisplaySettingsEx(NULL, &settings, NULL, CDS_TEST, NULL) == DISP_CHANGE_SUCCESSFUL;
 #endif
 	/* Query for the desktop resolution */
+	SDL_desktop_mode.dmSize = sizeof(SDL_desktop_mode);
+	SDL_desktop_mode.dmDriverExtra = 0;
 	EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &SDL_desktop_mode);
 	this->info.current_w = SDL_desktop_mode.dmPelsWidth;
 	this->info.current_h = SDL_desktop_mode.dmPelsHeight;
@@ -744,7 +760,7 @@
 				video->flags |= SDL_RESIZABLE;
 			}
 		}
-#if WS_MAXIMIZE
+#if WS_MAXIMIZE && !defined(_WIN32_WCE)
 		if (IsZoomed(SDL_Window)) style |= WS_MAXIMIZE;
 #endif
 	}
@@ -1006,7 +1022,7 @@
 			entry->peBlue  = colors[i].b;
 			entry->peFlags = PC_NOCOLLAPSE;
 		}
-#ifdef SYSPAL_NOSTATIC
+#if defined(SYSPAL_NOSTATIC) && !defined(_WIN32_WCE)
 		/* Check to make sure black and white are in position */
 		if ( GetSystemPaletteUse(hdc) != SYSPAL_NOSTATIC256 ) {
 			moved_entries += CheckPaletteEntry(screen_logpal, 0, 0x00, 0x00, 0x00);
@@ -1227,7 +1243,7 @@
 /* Exported for the windows message loop only */
 static void DIB_GrabStaticColors(HWND window)
 {
-#ifdef SYSPAL_NOSTATIC
+#if defined(SYSPAL_NOSTATIC) && !defined(_WIN32_WCE)
 	HDC hdc;
 
 	hdc = GetDC(window);
@@ -1240,7 +1256,7 @@
 }
 static void DIB_ReleaseStaticColors(HWND window)
 {
-#ifdef SYSPAL_NOSTATIC
+#if defined(SYSPAL_NOSTATIC) && !defined(_WIN32_WCE)
 	HDC hdc;
 
 	hdc = GetDC(window);