aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2015-12-17 18:35:14 +0100
committerEugene Sandulenko2015-12-27 15:39:52 +0100
commit6efb8bec681bd0c41ee7753681510961746ed60e (patch)
treeb5509622aef432b68340c5a65bdbc1fcff07c856
parente75a96e66cc5b5ae8c77e755c618ba2302999552 (diff)
downloadscummvm-rg350-6efb8bec681bd0c41ee7753681510961746ed60e.tar.gz
scummvm-rg350-6efb8bec681bd0c41ee7753681510961746ed60e.tar.bz2
scummvm-rg350-6efb8bec681bd0c41ee7753681510961746ed60e.zip
WAGE: Fixed polygon rendering
-rw-r--r--engines/wage/design.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index a1f7941eb8..301c6c7529 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -239,8 +239,9 @@ void Design::patternThickRect(Graphics::Surface *surface, Patterns &patterns, Co
void Design::patternRect(Graphics::Surface *surface, Patterns &patterns, Common::Rect &rect, byte fillType) {
for (int y = rect.top; y < rect.bottom; y++)
for (int x = rect.left; x < rect.right; x++)
- if (patterns[fillType-1][(y - rect.top) % 8] & (1 << (7 - (x - rect.left) % 8)))
- *((byte *)surface->getBasePtr(x, y)) = kColorBlack;
+ *((byte *)surface->getBasePtr(x, y)) =
+ (patterns[fillType-1][(y - rect.top) % 8] & (1 << (7 - (x - rect.left) % 8))) ?
+ kColorBlack : kColorWhite;
}
@@ -259,7 +260,8 @@ void Design::patternThickPolygon(Graphics::Surface *surface, Patterns &patterns,
for (i = 0; i < npoints; i++) {
if ((polyY[i] < pixelY && polyY[j] >= pixelY) || (polyY[j] < pixelY && polyY[i] >= pixelY)) {
- nodeX[nodes++] = (int)(polyX[i] + (pixelY - polyY[i]) / (polyY[j]-polyY[i]) * (polyX[j] - polyX[i]));
+ nodeX[nodes++] = (int)(polyX[i] + (double)(pixelY - polyY[i]) / (double)(polyY[j]-polyY[i]) *
+ (double)(polyX[j] - polyX[i]) + 0.5);
}
j = i;
}
@@ -286,8 +288,9 @@ void Design::patternThickPolygon(Graphics::Surface *surface, Patterns &patterns,
for (int pixelX = nodeX[i]; pixelX < nodeX[i + 1]; pixelX++)
if (pixelX >= 0 && pixelX < surface->w && pixelY >= 0 && pixelY < surface->h)
- if (patterns[fillType - 1][(pixelY - bbox.top) % 8] & (1 << (7 - (pixelX - bbox.left) % 8)))
- *((byte *)surface->getBasePtr(pixelX, pixelY)) = kColorBlack;
+ *((byte *)surface->getBasePtr(pixelX, pixelY)) =
+ (patterns[fillType - 1][(pixelY - bbox.top) % 8] & (1 << (7 - (pixelX - bbox.left) % 8))) ?
+ kColorBlack : kColorWhite;
}
}
}