aboutsummaryrefslogtreecommitdiff
path: root/graphics/yuv_to_rgb.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2011-05-18 09:41:08 -0400
committerMatthew Hoops2011-05-18 10:05:13 -0400
commitaffb6a38a198d410922492026e5277794a310279 (patch)
tree9ffb9a4dcc39aea9b6d37650e413b8df5a8758fd /graphics/yuv_to_rgb.cpp
parentf8323cc67230b64de5af93624f57aba4020fecdf (diff)
downloadscummvm-rg350-affb6a38a198d410922492026e5277794a310279.tar.gz
scummvm-rg350-affb6a38a198d410922492026e5277794a310279.tar.bz2
scummvm-rg350-affb6a38a198d410922492026e5277794a310279.zip
GRAPHICS: Add some docs and sanity checks to the YUV to RGB code
Diffstat (limited to 'graphics/yuv_to_rgb.cpp')
-rw-r--r--graphics/yuv_to_rgb.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/graphics/yuv_to_rgb.cpp b/graphics/yuv_to_rgb.cpp
index b1107a7475..831736cd75 100644
--- a/graphics/yuv_to_rgb.cpp
+++ b/graphics/yuv_to_rgb.cpp
@@ -203,6 +203,13 @@ namespace Graphics {
*((uint32 *)(d)) = (L[cr_r] | L[crb_g] | L[cb_b])
void convertYUV420ToRGB(Graphics::Surface *dst, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch) {
+ // Sanity checks
+ assert(dst && dst->pixels);
+ assert(dst->format.bytesPerPixel == 2 || dst->format.bytesPerPixel == 4);
+ assert(ySrc && uSrc && vSrc);
+ assert((yWidth & 1) == 0);
+ assert((yHeight & 1) == 0);
+
const YUVToRGBLookup *lookup = YUVToRGBMan.getLookup(dst->format);
byte *dstPtr = (byte *)dst->pixels;