aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorDavid Corrales2007-06-23 18:51:33 +0000
committerDavid Corrales2007-06-23 18:51:33 +0000
commitcacd7a28fd51d960947de88abbf30c487e66529d (patch)
treef3baa59853bfb307e452b86b9d93c4737b1fa6ab /graphics
parent0ac96302fe9c04df79cb01a77d19535b45fe2db0 (diff)
parent90c2210dae8c91fa8babc6b05564e15c9d445d18 (diff)
downloadscummvm-rg350-cacd7a28fd51d960947de88abbf30c487e66529d.tar.gz
scummvm-rg350-cacd7a28fd51d960947de88abbf30c487e66529d.tar.bz2
scummvm-rg350-cacd7a28fd51d960947de88abbf30c487e66529d.zip
Merged the FSNode branch with trunk r27031:27680
svn-id: r27681
Diffstat (limited to 'graphics')
-rw-r--r--graphics/dxa_player.cpp43
-rw-r--r--graphics/dxa_player.h4
-rw-r--r--graphics/scaler/thumbnail.cpp22
3 files changed, 37 insertions, 32 deletions
diff --git a/graphics/dxa_player.cpp b/graphics/dxa_player.cpp
index 5edf526b8f..6f2bca111e 100644
--- a/graphics/dxa_player.cpp
+++ b/graphics/dxa_player.cpp
@@ -35,6 +35,8 @@
namespace Graphics {
DXAPlayer::DXAPlayer() {
+ _fd = 0;
+
_frameBuffer1 = 0;
_frameBuffer2 = 0;
_scaledBuffer = 0;
@@ -57,25 +59,25 @@ DXAPlayer::~DXAPlayer() {
}
int DXAPlayer::getWidth() {
- if (!_fd.isOpen())
+ if (!_fd)
return 0;
return _width;
}
int DXAPlayer::getHeight() {
- if (!_fd.isOpen())
+ if (!_fd)
return 0;
return _height;
}
int DXAPlayer::getCurFrame() {
- if (!_fd.isOpen())
+ if (!_fd)
return -1;
return _frameNum;
}
int DXAPlayer::getFrameCount() {
- if (!_fd.isOpen())
+ if (!_fd)
return 0;
return _framesCount;
}
@@ -84,16 +86,19 @@ bool DXAPlayer::loadFile(const char *filename) {
uint32 tag;
int32 frameRate;
- if (!_fd.open(filename)) {
+ Common::File *file = new Common::File();
+ if (!file->open(filename)) {
return 0;
}
- tag = _fd.readUint32BE();
+ _fd = file;
+
+ tag = _fd->readUint32BE();
assert(tag == MKID_BE('DEXA'));
- uint8 flags = _fd.readByte();
- _framesCount = _fd.readUint16BE();
- frameRate = _fd.readUint32BE();
+ uint8 flags = _fd->readByte();
+ _framesCount = _fd->readUint16BE();
+ frameRate = _fd->readUint32BE();
if (frameRate > 0)
_framesPerSec = 1000 / frameRate;
@@ -107,8 +112,8 @@ bool DXAPlayer::loadFile(const char *filename) {
else
_frameTicks = frameRate;
- _width = _fd.readUint16BE();
- _height = _fd.readUint16BE();
+ _width = _fd->readUint16BE();
+ _height = _fd->readUint16BE();
if (flags & 0x80) {
_scaleMode = S_INTERLACED;
@@ -143,10 +148,10 @@ bool DXAPlayer::loadFile(const char *filename) {
}
void DXAPlayer::closeFile() {
- if (!_fd.isOpen())
+ if (!_fd)
return;
- _fd.close();
+ delete _fd;
free(_frameBuffer1);
free(_frameBuffer2);
free(_scaledBuffer);
@@ -478,20 +483,20 @@ void DXAPlayer::decode13(byte *data, int size, int totalSize) {
void DXAPlayer::decodeNextFrame() {
uint32 tag;
- tag = _fd.readUint32BE();
+ tag = _fd->readUint32BE();
if (tag == MKID_BE('CMAP')) {
byte rgb[768];
- _fd.read(rgb, ARRAYSIZE(rgb));
+ _fd->read(rgb, ARRAYSIZE(rgb));
setPalette(rgb);
}
- tag = _fd.readUint32BE();
+ tag = _fd->readUint32BE();
if (tag == MKID_BE('FRAM')) {
- byte type = _fd.readByte();
- uint32 size = _fd.readUint32BE();
+ byte type = _fd->readByte();
+ uint32 size = _fd->readUint32BE();
- _fd.read(_frameBuffer2, size);
+ _fd->read(_frameBuffer2, size);
switch (type) {
case 2:
diff --git a/graphics/dxa_player.h b/graphics/dxa_player.h
index 2b9d5f1228..b8155153c9 100644
--- a/graphics/dxa_player.h
+++ b/graphics/dxa_player.h
@@ -43,8 +43,6 @@ enum ScaleMode {
class DXAPlayer {
protected:
- Common::File _fd;
-
byte *_frameBuffer1;
byte *_frameBuffer2;
byte *_scaledBuffer;
@@ -63,6 +61,8 @@ public:
DXAPlayer();
virtual ~DXAPlayer();
+ Common::SeekableReadStream *_fd;
+
/**
* Returns the width of the video
* @return the width of the video
diff --git a/graphics/scaler/thumbnail.cpp b/graphics/scaler/thumbnail.cpp
index a6575f3ea3..40d0cba156 100644
--- a/graphics/scaler/thumbnail.cpp
+++ b/graphics/scaler/thumbnail.cpp
@@ -97,32 +97,32 @@ void createThumbnail(const uint8* src, uint32 srcPitch, uint8* dstPtr, uint32 ds
* Copies the current screen contents to a new surface, using RGB565 format.
* WARNING: surf->free() must be called by the user to avoid leaking.
*
- * @param surf the surfce to store the data in it
+ * @param surf the surface to store the data in it
*/
static bool grabScreen565(Graphics::Surface *surf) {
- Graphics::Surface screen;
- if (!g_system->grabRawScreen(&screen))
+ Graphics::Surface *screen = g_system->lockScreen();
+ if (!screen)
return false;
- assert(screen.bytesPerPixel == 1 && screen.pixels != 0);
+ assert(screen->bytesPerPixel == 1 && screen->pixels != 0);
byte palette[256 * 4];
g_system->grabPalette(&palette[0], 0, 256);
- surf->create(screen.w, screen.h, 2);
+ surf->create(screen->w, screen->h, 2);
- for (uint y = 0; y < screen.h; ++y) {
- for (uint x = 0; x < screen.w; ++x) {
+ for (uint y = 0; y < screen->h; ++y) {
+ for (uint x = 0; x < screen->w; ++x) {
byte r, g, b;
- r = palette[((uint8*)screen.pixels)[y * screen.pitch + x] * 4];
- g = palette[((uint8*)screen.pixels)[y * screen.pitch + x] * 4 + 1];
- b = palette[((uint8*)screen.pixels)[y * screen.pitch + x] * 4 + 2];
+ r = palette[((uint8*)screen->pixels)[y * screen->pitch + x] * 4];
+ g = palette[((uint8*)screen->pixels)[y * screen->pitch + x] * 4 + 1];
+ b = palette[((uint8*)screen->pixels)[y * screen->pitch + x] * 4 + 2];
((uint16*)surf->pixels)[y * surf->w + x] = (((r >> 3) & 0x1F) << 11) | (((g >> 2) & 0x3F) << 5) | ((b >> 3) & 0x1F);
}
}
- screen.free();
+ g_system->unlockScreen();
return true;
}