aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/PalmOS/Src/os5_gfx.cpp
diff options
context:
space:
mode:
authorChris Apers2007-01-21 09:54:27 +0000
committerChris Apers2007-01-21 09:54:27 +0000
commit0e5871b0ae868cb9401ce307c425935c4ed5220d (patch)
tree31edda2be8250bd10ed992e9c0a9dad09ef4b34d /backends/platform/PalmOS/Src/os5_gfx.cpp
parente1eb9dde12ae9ac6ae41b89234472fffea7f9954 (diff)
downloadscummvm-rg350-0e5871b0ae868cb9401ce307c425935c4ed5220d.tar.gz
scummvm-rg350-0e5871b0ae868cb9401ce307c425935c4ed5220d.tar.bz2
scummvm-rg350-0e5871b0ae868cb9401ce307c425935c4ed5220d.zip
Ooops, ooops ooops, bad source directory
svn-id: r25142
Diffstat (limited to 'backends/platform/PalmOS/Src/os5_gfx.cpp')
-rw-r--r--backends/platform/PalmOS/Src/os5_gfx.cpp144
1 files changed, 72 insertions, 72 deletions
diff --git a/backends/platform/PalmOS/Src/os5_gfx.cpp b/backends/platform/PalmOS/Src/os5_gfx.cpp
index 0cbf10154b..295c753604 100644
--- a/backends/platform/PalmOS/Src/os5_gfx.cpp
+++ b/backends/platform/PalmOS/Src/os5_gfx.cpp
@@ -23,6 +23,8 @@
*/
#include "be_os5.h"
+#include "graphics/surface.h"
+#include "common/config-manager.h"
#include <PenInputMgr.h>
#include <palmOneResources.h>
@@ -53,11 +55,22 @@ void OSystem_PalmOS5::load_gfx_mode() {
return;
_gfxLoaded = true;
+ // get command line config
+// _fullscreen = ConfMan.getBool("fullscreen"); // TODO : (NORMAL mode)
+ _ratio.adjustAspect = ConfMan.getBool("aspect_ratio") ? kRatioHeight : kRatioNone;
+
+ // precalc ratio (WIDE mode)
+ _ratio.width = (gVars->screenFullHeight * _screenWidth / _screenHeight);
+ _ratio.height = (gVars->screenFullWidth * _screenHeight / _screenWidth);
_mouseBackupP = (byte *)MemPtrNew(MAX_MOUSE_W * MAX_MOUSE_H * 2); // *2 if 16bit
_mouseDataP = (byte *)MemPtrNew(MAX_MOUSE_W * MAX_MOUSE_H);
_offScreenP = (byte *)malloc(_screenWidth * _screenHeight);
+ MemSet(_offScreenP, _screenWidth * _screenHeight, 0);
+ MemSet(_nativePal, sizeof(_nativePal), 0);
+ MemSet(_currentPalette, sizeof(_currentPalette), 0);
+
UInt32 depth = 16;
WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL);
clearScreen();
@@ -66,17 +79,13 @@ void OSystem_PalmOS5::load_gfx_mode() {
gVars->indicator.off = RGBToColor(0,0,0);
_overlayH = alloc_screen(_screenWidth, _screenHeight);
- _screenH = WinGetDisplayWindow();
-
_overlayP = (OverlayColor *)(BmpGetBits(WinGetBitmap(_overlayH)));
- _screenP = (byte *)(BmpGetBits(WinGetBitmap(_screenH)));
- MemSet(_offScreenP, _screenWidth * _screenHeight, 0);
- MemSet(_nativePal, sizeof(_nativePal), 0);
- MemSet(_currentPalette, sizeof(_currentPalette), 0);
+ _screenH = WinGetDisplayWindow();
+ _screenP = (byte *)(BmpGetBits(WinGetBitmap(_screenH)));
- _isSwitchable = (_screenWidth == 320 && _screenHeight == 200 && OPTIONS_TST(kOptCollapsible));
- if (_screenWidth > 320 || _screenHeight > 200 || !_isSwitchable)
+ _isSwitchable = OPTIONS_TST(kOptModeLandscape) && OPTIONS_TST(kOptCollapsible);
+ if (!_isSwitchable)
_mode = GFX_NORMAL;
hotswap_gfx_mode(_mode);
@@ -84,25 +93,30 @@ void OSystem_PalmOS5::load_gfx_mode() {
void OSystem_PalmOS5::hotswap_gfx_mode(int mode) {
Err e;
- UInt32 device;
if (_mode != GFX_NORMAL && !_isSwitchable)
return;
- if (_workScreenH)
- WinDeleteWindow(_workScreenH, false);
- _workScreenH = NULL;
-
#ifdef PALMOS_ARM
+ UInt32 device;
Boolean isT3 = false;
if (!FtrGet(sysFileCSystem, sysFtrNumOEMDeviceID, &device))
isT3 = (device == kPalmOneDeviceIDTungstenT3);
#endif
+ if (_workScreenH)
+ WinDeleteWindow(_workScreenH, false);
+ _workScreenH = NULL;
+
+ _screenDest.w = _screenWidth;
+ _screenDest.h = _screenHeight;
+
// prevent bad DIA redraw (Stat part)
- if (mode == GFX_NORMAL) {
- // only if this API is available
- if (_stretched && OPTIONS_TST(kOptCollapsible)) {
+ if (mode == GFX_NORMAL) {
+ _redawOSD = true;
+ _stretched = (_screenWidth > gVars->screenWidth);
+
+ if (OPTIONS_TST(kOptCollapsible)) {
#ifdef PALMOS_ARM
if (isT3) {
//AiaSetInputAreaState(aiaInputAreaShow);
@@ -116,72 +130,49 @@ void OSystem_PalmOS5::hotswap_gfx_mode(int mode) {
}
}
- _redawOSD = true;
- _stretched = false;
- OPTIONS_RST(kOptDisableOnScrDisp);
- _screenDest.w = _screenWidth;
- _screenDest.h = _screenHeight;
-
- if (_wasRotated) {
- // restore controls rotation
- SWAP(_keyMouse.bitLeft, _keyMouse.bitRight);
- SWAP(_keyMouse.bitRight, _keyMouse.bitDown);
- SWAP(_keyMouse.bitLeft, _keyMouse.bitUp);
- _wasRotated = false;
+ if (_stretched) {
+ calc_rect(false);
+ } else {
+ // offsets
+ _screenOffset.x = (gVars->screenWidth - _screenWidth) / 2;
+ _screenOffset.y = (gVars->screenHeight - _screenHeight) / 2;
}
- _workScreenH = alloc_screen(_screenWidth, _screenHeight);
- _workScreenP = (int16 *)(BmpGetBits(WinGetBitmap(_workScreenH)));
- MemSet(_workScreenP, _screenWidth * _screenHeight * 2, 0);
-
- _screenOffset.x = (gVars->screenWidth - _screenWidth) / 2;
- _screenOffset.y = (gVars->screenHeight - _screenHeight) / 2;
-
- _render = &OSystem_PalmOS5::render_1x;
-
} else {
-#ifdef PALMOS_ARM
- // T3 DIA library is 68k base, there is no possible native call
- if (isT3) {
- //AiaSetInputAreaState(aiaInputAreaFullScreen);
- PINSetInputAreaState_68k(pinInputAreaClosed);
- StatHide_68k();
- } else
-#endif
- {
- PINSetInputAreaState(pinInputAreaClosed);
- StatHide();
- }
-
_redawOSD = false;
_stretched = true;
- OPTIONS_SET(kOptDisableOnScrDisp);
- if (OPTIONS_TST(kOptModeLandscape)) {
- _screenDest.w = 480;
- _screenDest.h = 300;
- _workScreenH = alloc_screen(480, 300);
- _render = &OSystem_PalmOS5::render_landscape;
-
- } else {
- _screenDest.w = 300;
- _screenDest.h = 480;
- _workScreenH = alloc_screen(300, 480);
- _render = &OSystem_PalmOS5::render_portrait;
- // This mode need a controls rotation
- SWAP(_keyMouse.bitLeft, _keyMouse.bitUp);
- SWAP(_keyMouse.bitRight, _keyMouse.bitDown);
- SWAP(_keyMouse.bitLeft, _keyMouse.bitRight);
- _wasRotated = true;
+ if (OPTIONS_TST(kOptCollapsible)) {
+#ifdef PALMOS_ARM
+ // T3 DIA library is 68k base, there is no possible native call
+ if (isT3) {
+ //AiaSetInputAreaState(aiaInputAreaFullScreen);
+ PINSetInputAreaState_68k(pinInputAreaClosed);
+ StatHide_68k();
+ } else
+#endif
+ {
+ PINSetInputAreaState(pinInputAreaClosed);
+ StatHide();
+ }
}
- _workScreenP = (int16 *)(BmpGetBits(WinGetBitmap(_workScreenH)));
- MemSet(_workScreenP, 480 * 300 * 2, 0);
+ calc_rect(true);
+ }
- _screenOffset.x = 0;
- _screenOffset.y = 10;
+ if (_stretched) {
+ calc_scale();
+ OPTIONS_SET(kOptDisableOnScrDisp);
+ _render = &OSystem_PalmOS5::render_landscapeAny;
+ } else {
+ OPTIONS_RST(kOptDisableOnScrDisp);
+ _render = &OSystem_PalmOS5::render_1x;
}
+ _workScreenH = alloc_screen(_screenDest.w, _screenDest.h);
+ _workScreenP = (int16 *)(BmpGetBits(WinGetBitmap(_workScreenH)));
+ MemSet(_workScreenP, _screenDest.w * _screenDest.h * 2, 0);
+
_mode = mode;
clearScreen();
}
@@ -246,6 +237,15 @@ void OSystem_PalmOS5::copyRectToScreen(const byte *buf, int pitch, int x, int y,
}
}
+bool OSystem_PalmOS5::grabRawScreen(Graphics::Surface *surf) {
+ assert(surf);
+
+ surf->create(_screenWidth, _screenHeight, 1);
+ MemMove(surf->pixels, _offScreenP, _screenWidth * _screenHeight);
+
+ return true;
+}
+
void OSystem_PalmOS5::int_updateScreen() {
RectangleType r;
PointType p;
@@ -314,4 +314,4 @@ void OSystem_PalmOS5::draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8
MemPtrUnlock(bmTemp);
DmReleaseResource(hTemp);
}
-} \ No newline at end of file
+}