From 0cb1504a5b96ad90634a86af8cad30ecc6588517 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 04:11:40 +0200 Subject: VIDEO: Do not set Surface::pixels directly anymore. --- video/coktel_decoder.cpp | 15 ++++----------- video/dxa_decoder.cpp | 6 +++--- video/theora_decoder.cpp | 9 +++------ 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/video/coktel_decoder.cpp b/video/coktel_decoder.cpp index 32eef5acc3..40ac035582 100644 --- a/video/coktel_decoder.cpp +++ b/video/coktel_decoder.cpp @@ -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()); } } diff --git a/video/dxa_decoder.cpp b/video/dxa_decoder.cpp index 5ac9bd2088..27b1664b07 100644 --- a/video/dxa_decoder.cpp +++ b/video/dxa_decoder.cpp @@ -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; } diff --git a/video/theora_decoder.cpp b/video/theora_decoder.cpp index 63aa93e2f5..53e528faf2 100644 --- a/video/theora_decoder.cpp +++ b/video/theora_decoder.cpp @@ -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) { -- cgit v1.2.3