diff options
author | Jordi Vilalta Prat | 2009-07-03 13:46:47 +0000 |
---|---|---|
committer | Jordi Vilalta Prat | 2009-07-03 13:46:47 +0000 |
commit | 255e51906298e8d06939cd1aa888e233b0eefa2a (patch) | |
tree | a4751281b349faaf5b06788eddc410200a421acf /graphics | |
parent | 8f44661611068df6dd40ed7f277bf854c4f97547 (diff) | |
download | scummvm-rg350-255e51906298e8d06939cd1aa888e233b0eefa2a.tar.gz scummvm-rg350-255e51906298e8d06939cd1aa888e233b0eefa2a.tar.bz2 scummvm-rg350-255e51906298e8d06939cd1aa888e233b0eefa2a.zip |
Fix some formatting bits
svn-id: r42059
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/conversion.cpp | 27 | ||||
-rw-r--r-- | graphics/conversion.h | 12 |
2 files changed, 22 insertions, 17 deletions
diff --git a/graphics/conversion.cpp b/graphics/conversion.cpp index 3db0bee33c..aa544ac718 100644 --- a/graphics/conversion.cpp +++ b/graphics/conversion.cpp @@ -23,15 +23,16 @@ */ #include "graphics/conversion.h" -#include "common/scummsys.h" + namespace Graphics { + // TODO: YUV to RGB conversion function // Function to blit a rect from one color format to another -bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, +bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, int w, int h, Graphics::PixelFormat dstFmt, Graphics::PixelFormat srcFmt) { // Error out if conversion is impossible - if ((srcFmt.bytesPerPixel == 1) || (dstFmt.bytesPerPixel == 1) + if ((srcFmt.bytesPerPixel == 1) || (dstFmt.bytesPerPixel == 1) || (!srcFmt.bytesPerPixel) || (!dstFmt.bytesPerPixel) || (srcFmt.bytesPerPixel > dstFmt.bytesPerPixel)) return false; @@ -41,14 +42,13 @@ bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, return true; // Faster, but larger, to provide optimized handling for each case. - int srcDelta,dstDelta; + int srcDelta, dstDelta; srcDelta = (srcpitch - w * srcFmt.bytesPerPixel); dstDelta = (dstpitch - w * dstFmt.bytesPerPixel); // TODO: optimized cases for dstDelta of 0 - uint8 r,g,b,a; - if (dstFmt.bytesPerPixel == 2) - { + uint8 r, g, b, a; + if (dstFmt.bytesPerPixel == 2) { uint16 color; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++, src += 2, dst += 2) { @@ -72,7 +72,7 @@ bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, color = *(uint16 *) src; srcFmt.colorToARGB(color, a, r, g, b); color = dstFmt.ARGBToColor(a, r, g, b); - memcpy(dst,col,3); + memcpy(dst, col, 3); } src += srcDelta; dst += dstDelta; @@ -80,11 +80,11 @@ bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, } else { for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++, src += 3, dst += 3) { - uint8 r,g,b,a; - memcpy(col,src,3); + uint8 r, g, b, a; + memcpy(col, src, 3); srcFmt.colorToARGB(color, a, r, g, b); color = dstFmt.ARGBToColor(a, r, g, b); - memcpy(dst,col,3); + memcpy(dst, col, 3); } src += srcDelta; dst += dstDelta; @@ -110,7 +110,7 @@ bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, #endif for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++, src += 2, dst += 4) { - memcpy(col,src,3); + memcpy(col, src, 3); srcFmt.colorToARGB(color, a, r, g, b); color = dstFmt.ARGBToColor(a, r, g, b); *(uint32 *) dst = color; @@ -135,4 +135,5 @@ bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, } return true; } -} // end of namespace Graphics
\ No newline at end of file + +} // end of namespace Graphics diff --git a/graphics/conversion.h b/graphics/conversion.h index b04c9cb9d9..aa7cade982 100644 --- a/graphics/conversion.h +++ b/graphics/conversion.h @@ -22,11 +22,13 @@ * $Id$ * */ + #ifndef GRAPHICS_CONVERSION_H #define GRAPHICS_CONVERSION_H #include "common/scummsys.h" #include "graphics/pixelformat.h" + namespace Graphics { // TODO: generic YUV to RGB pixel conversion @@ -43,14 +45,16 @@ namespace Graphics { * @param h the height of the graphics data * @param dstFmt the desired pixel format * @param srcFmt the original pixel format - * @return true if conversion completes successfully, + * @return true if conversion completes successfully, * false if there is an error. * - * @note This implementation currently requires the destination's + * @note This implementation currently requires the destination's * format have at least as high a bitdepth as the source's. * */ -bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, +bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, int w, int h, Graphics::PixelFormat dstFmt, Graphics::PixelFormat srcFmt); + } // end of namespace Graphics -#endif //GRAPHICS_CONVERSION_H + +#endif // GRAPHICS_CONVERSION_H |