[Scummvm-cvs-logs] SF.net SVN: scummvm:[42059] scummvm/branches/gsoc2009-16bit/graphics
jvprat at users.sourceforge.net
jvprat at users.sourceforge.net
Fri Jul 3 15:46:47 CEST 2009
Revision: 42059
http://scummvm.svn.sourceforge.net/scummvm/?rev=42059&view=rev
Author: jvprat
Date: 2009-07-03 13:46:47 +0000 (Fri, 03 Jul 2009)
Log Message:
-----------
Fix some formatting bits
Modified Paths:
--------------
scummvm/branches/gsoc2009-16bit/graphics/conversion.cpp
scummvm/branches/gsoc2009-16bit/graphics/conversion.h
Modified: scummvm/branches/gsoc2009-16bit/graphics/conversion.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/graphics/conversion.cpp 2009-07-03 11:54:52 UTC (rev 42058)
+++ scummvm/branches/gsoc2009-16bit/graphics/conversion.cpp 2009-07-03 13:46:47 UTC (rev 42059)
@@ -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 @@
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 @@
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 @@
} 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 @@
#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 @@
}
return true;
}
-} // end of namespace Graphics
\ No newline at end of file
+
+} // end of namespace Graphics
Modified: scummvm/branches/gsoc2009-16bit/graphics/conversion.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/graphics/conversion.h 2009-07-03 11:54:52 UTC (rev 42058)
+++ scummvm/branches/gsoc2009-16bit/graphics/conversion.h 2009-07-03 13:46:47 UTC (rev 42059)
@@ -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 @@
* @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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list