From 3c449e19ab6d8f42afba6476ff24bacd3cf32c3e Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 30 Sep 2010 13:05:12 +0000 Subject: VIDEO: Allow for scaled Indeo3 frames svn-id: r52953 --- graphics/video/codecs/indeo3.cpp | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/graphics/video/codecs/indeo3.cpp b/graphics/video/codecs/indeo3.cpp index c99afbd0d3..c4a6baba55 100644 --- a/graphics/video/codecs/indeo3.cpp +++ b/graphics/video/codecs/indeo3.cpp @@ -269,31 +269,40 @@ Surface *Indeo3Decoder::decodeImage(Common::SeekableReadStream *stream) { const byte *srcU = _cur_frame->Ubuf; const byte *srcV = _cur_frame->Vbuf; byte *dest = (byte *)_surface->pixels; + + uint32 scaleWidth = _surface->w / fWidth; + uint32 scaleHeight = _surface->h / fHeight; + for (uint32 y = 0; y < fHeight; y++) { byte *rowDest = dest; - for (uint32 x = 0; x < fWidth; x++, rowDest += _surface->bytesPerPixel) { - const byte cY = srcY[x]; - const byte cU = srcU[x >> 2]; - const byte cV = srcV[x >> 2]; + for (uint32 sH = 0; sH < scaleHeight; sH++) { + for (uint32 x = 0; x < fWidth; x++) { + const byte cY = srcY[x]; + const byte cU = srcU[x >> 2]; + const byte cV = srcV[x >> 2]; + + byte r = 0, g = 0, b = 0; + YUV2RGB(cY, cU, cV, r, g, b); - byte r = 0, g = 0, b = 0; - YUV2RGB(cY, cU, cV, r, g, b); + const uint32 color = _pixelFormat.RGBToColor(r, g, b); - const uint32 color = _pixelFormat.RGBToColor(r, g, b); + for (uint32 sW = 0; sW < scaleWidth; sW++, rowDest += _surface->bytesPerPixel) { + if (_surface->bytesPerPixel == 1) + *((uint8 *)rowDest) = (uint8)color; + else if (_surface->bytesPerPixel == 2) + *((uint16 *)rowDest) = (uint16)color; + } + } - if (_surface->bytesPerPixel == 1) - *((uint8 *)rowDest) = (uint8)color; - else if (_surface->bytesPerPixel == 2) - *((uint16 *)rowDest) = (uint16)color; + dest += _surface->pitch; } - dest += _surface->pitch; srcY += fWidth; if ((y & 3) == 3) { - srcU += fWidth >> 2; - srcV += fWidth >> 2; + srcU += chromaWidth; + srcV += chromaWidth; } } -- cgit v1.2.3