VIDEO: Do not set Surface::pixels directly anymore.

This commit is contained in:
Johannes Schickel 2013-08-03 04:11:40 +02:00
parent 9a80fa88e0
commit 0cb1504a5b
3 changed files with 10 additions and 20 deletions

View File

@ -97,12 +97,8 @@ void CoktelDecoder::setSurfaceMemory(void *mem, uint16 width, uint16 height, uin
assert(bpp == getPixelFormat().bytesPerPixel);
// Create a surface over this memory
_surface.w = width;
_surface.h = height;
_surface.pitch = width * bpp;
_surface.pixels = mem;
// TODO: Check whether it is fine to assume we want the setup PixelFormat.
_surface.format = getPixelFormat();
_surface.init(width, height, width * bpp, mem, getPixelFormat());
_ownSurface = false;
}
@ -143,7 +139,7 @@ void CoktelDecoder::freeSurface() {
_surface.w = 0;
_surface.h = 0;
_surface.pitch = 0;
_surface.pixels = 0;
_surface.setPixels(0);
_surface.format = Graphics::PixelFormat();
} else
_surface.free();
@ -1879,11 +1875,8 @@ bool VMDDecoder::assessVideoProperties() {
_videoBuffer[i] = new byte[_videoBufferSize];
memset(_videoBuffer[i], 0, _videoBufferSize);
_8bppSurface[i].w = _width * _bytesPerPixel;
_8bppSurface[i].h = _height;
_8bppSurface[i].pitch = _width * _bytesPerPixel;
_8bppSurface[i].pixels = _videoBuffer[i];
_8bppSurface[i].format = Graphics::PixelFormat::createFormatCLUT8();
_8bppSurface[i].init(_width * _bytesPerPixel, _height, _width * _bytesPerPixel,
_videoBuffer[i], Graphics::PixelFormat::createFormatCLUT8());
}
}

View File

@ -521,17 +521,17 @@ const Graphics::Surface *DXADecoder::DXAVideoTrack::decodeNextFrame() {
memcpy(&_scaledBuffer[2 * cy * _width], &_frameBuffer1[cy * _width], _width);
memset(&_scaledBuffer[((2 * cy) + 1) * _width], 0, _width);
}
_surface->pixels = _scaledBuffer;
_surface->setPixels(_scaledBuffer);
break;
case S_DOUBLE:
for (int cy = 0; cy < _curHeight; cy++) {
memcpy(&_scaledBuffer[2 * cy * _width], &_frameBuffer1[cy * _width], _width);
memcpy(&_scaledBuffer[((2 * cy) + 1) * _width], &_frameBuffer1[cy * _width], _width);
}
_surface->pixels = _scaledBuffer;
_surface->setPixels(_scaledBuffer);
break;
case S_NONE:
_surface->pixels = _frameBuffer1;
_surface->setPixels(_frameBuffer1);
break;
}

View File

@ -262,11 +262,8 @@ TheoraDecoder::TheoraVideoTrack::TheoraVideoTrack(const Graphics::PixelFormat &f
_surface.create(theoraInfo.frame_width, theoraInfo.frame_height, format);
// Set up a display surface
_displaySurface.pixels = _surface.getBasePtr(theoraInfo.pic_x, theoraInfo.pic_y);
_displaySurface.w = theoraInfo.pic_width;
_displaySurface.h = theoraInfo.pic_height;
_displaySurface.format = format;
_displaySurface.pitch = _surface.pitch;
_displaySurface.init(theoraInfo.pic_width, theoraInfo.pic_height, _surface.pitch,
_surface.getBasePtr(theoraInfo.pic_x, theoraInfo.pic_y), format);
// Set the frame rate
_frameRate = Common::Rational(theoraInfo.fps_numerator, theoraInfo.fps_denominator);
@ -280,7 +277,7 @@ TheoraDecoder::TheoraVideoTrack::~TheoraVideoTrack() {
th_decode_free(_theoraDecode);
_surface.free();
_displaySurface.pixels = 0;
_displaySurface.setPixels(0);
}
bool TheoraDecoder::TheoraVideoTrack::decodePacket(ogg_packet &oggPacket) {