diff options
author | Johannes Schickel | 2009-05-29 11:07:35 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-05-29 11:07:35 +0000 |
commit | fd34892cd53e9dc9504dff23e7dd2103fded8f0d (patch) | |
tree | 6589b3baa53e48f7d4ff77e9e8348a3c3cf6dd56 /engines/kyra | |
parent | 682d95ff59e5811cb7bf9c36f88278369968e737 (diff) | |
download | scummvm-rg350-fd34892cd53e9dc9504dff23e7dd2103fded8f0d.tar.gz scummvm-rg350-fd34892cd53e9dc9504dff23e7dd2103fded8f0d.tar.bz2 scummvm-rg350-fd34892cd53e9dc9504dff23e7dd2103fded8f0d.zip |
Cleanup and slight bugfix in drawShapeProcessLineScale* functions.
svn-id: r40982
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/screen.cpp | 48 | ||||
-rw-r--r-- | engines/kyra/screen.h | 10 |
2 files changed, 26 insertions, 32 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 410c186a86..fda2c52ad7 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -1480,19 +1480,17 @@ int Screen::drawShapeMarginNoScaleDownwind(uint8 *&dst, const uint8 *&src, int & int Screen::drawShapeMarginScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt) { _dsTmpWidth -= cnt; - bool found = false; - if (src == dst || !cnt) - return _dsOffscreenScaleVal1; + while (cnt > 0) { + --cnt; - do { if (*src++) continue; - found = true; + cnt = cnt + 1 - (*src++); - } while (--cnt > 0); + } - if (!found || !cnt) + if (!cnt) return _dsOffscreenScaleVal1; _dsTmpWidth += cnt; @@ -1509,19 +1507,17 @@ int Screen::drawShapeMarginScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt) int Screen::drawShapeMarginScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt) { _dsTmpWidth -= cnt; - bool found = false; - if (src == dst || !cnt) - return _dsOffscreenScaleVal1; + while (cnt > 0) { + --cnt; - do { if (*src++) continue; - found = true; + cnt = cnt + 1 - (*src++); - } while (--cnt > 0); + } - if (!found || !cnt) + if (!cnt) return _dsOffscreenScaleVal1; _dsTmpWidth += cnt; @@ -1568,7 +1564,7 @@ int Screen::drawShapeSkipScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt) return found ? 0 : _dsOffscreenScaleVal1; } -void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int) { +void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16) { do { uint8 c = *src++; if (c) { @@ -1583,7 +1579,7 @@ void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, i } while (cnt > 0); } -void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int) { +void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16) { do { uint8 c = *src++; if (c) { @@ -1598,11 +1594,11 @@ void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, } while (cnt > 0); } -void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState) { +void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState) { int c = 0; do { - if ((scaleState >> 8) <= 0) { + if ((scaleState & 0x8000) || !(scaleState & 0xFF00)) { c = *src++; _dsTmpWidth--; if (c) { @@ -1616,10 +1612,9 @@ void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int cnt -= (r >> 8); scaleState = r & 0xff; } - } else { - uint8 *d = dst++; - (this->*_dsPlot)(d, c); - scaleState -= 256; + } else if (scaleState) { + (this->*_dsPlot)(dst++, c); + scaleState -= 0x100; cnt--; } } while (cnt > 0); @@ -1627,11 +1622,11 @@ void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int cnt = -1; } -void Screen::drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState) { +void Screen::drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState) { int c = 0; do { - if ((scaleState >> 8) <= 0) { + if ((scaleState & 0x8000) || !(scaleState & 0xFF00)) { c = *src++; _dsTmpWidth--; if (c) { @@ -1646,9 +1641,8 @@ void Screen::drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, i scaleState = r & 0xff; } } else { - uint8 *d = dst--; - (this->*_dsPlot)(d, c); - scaleState -= 256; + (this->*_dsPlot)(dst--, c); + scaleState -= 0x100; cnt--; } } while (cnt > 0); diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index de53e33e3c..a6e3ef9e9a 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -312,10 +312,10 @@ protected: int drawShapeMarginScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt); int drawShapeSkipScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt); int drawShapeSkipScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt); - void drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState); - void drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState); - void drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState); - void drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState); + void drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState); + void drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState); + void drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState); + void drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState); void drawShapePlotType0(uint8 *dst, uint8 cmd); void drawShapePlotType1(uint8 *dst, uint8 cmd); @@ -337,7 +337,7 @@ protected: void drawShapePlotType52(uint8 *dst, uint8 cmd); typedef int (Screen::*DsMarginSkipFunc)(uint8 *&dst, const uint8 *&src, int &cnt); - typedef void (Screen::*DsLineFunc)(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState); + typedef void (Screen::*DsLineFunc)(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState); typedef void (Screen::*DsPlotFunc)(uint8 *dst, uint8 cmd); DsMarginSkipFunc _dsProcessMargin; |