[Scummvm-cvs-logs] CVS: residual driver.h,1.10,1.11 driver_gl.cpp,1.50,1.51 driver_gl.h,1.23,1.24 driver_tinygl.cpp,1.18,1.19 driver_tinygl.h,1.10,1.11 lua.cpp,1.136,1.137
Pawel Kolodziejski
aquadran at users.sourceforge.net
Fri Apr 8 11:30:02 CEST 2005
Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13010
Modified Files:
driver.h driver_gl.cpp driver_gl.h driver_tinygl.cpp
driver_tinygl.h lua.cpp
Log Message:
added snapshot for tinygl driver
Index: driver.h
===================================================================
RCS file: /cvsroot/scummvm/residual/driver.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- driver.h 7 Apr 2005 20:06:25 -0000 1.10
+++ driver.h 8 Apr 2005 18:29:12 -0000 1.11
@@ -81,7 +81,7 @@
virtual void drawDepthBitmap(int x, int y, int w, int h, char *data) = 0;
- virtual void getSnapshot(int x, int y, int w, int h, char **data, int flags) = 0;
+ virtual Bitmap *getScreenshot(int w, int h) = 0;
virtual void enableDim(int x, int y, int w, int h) = 0;
virtual void disableDim(int x, int y, int w, int h) = 0;
Index: driver_gl.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_gl.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- driver_gl.cpp 8 Apr 2005 10:19:46 -0000 1.50
+++ driver_gl.cpp 8 Apr 2005 18:29:12 -0000 1.51
@@ -689,7 +689,8 @@
delete[] (GLuint *)handle->texIds;
}
-void DriverGL::getSnapshot(int x, int y, int w, int h, char **data, int flags) {
+Bitmap *DriverGL::getScreenshot(int w, int h) {
+ return NULL;
}
void DriverGL::drawDim() {
Index: driver_gl.h
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_gl.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- driver_gl.h 7 Apr 2005 20:06:26 -0000 1.23
+++ driver_gl.h 8 Apr 2005 18:29:13 -0000 1.24
@@ -65,7 +65,7 @@
void drawDepthBitmap(int x, int y, int w, int h, char *data);
void drawBitmap();
- void getSnapshot(int x, int y, int w, int h, char **data, int flags);
+ Bitmap *getScreenshot(int w, int h);
void enableDim(int x, int y, int w, int h) { _dim = true; }
void disableDim(int x, int y, int w, int h) { _dim = false; }
Index: driver_tinygl.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_tinygl.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- driver_tinygl.cpp 8 Apr 2005 09:33:21 -0000 1.18
+++ driver_tinygl.cpp 8 Apr 2005 18:29:13 -0000 1.19
@@ -473,7 +473,22 @@
SDL_FreeSurface((SDL_Surface *)handle->surface);
}
-void DriverTinyGL::getSnapshot(int x, int y, int w, int h, char **data, int flags) {
+Bitmap *DriverTinyGL::getScreenshot(int w, int h) {
+ uint16 *buffer = new uint16[w * h];
+ assert(buffer);
+
+ float step_x = 640.0 / w;
+ float step_y = 480.0 / h;
+ int step = 0;
+ for (float y = 0; y < 479; y += step_y) {
+ for (float x = 0; x < 639; x += step_x) {
+ buffer[step++] = *((uint16 *)(_screen->pixels) + (int)y * 640 + (int)x);
+ }
+ }
+
+ Bitmap *screenshot = new Bitmap((char *)buffer, w, h, "screenshot");
+ delete []buffer;
+ return screenshot;
}
void DriverTinyGL::drawDim() {
Index: driver_tinygl.h
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_tinygl.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- driver_tinygl.h 7 Apr 2005 20:06:26 -0000 1.10
+++ driver_tinygl.h 8 Apr 2005 18:29:13 -0000 1.11
@@ -67,7 +67,7 @@
void drawDepthBitmap(int x, int y, int w, int h, char *data);
void drawBitmap();
- void getSnapshot(int x, int y, int w, int h, char **data, int flags);
+ Bitmap *getScreenshot(int w, int h);
void enableDim(int x, int y, int w, int h) { _dim = true; }
void disableDim(int x, int y, int w, int h) { _dim = false; }
Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -d -r1.136 -r1.137
--- lua.cpp 8 Apr 2005 17:32:02 -0000 1.136
+++ lua.cpp 8 Apr 2005 18:29:13 -0000 1.137
@@ -1312,6 +1312,8 @@
std::string dir_strWin32 = path;
g_searchFile = FindFirstFile(dir_strWin32.c_str(), &g_find_file_data);
g_firstFind = true;
+ if (g_searchFile == INVALID_HANDLE_VALUE)
+ g_searchFile = NULL;
#else
g_searchFile = opendir(path);
#endif
@@ -1532,7 +1534,7 @@
* a lot of the operations necessary to use the menu
*/
bool menuChanged = false, sliderChanged = false;
- switch(key) {
+ switch (key) {
case SDLK_ESCAPE:
{
lua_Object close = getTableFunction(menuTable, "cancel");
@@ -1881,6 +1883,15 @@
}
static void ScreenShot() {
+ int width = check_int(1);
+ int height = check_int(2);
+
+ Bitmap *screenshot = g_driver->getScreenshot(width, height);
+ if (screenshot) {
+ lua_pushusertag(screenshot, MKID('VBUF'));
+ } else {
+ lua_pushnil();
+ }
}
static void SubmitSaveGameData() {
More information about the Scummvm-git-logs
mailing list