From 05d24e892c15a0bc2a8a923927125098704f42db Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 14 Jul 2012 03:35:54 +0200 Subject: GRAPHICS: Clean up crossBlit a bit. --- graphics/conversion.cpp | 57 +++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 28 deletions(-) (limited to 'graphics/conversion.cpp') diff --git a/graphics/conversion.cpp b/graphics/conversion.cpp index 713a06ea74..705f672a93 100644 --- a/graphics/conversion.cpp +++ b/graphics/conversion.cpp @@ -27,8 +27,10 @@ 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, - int w, int h, const Graphics::PixelFormat &dstFmt, const Graphics::PixelFormat &srcFmt) { +bool crossBlit(byte *dst, const byte *src, + const uint dstPitch, const uint srcPitch, + const uint w, const uint h, + const Graphics::PixelFormat &dstFmt, const Graphics::PixelFormat &srcFmt) { // Error out if conversion is impossible if ((srcFmt.bytesPerPixel == 1) || (dstFmt.bytesPerPixel == 1) || (!srcFmt.bytesPerPixel) || (!dstFmt.bytesPerPixel) @@ -37,32 +39,31 @@ bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, // Don't perform unnecessary conversion if (srcFmt == dstFmt) { - if (dst == src) - return true; - if (dstpitch == srcpitch && ((w * dstFmt.bytesPerPixel) == dstpitch)) { - memcpy(dst,src,dstpitch * h); - return true; - } else { - for (int i = 0; i < h; i++) { - memcpy(dst,src,w * dstFmt.bytesPerPixel); - dst += dstpitch; - src += srcpitch; + if (dst != src) { + if (dstPitch == srcPitch && ((w * dstFmt.bytesPerPixel) == dstPitch)) { + memcpy(dst, src, dstPitch * h); + } else { + for (uint i = 0; i < h; ++i) { + memcpy(dst, src, w * dstFmt.bytesPerPixel); + dst += dstPitch; + src += srcPitch; + } } - return true; } + + return true; } // Faster, but larger, to provide optimized handling for each case. - int srcDelta, dstDelta; - srcDelta = (srcpitch - w * srcFmt.bytesPerPixel); - dstDelta = (dstpitch - w * dstFmt.bytesPerPixel); + const uint srcDelta = (srcPitch - w * srcFmt.bytesPerPixel); + const uint dstDelta = (dstPitch - w * dstFmt.bytesPerPixel); // TODO: optimized cases for dstDelta of 0 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) { + for (uint y = 0; y < h; ++y) { + for (uint x = 0; x < w; ++x, src += 2, dst += 2) { color = *(const uint16 *)src; srcFmt.colorToARGB(color, a, r, g, b); color = dstFmt.ARGBToColor(a, r, g, b); @@ -78,8 +79,8 @@ bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, col++; #endif if (srcFmt.bytesPerPixel == 2) { - for (int y = 0; y < h; y++) { - for (int x = 0; x < w; x++, src += 2, dst += 3) { + for (uint y = 0; y < h; ++y) { + for (uint x = 0; x < w; ++x, src += 2, dst += 3) { color = *(const uint16 *)src; srcFmt.colorToARGB(color, a, r, g, b); color = dstFmt.ARGBToColor(a, r, g, b); @@ -89,8 +90,8 @@ bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, dst += dstDelta; } } else { - for (int y = 0; y < h; y++) { - for (int x = 0; x < w; x++, src += 3, dst += 3) { + for (uint y = 0; y < h; ++y) { + for (uint x = 0; x < w; ++x, src += 3, dst += 3) { memcpy(col, src, 3); srcFmt.colorToARGB(color, a, r, g, b); color = dstFmt.ARGBToColor(a, r, g, b); @@ -103,8 +104,8 @@ bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, } else if (dstFmt.bytesPerPixel == 4) { uint32 color; if (srcFmt.bytesPerPixel == 2) { - for (int y = 0; y < h; y++) { - for (int x = 0; x < w; x++, src += 2, dst += 4) { + for (uint y = 0; y < h; ++y) { + for (uint x = 0; x < w; ++x, src += 2, dst += 4) { color = *(const uint16 *)src; srcFmt.colorToARGB(color, a, r, g, b); color = dstFmt.ARGBToColor(a, r, g, b); @@ -118,8 +119,8 @@ bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, #ifdef SCUMM_BIG_ENDIAN col++; #endif - for (int y = 0; y < h; y++) { - for (int x = 0; x < w; x++, src += 2, dst += 4) { + for (uint y = 0; y < h; ++y) { + for (uint x = 0; x < w; ++x, src += 2, dst += 4) { memcpy(col, src, 3); srcFmt.colorToARGB(color, a, r, g, b); color = dstFmt.ARGBToColor(a, r, g, b); @@ -129,8 +130,8 @@ bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, dst += dstDelta; } } else { - for (int y = 0; y < h; y++) { - for (int x = 0; x < w; x++, src += 4, dst += 4) { + for (uint y = 0; y < h; ++y) { + for (uint x = 0; x < w; ++x, src += 4, dst += 4) { color = *(const uint32 *)src; srcFmt.colorToARGB(color, a, r, g, b); color = dstFmt.ARGBToColor(a, r, g, b); -- cgit v1.2.3 From ea1bcaad3380132356adb567826e74e587c389cd Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 14 Jul 2012 04:53:10 +0200 Subject: GRAPHICS: Refactor crossBlit logic into a template. --- graphics/conversion.cpp | 62 +++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 33 deletions(-) (limited to 'graphics/conversion.cpp') diff --git a/graphics/conversion.cpp b/graphics/conversion.cpp index 705f672a93..7b6bda30a4 100644 --- a/graphics/conversion.cpp +++ b/graphics/conversion.cpp @@ -26,6 +26,29 @@ namespace Graphics { // TODO: YUV to RGB conversion function +namespace { + +template +FORCEINLINE void crossBlitLogic(byte *dst, const byte *src, const uint w, const uint h, + const PixelFormat &srcFmt, const PixelFormat &dstFmt, + const uint srcDelta, const uint dstDelta) { + for (uint y = 0; y < h; ++y) { + for (uint x = 0; x < w; ++x) { + uint32 color = *(const SrcColor *)src; + byte a, r, g, b; + srcFmt.colorToARGB(color, a, r, g, b); + color = dstFmt.ARGBToColor(a, r, g, b); + *(DstColor *)dst = color; + src += sizeof(SrcColor); + dst += sizeof(DstColor); + } + src += srcDelta; + dst += dstDelta; + } +} + +} // End of anonymous namespace + // Function to blit a rect from one color format to another bool crossBlit(byte *dst, const byte *src, const uint dstPitch, const uint srcPitch, @@ -59,21 +82,11 @@ bool crossBlit(byte *dst, const byte *src, const uint dstDelta = (dstPitch - w * dstFmt.bytesPerPixel); // TODO: optimized cases for dstDelta of 0 - uint8 r, g, b, a; if (dstFmt.bytesPerPixel == 2) { - uint16 color; - for (uint y = 0; y < h; ++y) { - for (uint x = 0; x < w; ++x, src += 2, dst += 2) { - color = *(const uint16 *)src; - srcFmt.colorToARGB(color, a, r, g, b); - color = dstFmt.ARGBToColor(a, r, g, b); - *(uint16 *)dst = color; - } - src += srcDelta; - dst += dstDelta; - } + crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); } else if (dstFmt.bytesPerPixel == 3) { uint32 color; + uint8 r, g, b, a; uint8 *col = (uint8 *) &color; #ifdef SCUMM_BIG_ENDIAN col++; @@ -102,19 +115,11 @@ bool crossBlit(byte *dst, const byte *src, } } } else if (dstFmt.bytesPerPixel == 4) { - uint32 color; if (srcFmt.bytesPerPixel == 2) { - for (uint y = 0; y < h; ++y) { - for (uint x = 0; x < w; ++x, src += 2, dst += 4) { - color = *(const uint16 *)src; - srcFmt.colorToARGB(color, a, r, g, b); - color = dstFmt.ARGBToColor(a, r, g, b); - *(uint32 *)dst = color; - } - src += srcDelta; - dst += dstDelta; - } + crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); } else if (srcFmt.bytesPerPixel == 3) { + uint32 color; + byte r, g, b, a; uint8 *col = (uint8 *)&color; #ifdef SCUMM_BIG_ENDIAN col++; @@ -130,16 +135,7 @@ bool crossBlit(byte *dst, const byte *src, dst += dstDelta; } } else { - for (uint y = 0; y < h; ++y) { - for (uint x = 0; x < w; ++x, src += 4, dst += 4) { - color = *(const uint32 *)src; - srcFmt.colorToARGB(color, a, r, g, b); - color = dstFmt.ARGBToColor(a, r, g, b); - *(uint32 *)dst = color; - } - src += srcDelta; - dst += dstDelta; - } + crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); } } else { return false; -- cgit v1.2.3 From a0f46e9396861b9eb4ab8adebcbc4739e44b9716 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 14 Jul 2012 04:53:37 +0200 Subject: GRAPHICS: Remove 3Bpp destination support in crossBlit. --- graphics/conversion.cpp | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) (limited to 'graphics/conversion.cpp') diff --git a/graphics/conversion.cpp b/graphics/conversion.cpp index 7b6bda30a4..84f9bcbb9c 100644 --- a/graphics/conversion.cpp +++ b/graphics/conversion.cpp @@ -56,6 +56,7 @@ bool crossBlit(byte *dst, const byte *src, const Graphics::PixelFormat &dstFmt, const Graphics::PixelFormat &srcFmt) { // Error out if conversion is impossible if ((srcFmt.bytesPerPixel == 1) || (dstFmt.bytesPerPixel == 1) + || (dstFmt.bytesPerPixel == 3) || (!srcFmt.bytesPerPixel) || (!dstFmt.bytesPerPixel) || (srcFmt.bytesPerPixel > dstFmt.bytesPerPixel)) return false; @@ -84,36 +85,6 @@ bool crossBlit(byte *dst, const byte *src, // TODO: optimized cases for dstDelta of 0 if (dstFmt.bytesPerPixel == 2) { crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); - } else if (dstFmt.bytesPerPixel == 3) { - uint32 color; - uint8 r, g, b, a; - uint8 *col = (uint8 *) &color; -#ifdef SCUMM_BIG_ENDIAN - col++; -#endif - if (srcFmt.bytesPerPixel == 2) { - for (uint y = 0; y < h; ++y) { - for (uint x = 0; x < w; ++x, src += 2, dst += 3) { - color = *(const uint16 *)src; - srcFmt.colorToARGB(color, a, r, g, b); - color = dstFmt.ARGBToColor(a, r, g, b); - memcpy(dst, col, 3); - } - src += srcDelta; - dst += dstDelta; - } - } else { - for (uint y = 0; y < h; ++y) { - for (uint x = 0; x < w; ++x, src += 3, dst += 3) { - memcpy(col, src, 3); - srcFmt.colorToARGB(color, a, r, g, b); - color = dstFmt.ARGBToColor(a, r, g, b); - memcpy(dst, col, 3); - } - src += srcDelta; - dst += dstDelta; - } - } } else if (dstFmt.bytesPerPixel == 4) { if (srcFmt.bytesPerPixel == 2) { crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); -- cgit v1.2.3 From 3a55adbf5eaf2d80b48de4ff680452996cc3d1a8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 14 Jul 2012 05:09:19 +0200 Subject: GRAPHICS: Fix a bug in crossBlit with 3Bpp source. Formerly it added 2 to the source pixel pointer instead of 3. --- graphics/conversion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'graphics/conversion.cpp') diff --git a/graphics/conversion.cpp b/graphics/conversion.cpp index 84f9bcbb9c..db99679d41 100644 --- a/graphics/conversion.cpp +++ b/graphics/conversion.cpp @@ -96,7 +96,7 @@ bool crossBlit(byte *dst, const byte *src, col++; #endif for (uint y = 0; y < h; ++y) { - for (uint x = 0; x < w; ++x, src += 2, dst += 4) { + for (uint x = 0; x < w; ++x, src += 3, dst += 4) { memcpy(col, src, 3); srcFmt.colorToARGB(color, a, r, g, b); color = dstFmt.ARGBToColor(a, r, g, b); -- cgit v1.2.3 From 0d78d46a0e82af81681727a94e01ff5f309887fa Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 14 Jul 2012 05:12:31 +0200 Subject: GRAPHICS: Remove crossBlit's dstBpp >= srcBpp limitation. --- graphics/conversion.cpp | 54 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 19 deletions(-) (limited to 'graphics/conversion.cpp') diff --git a/graphics/conversion.cpp b/graphics/conversion.cpp index db99679d41..ece1f759d9 100644 --- a/graphics/conversion.cpp +++ b/graphics/conversion.cpp @@ -22,6 +22,8 @@ #include "graphics/conversion.h" #include "graphics/pixelformat.h" +#include "common/endian.h" + namespace Graphics { // TODO: YUV to RGB conversion function @@ -47,6 +49,30 @@ FORCEINLINE void crossBlitLogic(byte *dst, const byte *src, const uint w, const } } +template +FORCEINLINE void crossBlitLogic3BppSource(byte *dst, const byte *src, const uint w, const uint h, + const PixelFormat &srcFmt, const PixelFormat &dstFmt, + const uint srcDelta, const uint dstDelta) { + uint32 color; + byte r, g, b, a; + uint8 *col = (uint8 *)&color; +#ifdef SCUMM_BIG_ENDIAN + col++; +#endif + for (uint y = 0; y < h; ++y) { + for (uint x = 0; x < w; ++x) { + memcpy(col, src, 3); + srcFmt.colorToARGB(color, a, r, g, b); + color = dstFmt.ARGBToColor(a, r, g, b); + *(DstColor *)dst = color; + src += 3; + dst += sizeof(DstColor); + } + src += srcDelta; + dst += dstDelta; + } +} + } // End of anonymous namespace // Function to blit a rect from one color format to another @@ -57,8 +83,7 @@ bool crossBlit(byte *dst, const byte *src, // Error out if conversion is impossible if ((srcFmt.bytesPerPixel == 1) || (dstFmt.bytesPerPixel == 1) || (dstFmt.bytesPerPixel == 3) - || (!srcFmt.bytesPerPixel) || (!dstFmt.bytesPerPixel) - || (srcFmt.bytesPerPixel > dstFmt.bytesPerPixel)) + || (!srcFmt.bytesPerPixel) || (!dstFmt.bytesPerPixel)) return false; // Don't perform unnecessary conversion @@ -84,27 +109,18 @@ bool crossBlit(byte *dst, const byte *src, // TODO: optimized cases for dstDelta of 0 if (dstFmt.bytesPerPixel == 2) { - crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); + if (srcFmt.bytesPerPixel == 2) { + crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); + } else if (srcFmt.bytesPerPixel == 3) { + crossBlitLogic3BppSource(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); + } else { + crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); + } } else if (dstFmt.bytesPerPixel == 4) { if (srcFmt.bytesPerPixel == 2) { crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); } else if (srcFmt.bytesPerPixel == 3) { - uint32 color; - byte r, g, b, a; - uint8 *col = (uint8 *)&color; -#ifdef SCUMM_BIG_ENDIAN - col++; -#endif - for (uint y = 0; y < h; ++y) { - for (uint x = 0; x < w; ++x, src += 3, dst += 4) { - memcpy(col, src, 3); - srcFmt.colorToARGB(color, a, r, g, b); - color = dstFmt.ARGBToColor(a, r, g, b); - *(uint32 *)dst = color; - } - src += srcDelta; - dst += dstDelta; - } + crossBlitLogic3BppSource(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); } else { crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); } -- cgit v1.2.3 From a92a509ac844fdad796748848d1143b27547173f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 14 Jul 2012 05:35:20 +0200 Subject: GRAPHICS: Allow in-place conversion with any color formats in crossBlit. --- graphics/conversion.cpp | 70 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 16 deletions(-) (limited to 'graphics/conversion.cpp') diff --git a/graphics/conversion.cpp b/graphics/conversion.cpp index ece1f759d9..27a44f4ed5 100644 --- a/graphics/conversion.cpp +++ b/graphics/conversion.cpp @@ -30,7 +30,7 @@ namespace Graphics { namespace { -template +template FORCEINLINE void crossBlitLogic(byte *dst, const byte *src, const uint w, const uint h, const PixelFormat &srcFmt, const PixelFormat &dstFmt, const uint srcDelta, const uint dstDelta) { @@ -41,15 +41,27 @@ FORCEINLINE void crossBlitLogic(byte *dst, const byte *src, const uint w, const srcFmt.colorToARGB(color, a, r, g, b); color = dstFmt.ARGBToColor(a, r, g, b); *(DstColor *)dst = color; - src += sizeof(SrcColor); - dst += sizeof(DstColor); + + if (backward) { + src -= sizeof(SrcColor); + dst -= sizeof(DstColor); + } else { + src += sizeof(SrcColor); + dst += sizeof(DstColor); + } + } + + if (backward) { + src -= srcDelta; + dst -= dstDelta; + } else { + src += srcDelta; + dst += dstDelta; } - src += srcDelta; - dst += dstDelta; } } -template +template FORCEINLINE void crossBlitLogic3BppSource(byte *dst, const byte *src, const uint w, const uint h, const PixelFormat &srcFmt, const PixelFormat &dstFmt, const uint srcDelta, const uint dstDelta) { @@ -65,11 +77,23 @@ FORCEINLINE void crossBlitLogic3BppSource(byte *dst, const byte *src, const uint srcFmt.colorToARGB(color, a, r, g, b); color = dstFmt.ARGBToColor(a, r, g, b); *(DstColor *)dst = color; - src += 3; - dst += sizeof(DstColor); + + if (backward) { + src -= 3; + dst -= sizeof(DstColor); + } else { + src += 3; + dst += sizeof(DstColor); + } + } + + if (backward) { + src -= srcDelta; + dst -= dstDelta; + } else { + src += srcDelta; + dst += dstDelta; } - src += srcDelta; - dst += dstDelta; } } @@ -110,19 +134,33 @@ bool crossBlit(byte *dst, const byte *src, // TODO: optimized cases for dstDelta of 0 if (dstFmt.bytesPerPixel == 2) { if (srcFmt.bytesPerPixel == 2) { - crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); + crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); } else if (srcFmt.bytesPerPixel == 3) { - crossBlitLogic3BppSource(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); + crossBlitLogic3BppSource(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); } else { - crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); + crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); } } else if (dstFmt.bytesPerPixel == 4) { if (srcFmt.bytesPerPixel == 2) { - crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); + // We need to blit the surface from bottom right to top left here. + // This is neeeded, because when we convert to the same memory + // buffer copying the surface from top left to bottom right would + // overwrite the source, since we have more bits per destination + // color than per source color. + dst += h * dstPitch - dstDelta - dstFmt.bytesPerPixel; + src += h * srcPitch - srcDelta - srcFmt.bytesPerPixel; + crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); } else if (srcFmt.bytesPerPixel == 3) { - crossBlitLogic3BppSource(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); + // We need to blit the surface from bottom right to top left here. + // This is neeeded, because when we convert to the same memory + // buffer copying the surface from top left to bottom right would + // overwrite the source, since we have more bits per destination + // color than per source color. + dst += h * dstPitch - dstDelta - dstFmt.bytesPerPixel; + src += h * srcPitch - srcDelta - srcFmt.bytesPerPixel; + crossBlitLogic3BppSource(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); } else { - crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); + crossBlitLogic(dst, src, w, h, srcFmt, dstFmt, srcDelta, dstDelta); } } else { return false; -- cgit v1.2.3 From e8cf0adf95217d4eedec526df960a8cdd46cc28f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 14 Jul 2012 05:40:09 +0200 Subject: GRAPHICS: Slight cleanup in crossBlit code. --- graphics/conversion.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'graphics/conversion.cpp') diff --git a/graphics/conversion.cpp b/graphics/conversion.cpp index 27a44f4ed5..fec1d240e2 100644 --- a/graphics/conversion.cpp +++ b/graphics/conversion.cpp @@ -36,11 +36,10 @@ FORCEINLINE void crossBlitLogic(byte *dst, const byte *src, const uint w, const const uint srcDelta, const uint dstDelta) { for (uint y = 0; y < h; ++y) { for (uint x = 0; x < w; ++x) { - uint32 color = *(const SrcColor *)src; + const uint32 color = *(const SrcColor *)src; byte a, r, g, b; srcFmt.colorToARGB(color, a, r, g, b); - color = dstFmt.ARGBToColor(a, r, g, b); - *(DstColor *)dst = color; + *(DstColor *)dst = dstFmt.ARGBToColor(a, r, g, b); if (backward) { src -= sizeof(SrcColor); @@ -75,8 +74,7 @@ FORCEINLINE void crossBlitLogic3BppSource(byte *dst, const byte *src, const uint for (uint x = 0; x < w; ++x) { memcpy(col, src, 3); srcFmt.colorToARGB(color, a, r, g, b); - color = dstFmt.ARGBToColor(a, r, g, b); - *(DstColor *)dst = color; + *(DstColor *)dst = dstFmt.ARGBToColor(a, r, g, b); if (backward) { src -= 3; -- cgit v1.2.3 From a5bce746354aa5711f06de7abac442995ae0d956 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 9 Oct 2012 23:32:51 +0200 Subject: GRAPHICS: Fix compilation of conversion.cpp on motomagx. Using plain "inline" instead of "FORCEINLINE" allows the compiler to continue even when it fails to inline crossBlitLogic/crossBlitLogic3BppSource. The impact of other systems now not inlining the functions anymore is hopefully small enough to not cause any problems. --- graphics/conversion.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'graphics/conversion.cpp') diff --git a/graphics/conversion.cpp b/graphics/conversion.cpp index fec1d240e2..2da8b6f0ce 100644 --- a/graphics/conversion.cpp +++ b/graphics/conversion.cpp @@ -31,9 +31,9 @@ namespace Graphics { namespace { template -FORCEINLINE void crossBlitLogic(byte *dst, const byte *src, const uint w, const uint h, - const PixelFormat &srcFmt, const PixelFormat &dstFmt, - const uint srcDelta, const uint dstDelta) { +inline void crossBlitLogic(byte *dst, const byte *src, const uint w, const uint h, + const PixelFormat &srcFmt, const PixelFormat &dstFmt, + const uint srcDelta, const uint dstDelta) { for (uint y = 0; y < h; ++y) { for (uint x = 0; x < w; ++x) { const uint32 color = *(const SrcColor *)src; @@ -61,9 +61,9 @@ FORCEINLINE void crossBlitLogic(byte *dst, const byte *src, const uint w, const } template -FORCEINLINE void crossBlitLogic3BppSource(byte *dst, const byte *src, const uint w, const uint h, - const PixelFormat &srcFmt, const PixelFormat &dstFmt, - const uint srcDelta, const uint dstDelta) { +inline void crossBlitLogic3BppSource(byte *dst, const byte *src, const uint w, const uint h, + const PixelFormat &srcFmt, const PixelFormat &dstFmt, + const uint srcDelta, const uint dstDelta) { uint32 color; byte r, g, b, a; uint8 *col = (uint8 *)&color; -- cgit v1.2.3