diff options
author | Sven Hesse | 2010-12-02 21:40:17 +0000 |
---|---|---|
committer | Sven Hesse | 2010-12-02 21:40:17 +0000 |
commit | 4b7af0244fdcb19d3648067ff80906badb146c49 (patch) | |
tree | fea618245f0debcb5565e7e9b2f4368322b2f830 | |
parent | 27799e354e073cc2db6160fdf25b4da321d343e7 (diff) | |
download | scummvm-rg350-4b7af0244fdcb19d3648067ff80906badb146c49.tar.gz scummvm-rg350-4b7af0244fdcb19d3648067ff80906badb146c49.tar.bz2 scummvm-rg350-4b7af0244fdcb19d3648067ff80906badb146c49.zip |
GOB: Make drawYUV() more clear
(It's still wrong though :P)
svn-id: r54744
-rw-r--r-- | engines/gob/video_v6.cpp | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/engines/gob/video_v6.cpp b/engines/gob/video_v6.cpp index 7bf728034b..e4feb6501f 100644 --- a/engines/gob/video_v6.cpp +++ b/engines/gob/video_v6.cpp @@ -206,28 +206,35 @@ void Video_v6::drawYUV(Surface &destDesc, int16 x, int16 y, for (int i = 0; i < height; i++) { Pixel dstRow = dst; - const byte *srcY = dataY + i * dataWidth; - const byte *srcU = dataU + (i >> 2) * (dataWidth >> 2); - const byte *srcV = dataV + (i >> 2) * (dataWidth >> 2); + for (int j = 0; j < width; j++, dstRow++) { + // Get (7bit) YUV data + byte dY = dataY[j ] << 1; + byte dU = dataU[j >> 2] << 1; + byte dV = dataV[j >> 2] << 1; - for (int j = 0; j < (width >> 2); j++, srcU++, srcV++) { - for (int n = 0; n < 4; n++, dstRow++, srcY++) { - byte dY = *srcY << 1, dU = *srcU << 1, dV = *srcV << 1; + byte r, g, b; + Graphics::YUV2RGB(dY, dU, dV, r, g, b); - byte r, g, b; - Graphics::YUV2RGB(dY, dU, dV, r, g, b); + if (dY != 0) { + // Solid pixel + uint32 c = pixelFormat.RGBToColor(r, g, b); - if (dY != 0) { - uint32 c = pixelFormat.RGBToColor(r, g, b); + // If the solid pixel's value is 0, we'll fudge it to 1 + dstRow.set((c == 0) ? 1 : c); + } else + // Transparent pixel, we'll use pixel value 0 + dstRow.set(0); - dstRow.set((c == 0) ? 1 : c); - } else - dstRow.set(0); - - } } - dst += destDesc.getWidth(); + dst += destDesc.getWidth(); + dataY += dataWidth; + + if ((i & 3) == 3) { + // Next line of chroma data + dataU += dataWidth >> 2; + dataV += dataWidth >> 2; + } } } |