RECORDER: Implement Events Recorder
This commit is contained in:
parent
4a62d6c25a
commit
f59512c47e
98 changed files with 5350 additions and 1918 deletions
|
@ -134,7 +134,7 @@ static bool grabScreen565(Graphics::Surface *surf) {
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool createThumbnail(Graphics::Surface &out, Graphics::Surface &in) {
|
||||
bool createThumbnail(Graphics::Surface &out, Graphics::Surface &in) {
|
||||
uint16 width = in.w;
|
||||
uint16 inHeight = in.h;
|
||||
|
||||
|
@ -206,7 +206,7 @@ static bool createThumbnail(Graphics::Surface &out, Graphics::Surface &in) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool createThumbnailFromScreen(Graphics::Surface* surf) {
|
||||
bool createThumbnailFromScreen(Graphics::Surface *surf) {
|
||||
assert(surf);
|
||||
|
||||
Graphics::Surface screen;
|
||||
|
@ -236,3 +236,31 @@ bool createThumbnail(Graphics::Surface *surf, const uint8 *pixels, int w, int h,
|
|||
|
||||
return createThumbnail(*surf, screen);
|
||||
}
|
||||
|
||||
// this is somewhat awkward, but createScreenShot should logically be in graphics,
|
||||
// but moving other functions in this file into that namespace breaks several engines
|
||||
namespace Graphics {
|
||||
bool createScreenShot(Graphics::Surface &surf) {
|
||||
Graphics::PixelFormat screenFormat = g_system->getScreenFormat();
|
||||
//convert surface to 2 bytes pixel format to avoid problems with palette saving and loading
|
||||
if ((screenFormat.bytesPerPixel == 1) || (screenFormat.bytesPerPixel == 2)) {
|
||||
return grabScreen565(&surf);
|
||||
} else {
|
||||
Graphics::Surface *screen = g_system->lockScreen();
|
||||
if (!screen) {
|
||||
return false;
|
||||
}
|
||||
surf.create(screen->w, screen->h, Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
|
||||
for (uint y = 0; y < screen->h; ++y) {
|
||||
for (uint x = 0; x < screen->w; ++x) {
|
||||
byte r = 0, g = 0, b = 0, a = 0;
|
||||
uint32 col = READ_UINT32(screen->getBasePtr(x, y));
|
||||
screenFormat.colorToARGB(col, a, r, g, b);
|
||||
((uint32 *)surf.pixels)[y * surf.w + x] = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(a, r, g, b);
|
||||
}
|
||||
}
|
||||
g_system->unlockScreen();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} // End of namespace Graphics
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue