src/video/sdl_v.cpp
changeset 10390 0c2cc4c7b91f
parent 10084 a544278a1b43
equal deleted inserted replaced
10389:05465e8a465c 10390:0c2cc4c7b91f
   154 	int i;
   154 	int i;
   155 	int best;
   155 	int best;
   156 	uint delta;
   156 	uint delta;
   157 
   157 
   158 	// all modes available?
   158 	// all modes available?
   159 	if (_all_modes) return;
   159 	if (_all_modes || _num_resolutions == 0) return;
   160 
   160 
   161 	// is the wanted mode among the available modes?
   161 	// is the wanted mode among the available modes?
   162 	for (i = 0; i != _num_resolutions; i++) {
   162 	for (i = 0; i != _num_resolutions; i++) {
   163 		if (*w == _resolutions[i].width && *h == _resolutions[i].height) return;
   163 		if (*w == _resolutions[i].width && *h == _resolutions[i].height) return;
   164 	}
   164 	}
   211 		SDL_CALL SDL_FreeSurface(icon);
   211 		SDL_CALL SDL_FreeSurface(icon);
   212 	}
   212 	}
   213 
   213 
   214 	// DO NOT CHANGE TO HWSURFACE, IT DOES NOT WORK
   214 	// DO NOT CHANGE TO HWSURFACE, IT DOES NOT WORK
   215 	newscreen = SDL_CALL SDL_SetVideoMode(w, h, bpp, SDL_SWSURFACE | SDL_HWPALETTE | (_fullscreen ? SDL_FULLSCREEN : SDL_RESIZABLE));
   215 	newscreen = SDL_CALL SDL_SetVideoMode(w, h, bpp, SDL_SWSURFACE | SDL_HWPALETTE | (_fullscreen ? SDL_FULLSCREEN : SDL_RESIZABLE));
   216 	if (newscreen == NULL)
   216 	if (newscreen == NULL) {
       
   217 		DEBUG(driver, 0, "SDL: Couldn't allocate a window to draw on");
   217 		return false;
   218 		return false;
       
   219 	}
   218 
   220 
   219 	_screen.width = newscreen->w;
   221 	_screen.width = newscreen->w;
   220 	_screen.height = newscreen->h;
   222 	_screen.height = newscreen->h;
   221 	_screen.pitch = newscreen->pitch / (bpp / 8);
   223 	_screen.pitch = newscreen->pitch / (bpp / 8);
   222 	_sdl_screen = newscreen;
   224 	_sdl_screen = newscreen;