- // NOTE: Only 1-char colornames are supported
- Con_Printf("Sorry, but this does not even look similar to an XPM.\n");
- return;
- }
+ data = (char *) loadimagepixelsbgra("darkplaces-icon", false, false, false, NULL);
+ if(data)
+ {
+ unsigned int red = 0x00FF0000;
+ unsigned int green = 0x0000FF00;
+ unsigned int blue = 0x000000FF;
+ unsigned int alpha = 0xFF000000;
+ width = image_width;
+ height = image_height;
+
+ // reallocate with malloc, as this is in tempmempool (do not want)
+ xpm = data;
+ data = malloc(width * height * 4);
+ memcpy(data, xpm, width * height * 4);
+ Mem_Free(xpm);
+ xpm = NULL;
+
+ icon = SDL_CreateRGBSurface(SDL_SRCALPHA, width, height, 32, LittleLong(red), LittleLong(green), LittleLong(blue), LittleLong(alpha));
+
+ if(icon == NULL) {
+ Con_Printf( "Failed to create surface for the window Icon!\n"
+ "%s\n", SDL_GetError());
+ free(data);
+ return;
+ }