diff options
author | Max Horn | 2002-08-25 10:50:18 +0000 |
---|---|---|
committer | Max Horn | 2002-08-25 10:50:18 +0000 |
commit | ec47d8c80c668160e0ee84419314966f763802b9 (patch) | |
tree | 7f9ffa782b021d95bbaa28e7236d908ed81546c9 /scumm/smush | |
parent | 492400e9fa10de948a8bf00e908c2e216c7f171e (diff) | |
download | scummvm-rg350-ec47d8c80c668160e0ee84419314966f763802b9.tar.gz scummvm-rg350-ec47d8c80c668160e0ee84419314966f763802b9.tar.bz2 scummvm-rg350-ec47d8c80c668160e0ee84419314966f763802b9.zip |
fixed some endian issues in the new SMUSH decoder; cleanup
svn-id: r4842
Diffstat (limited to 'scumm/smush')
-rw-r--r-- | scumm/smush/blitter.cpp | 38 | ||||
-rw-r--r-- | scumm/smush/frenderer.cpp | 8 | ||||
-rw-r--r-- | scumm/smush/imuse_channel.cpp | 3 | ||||
-rw-r--r-- | scumm/smush/player.cpp | 7 | ||||
-rw-r--r-- | scumm/smush/saud_channel.cpp | 3 | ||||
-rw-r--r-- | scumm/smush/scumm_renderer.h | 4 |
6 files changed, 23 insertions, 40 deletions
diff --git a/scumm/smush/blitter.cpp b/scumm/smush/blitter.cpp index a209ceb852..d760919869 100644 --- a/scumm/smush/blitter.cpp +++ b/scumm/smush/blitter.cpp @@ -19,17 +19,14 @@ * */ -#include <stdafx.h> +#include "stdafx.h" +#include "common/util.h" #include "blitter.h" #include "chunk.h" #include <assert.h> #include <string.h> // for memcpy -#ifndef min -#define min(x, y) ((x) > (y) ? (y) : (x)) -#endif - Blitter::Blitter(char * ptr, const Point & dstsize, const Rect & src) : _ptr(ptr), _clip(dstsize), @@ -91,7 +88,7 @@ void Blitter::put(char data, unsigned int len) { #endif break; } - int l = min((int)len, min(_clip.getX() - _cur.getX(), _src.right() - _cur.getX())); + int l = MIN((int)len, MIN(_clip.getX() - _cur.getX(), _src.right() - _cur.getX())); len -= l; memset(_offset, data, l); advance(l); @@ -106,7 +103,7 @@ void Blitter::blit(char * ptr, unsigned int len) { #endif break; } - int l = min((int)len, min(_clip.getX() - _cur.getX(), _src.right() - _cur.getX())); + int l = MIN((int)len, MIN(_clip.getX() - _cur.getX(), _src.right() - _cur.getX())); len -= l; memcpy(_offset, ptr, l); ptr += l; @@ -122,7 +119,7 @@ void Blitter::blit(Chunk & src, unsigned int len) { #endif break; } - int l = min((int)len, min(_clip.getX() -_cur.getX(), _src.right() - _cur.getX())); + int l = MIN((int)len, MIN(_clip.getX() -_cur.getX(), _src.right() - _cur.getX())); len -= l; src.read(_offset, l); advance(l); @@ -134,6 +131,7 @@ void Blitter::putBlock(unsigned int data) { assert((_clip.getX() & 3) == 0); unsigned int * dst = (unsigned int *)_offset; int line_size = _clip.getX() >> 2; + data = TO_LE_32(data); *dst = data; dst += line_size; *dst = data; dst += line_size; @@ -154,10 +152,10 @@ void Blitter::putBlock(unsigned int d1, unsigned int d2, unsigned int d3, unsign unsigned int * dst = (unsigned int *)_offset; int line_size = _clip.getX() >> 2; - *dst = d4; dst += line_size; - *dst = d3; dst += line_size; - *dst = d2; dst += line_size; - *dst = d1; + *dst = TO_LE_32(d4); dst += line_size; + *dst = TO_LE_32(d3); dst += line_size; + *dst = TO_LE_32(d2); dst += line_size; + *dst = TO_LE_32(d1); #ifdef DEBUG_CLIPPER } else { @@ -173,10 +171,10 @@ void Blitter::putBlock(unsigned char * data) { unsigned int * dst = (unsigned int *)_offset; int line_size = _clip.getX() >> 2; unsigned int * src = (unsigned int *)data; - *dst = *src++; dst += line_size; - *dst = *src++; dst += line_size; - *dst = *src++; dst += line_size; - *dst = *src++; + *dst = TO_LE_32(*src++); dst += line_size; + *dst = TO_LE_32(*src++); dst += line_size; + *dst = TO_LE_32(*src++); dst += line_size; + *dst = TO_LE_32(*src++); #ifdef DEBUG_CLIPPER } else { _clippedBlock ++; @@ -190,10 +188,10 @@ void Blitter::putBlock(Chunk & src) { assert((_clip.getX() & 3) == 0); unsigned int * dst = (unsigned int *)_offset; int line_size = _clip.getX() >> 2; - *dst = src.getDword(); dst += line_size; - *dst = src.getDword(); dst += line_size; - *dst = src.getDword(); dst += line_size; - *dst = src.getDword(); + *dst = TO_LE_32(src.getDword()); dst += line_size; + *dst = TO_LE_32(src.getDword()); dst += line_size; + *dst = TO_LE_32(src.getDword()); dst += line_size; + *dst = TO_LE_32(src.getDword()); #ifdef DEBUG_CLIPPER } else { _clippedBlock ++; diff --git a/scumm/smush/frenderer.cpp b/scumm/smush/frenderer.cpp index 7f3f08cae8..741e853087 100644 --- a/scumm/smush/frenderer.cpp +++ b/scumm/smush/frenderer.cpp @@ -20,16 +20,14 @@ */ #include <stdafx.h> +#include "common/util.h" + #include "frenderer.h" #include "rect.h" #include <assert.h> #include <string.h> // for memcpy, strcat, strdup -#ifndef max -#define max(x, y) ((x) > (y) ? (x) : (y)) -#endif - FontRenderer::FontRenderer(bool use_original_colors) : _nbChars(0), _color(-1), _original(use_original_colors) { } @@ -75,7 +73,7 @@ int FontRenderer::stringHeight(const char * str) const { for(int i = 0; str[i] != 0; i++) { int h = charHeight(str[i]); - ret = max(ret, h); + ret = MAX(ret, h); } return ret; diff --git a/scumm/smush/imuse_channel.cpp b/scumm/smush/imuse_channel.cpp index 049a9e1c4d..ea969c9428 100644 --- a/scumm/smush/imuse_channel.cpp +++ b/scumm/smush/imuse_channel.cpp @@ -26,9 +26,6 @@ #include <assert.h> #include <string.h> // for memcpy.h -#ifndef min -#define min(x, y) ((x) > (y) ? (y) : (x)) -#endif ImuseChannel::ImuseChannel(int track, int freq) : _track(track), diff --git a/scumm/smush/player.cpp b/scumm/smush/player.cpp index 33da6467b6..5a216bdc48 100644 --- a/scumm/smush/player.cpp +++ b/scumm/smush/player.cpp @@ -20,6 +20,7 @@ */ #include <stdafx.h> +#include "common/util.h" #include "player.h" #include "renderer.h" @@ -34,10 +35,6 @@ #include <string.h> // for strchr, strrchr #include <ctype.h> // for isdigit -#ifndef max -#define max(x, y) ((x) > (y) ? (x) : (y)) -#endif - const int WAIT = 100; /*! @brief parser and map of string resources @@ -371,7 +368,7 @@ void SmushPlayer::handleTextResource(Chunk & b) { if(flags == 0 || flags == 4) { fr->drawStringAbsolute(str, _curBuffer, _frameSize, pos_x, pos_y); } else { - fr->drawStringCentered(str, _curBuffer, _frameSize, max(pos_y, top), left, width, pos_x); + fr->drawStringCentered(str, _curBuffer, _frameSize, MAX(pos_y, top), left, width, pos_x); } } diff --git a/scumm/smush/saud_channel.cpp b/scumm/smush/saud_channel.cpp index 36f06f2832..c101c0d346 100644 --- a/scumm/smush/saud_channel.cpp +++ b/scumm/smush/saud_channel.cpp @@ -26,9 +26,6 @@ #include <assert.h> #include <string.h> // for memcpy.h -#ifndef min -#define min(x, y) ((x) > (y) ? (y) : (x)) -#endif void SaudChannel::handleStrk(Chunk & b) { int size = b.getSize(); diff --git a/scumm/smush/scumm_renderer.h b/scumm/smush/scumm_renderer.h index 2ee22db546..48d8eaaca0 100644 --- a/scumm/smush/scumm_renderer.h +++ b/scumm/smush/scumm_renderer.h @@ -39,10 +39,6 @@ #include "rect.h" #include "blitter.h" -#ifndef min -#define min(x, y) ((x) > (y) ? (y) : (x)) -#endif - class scumm_mixer; class ScummRenderer : public BaseRenderer { |