[Scummvm-cvs-logs] CVS: scummvm/backends/wince wince-sdl.cpp,1.25,1.26 wince-sdl.h,1.17,1.18
Nicolas Bacca
arisme at users.sourceforge.net
Wed Mar 16 14:28:02 CET 2005
Update of /cvsroot/scummvm/scummvm/backends/wince
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10594
Modified Files:
wince-sdl.cpp wince-sdl.h
Log Message:
Fix head first crash. Virtual functions + one parameter added == fun :p
Index: wince-sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/wince-sdl.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- wince-sdl.cpp 15 Mar 2005 09:43:37 -0000 1.25
+++ wince-sdl.cpp 16 Mar 2005 22:27:11 -0000 1.26
@@ -744,6 +744,7 @@
_transactionDetails.h = h;
_transactionDetails.overlayScale = overlayScale;
_transactionDetails.sizeChanged = true;
+ _transactionDetails.needUnload = true;
return;
break;
case kTransactionCommit:
@@ -765,7 +766,8 @@
if (w != _screenWidth || h != _screenHeight)
_scalersChanged = false;
- OSystem_SDL::initSize(w, h, overlayScale);
+ //OSystem_SDL::initSize(w, h, overlayScale);
+ OSystem_SDL::initSize(w, h, 1);
if (_scalersChanged) {
unloadGFXMode();
@@ -1039,6 +1041,18 @@
if (_tmpscreen == NULL)
error("_tmpscreen failed");
+
+
+ // Overlay
+ _overlayscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _overlayWidth, _overlayHeight, 16, 0, 0, 0, 0);
+ if (_overlayscreen == NULL)
+ error("_overlayscreen failed");
+ _tmpscreen2 = SDL_CreateRGBSurface(SDL_SWSURFACE, _overlayWidth + 3, _overlayHeight + 3, 16, 0, 0, 0, 0);
+ if (_tmpscreen2 == NULL)
+ error("_tmpscreen2 failed");
+
+
+
// Toolbar
uint16 *toolbar_screen = (uint16 *)calloc(320 * 40, sizeof(uint16));
_toolbarLow = SDL_CreateRGBSurfaceFrom(toolbar_screen,
@@ -1144,6 +1158,7 @@
}
void OSystem_WINCE3::internUpdateScreen() {
+ SDL_Surface *srcSurf, *origSurf;
assert(_hwscreen != NULL);
update_keyboard();
@@ -1177,6 +1192,15 @@
_forceFull = true;
}
+ if (!_overlayVisible) {
+ origSurf = _screen;
+ srcSurf = _tmpscreen;
+ }
+ else {
+ origSurf = _overlayscreen;
+ srcSurf = _tmpscreen2;
+ }
+
// Force a full redraw if requested
if (_forceFull) {
_numDirtyRects = 1;
@@ -1205,8 +1229,7 @@
bool toolbarVisible = _toolbarHandler.visible();
int toolbarOffset = _toolbarHandler.getOffset();
- if (_scalerProc == Normal1x && !_adjustAspectRatio) {
- SDL_Surface *target = _overlayVisible ? _tmpscreen : _screen;
+ if (_scalerProc == Normal1x && !_adjustAspectRatio && 0) {
for (r = _dirtyRectList; r != last_rect; ++r) {
dst = *r;
@@ -1221,24 +1244,22 @@
dst.y--;
}
dst.y += _currentShakePos;
- if (SDL_BlitSurface(target, r, _hwscreen, &dst) != 0)
+ if (SDL_BlitSurface(origSurf, r, _hwscreen, &dst) != 0)
error("SDL_BlitSurface failed: %s", SDL_GetError());
}
} else {
- if (!_overlayVisible) {
for (r = _dirtyRectList; r != last_rect; ++r) {
dst = *r;
dst.x++; // Shift rect by one since 2xSai needs to acces the data around
dst.y++; // any pixel to scale it, and we want to avoid mem access crashes.
- if (SDL_BlitSurface(_screen, r, _tmpscreen, &dst) != 0)
+ if (SDL_BlitSurface(origSurf, r, srcSurf, &dst) != 0)
error("SDL_BlitSurface failed: %s", SDL_GetError());
}
- }
- SDL_LockSurface(_tmpscreen);
+ SDL_LockSurface(srcSurf);
SDL_LockSurface(_hwscreen);
- srcPitch = _tmpscreen->pitch;
+ srcPitch = srcSurf->pitch;
dstPitch = _hwscreen->pitch;
for (r = _dirtyRectList; r != last_rect; ++r) {
@@ -1265,10 +1286,10 @@
}
if (!_zoomDown)
- _scalerProc((byte *)_tmpscreen->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
+ _scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
(byte *)_hwscreen->pixels + (r->x * 2 * _scaleFactorXm / _scaleFactorXd) + dst_y * dstPitch, dstPitch, r->w, dst_h);
else {
- _scalerProc((byte *)_tmpscreen->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
+ _scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
(byte *)_hwscreen->pixels + (r->x * 2 * _scaleFactorXm / _scaleFactorXd) + (dst_y - 240) * dstPitch, dstPitch, r->w, dst_h);
}
}
@@ -1285,7 +1306,7 @@
r->h = stretch200To240((uint8 *) _hwscreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y);
*/
}
- SDL_UnlockSurface(_tmpscreen);
+ SDL_UnlockSurface(srcSurf);
SDL_UnlockSurface(_hwscreen);
}
@@ -1430,7 +1451,7 @@
}
}
-void OSystem_WINCE3::addDirtyRect(int x, int y, int w, int h) {
+void OSystem_WINCE3::addDirtyRect(int x, int y, int w, int h, bool mouseRect) {
// Align on boundaries
if (_scaleFactorXd > 1) {
while (x % _scaleFactorXd) {
@@ -1471,7 +1492,7 @@
}
}
- OSystem_SDL::addDirtyRect(x, y, w, h);
+ OSystem_SDL::addDirtyRect(x, y, w, h, mouseRect);
}
// FIXME
Index: wince-sdl.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/wince-sdl.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- wince-sdl.h 15 Mar 2005 09:43:38 -0000 1.17
+++ wince-sdl.h 16 Mar 2005 22:27:11 -0000 1.18
@@ -56,7 +56,7 @@
// Overloaded from SDL_Common (mouse and new scaler handling)
void fillMouseEvent(Event &event, int x, int y);
// Overloaded from SDL_Common (new scaler handling)
- void addDirtyRect(int x, int y, int w, int h);
+ void addDirtyRect(int x, int y, int w, int h, bool mouseRect = false);
// Overloaded from SDL_Common (new scaler handling)
void warpMouse(int x, int y);
// Overloaded from SDL_Commmon
More information about the Scummvm-git-logs
mailing list