aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorMax Horn2002-10-14 11:02:27 +0000
committerMax Horn2002-10-14 11:02:27 +0000
commite8f3f1706755f8da74afb85898c1628ca466b6a9 (patch)
treeff5393af1227c3af4304989da1fca3faac27d894 /backends
parent2d18fc9e053746c78ca15561588b797e8908bde7 (diff)
downloadscummvm-rg350-e8f3f1706755f8da74afb85898c1628ca466b6a9.tar.gz
scummvm-rg350-e8f3f1706755f8da74afb85898c1628ca466b6a9.tar.bz2
scummvm-rg350-e8f3f1706755f8da74afb85898c1628ca466b6a9.zip
renamed get_320x200_image() to get_screen_image(); cleanup
svn-id: r5145
Diffstat (limited to 'backends')
-rw-r--r--backends/sdl/sdl-common.cpp4
-rw-r--r--backends/sdl/sdl-common.h2
-rw-r--r--backends/sdl/sdl.cpp52
-rw-r--r--backends/sdl/sdl_gl.cpp3
4 files changed, 39 insertions, 22 deletions
diff --git a/backends/sdl/sdl-common.cpp b/backends/sdl/sdl-common.cpp
index 7229d2b204..aa9a825bf4 100644
--- a/backends/sdl/sdl-common.cpp
+++ b/backends/sdl/sdl-common.cpp
@@ -48,8 +48,10 @@ OSystem *OSystem_SDL_Common::create(int gfx_mode, bool full_screen) {
SDL_ShowCursor(SDL_DISABLE);
+#ifndef MACOSX // Don't set icon on OS X, as we use a nicer external icon there
// Setup the icon
syst->setup_icon();
+#endif
#ifndef MACOSX // Work around a bug in OS X
// Clean up on exit
@@ -634,7 +636,7 @@ bool OSystem_SDL_Common::set_sound_proc(void *param, SoundProc *proc, byte forma
/* retrieve the 320x200 bitmap currently being displayed */
-void OSystem_SDL_Common::get_320x200_image(byte *buf) {
+void OSystem_SDL_Common::get_screen_image(byte *buf) {
/* make sure the mouse is gone */
undraw_mouse();
diff --git a/backends/sdl/sdl-common.h b/backends/sdl/sdl-common.h
index 5712c2f84a..86ddf74068 100644
--- a/backends/sdl/sdl-common.h
+++ b/backends/sdl/sdl-common.h
@@ -187,7 +187,7 @@ protected:
virtual void unload_gfx_mode() = 0;
virtual void hotswap_gfx_mode() = 0;
- void get_320x200_image(byte *buf);
+ void get_screen_image(byte *buf);
void setup_icon();
void kbd_mouse();
diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp
index 0542deded5..8fb6df31b9 100644
--- a/backends/sdl/sdl.cpp
+++ b/backends/sdl/sdl.cpp
@@ -27,7 +27,7 @@
class OSystem_SDL_Normal : public OSystem_SDL_Common {
public:
- OSystem_SDL_Normal() : sdl_tmpscreen(0), sdl_hwscreen(0) {}
+ OSystem_SDL_Normal() : sdl_tmpscreen(0), sdl_hwscreen(0), _overlay_visible(false) {}
// Set colors of the palette
void set_palette(const byte *colors, uint start, uint num);
@@ -198,11 +198,8 @@ void OSystem_SDL_Normal::undraw_mouse() {
void OSystem_SDL_Normal::load_gfx_mode() {
_forceFull = true;
- _scaleFactor = 1;
- _mode_flags = 0;
- _overlay_visible = false;
+ _mode_flags = DF_WANT_RECT_OPTIM | DF_UPDATE_EXPAND_1_PIXEL;
- _scaler_proc = NULL;
sdl_tmpscreen = NULL;
TMP_SCREEN_WIDTH = (_screenWidth + 3);
@@ -243,26 +240,41 @@ normal_mode:;
_scaleFactor = 1;
_scaler_proc = Normal1x;
break;
+ default:
+ error("unknown gfx mode");
+ _scaleFactor = 1;
+ _scaler_proc = NULL;
}
+ //
+ // Create the surface that contains the 8 bit game data
+ //
_screen = SDL_CreateRGBSurface(SDL_SWSURFACE, _screenWidth, _screenHeight, 8, 0, 0, 0, 0);
if (_screen == NULL)
- error("_screen failed failed");
+ error("_screen failed");
- uint16 *tmp_screen = (uint16*)calloc(TMP_SCREEN_WIDTH*(_screenHeight+3),sizeof(uint16));
- _mode_flags = DF_WANT_RECT_OPTIM | DF_UPDATE_EXPAND_1_PIXEL;
+ //
+ // Create the surface that contains the scaled graphics in 16 bit mode
+ //
sdl_hwscreen = SDL_SetVideoMode(_screenWidth * _scaleFactor, _screenHeight * _scaleFactor, 16,
_full_screen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
);
if (sdl_hwscreen == NULL)
error("sdl_hwscreen failed");
- /* Need some extra bytes around when using 2XSAI */
- if (sdl_hwscreen->format->Rmask == 0x7C00) // HACK HACK HACK
+ //
+ // Create the surface used for the graphics in 16 bit before scaling, and also the overlay
+ //
+
+ // Distinguish 555 and 565 mode
+ if (sdl_hwscreen->format->Rmask == 0x7C00)
Init_2xSaI(555);
else
Init_2xSaI(565);
+
+ // Need some extra bytes around when using 2xSaI
+ uint16 *tmp_screen = (uint16*)calloc(TMP_SCREEN_WIDTH*(_screenHeight+3),sizeof(uint16));
sdl_tmpscreen = SDL_CreateRGBSurfaceFrom(tmp_screen,
TMP_SCREEN_WIDTH, _screenHeight + 3, 16, TMP_SCREEN_WIDTH*2,
sdl_hwscreen->format->Rmask,
@@ -402,40 +414,42 @@ void OSystem_SDL_Normal::update_screen() {
}
void OSystem_SDL_Normal::hotswap_gfx_mode() {
- /* hmm, need to allocate a 320x200 bitmap
- * which will contain the "backup" of the screen during the change.
- * then draw that to the new screen right after it's setup.
+ /* We allocate a screen sized bitmap which contains a "backup"
+ * of the screen data during the change. Then we draw that to
+ * the new screen right after it's setup.
*/
byte *bak_mem = (byte*)malloc(_screenWidth*_screenHeight);
- get_320x200_image(bak_mem);
+ get_screen_image(bak_mem);
unload_gfx_mode();
load_gfx_mode();
- _forceFull = true;
-
// reset palette
SDL_SetColors(_screen, _currentPalette, 0, 256);
// blit image
- OSystem_SDL_Normal::copy_rect(bak_mem, _screenWidth, 0, 0, _screenWidth, _screenHeight);
+ copy_rect(bak_mem, _screenWidth, 0, 0, _screenWidth, _screenHeight);
free(bak_mem);
- OSystem_SDL_Normal::update_screen();
+ update_screen();
}
uint32 OSystem_SDL_Normal::property(int param, Property *value) {
if (param == PROP_TOGGLE_FULLSCREEN) {
+ assert(sdl_hwscreen != 0);
_full_screen ^= true;
if (!SDL_WM_ToggleFullScreen(sdl_hwscreen)) {
- /* if ToggleFullScreen fails, achieve the same effect with hotswap gfx mode */
+ // if ToggleFullScreen fails, achieve the same effect with hotswap gfx mode
hotswap_gfx_mode();
}
return 1;
+ } else if (param == PROP_OVERLAY_IS_565) {
+ assert(sdl_tmpscreen != 0);
+ return (sdl_tmpscreen->format->Rmask != 0x7C00);
}
return OSystem_SDL_Common::property(param, value);
diff --git a/backends/sdl/sdl_gl.cpp b/backends/sdl/sdl_gl.cpp
index 67626a7ea0..2f21850e37 100644
--- a/backends/sdl/sdl_gl.cpp
+++ b/backends/sdl/sdl_gl.cpp
@@ -154,12 +154,13 @@ void OSystem_SDL_GL::hotswap_gfx_mode() {
byte *bak_mem = (byte*)malloc(_screenWidth*_screenHeight);
- get_320x200_image(bak_mem);
+ get_screen_image(bak_mem);
unload_gfx_mode();
load_gfx_mode();
fb2gl.setPalette(0,256);
+ // FIXME - this seems to be tied to 320x200 - what about Zak256 which needs 320x240 ?
fb2gl.update(_screen->pixels,320,200,320,0,_currentShakePos);
/* blit image */