aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2016-02-21 14:41:29 +0100
committerJohannes Schickel2016-02-21 14:41:29 +0100
commit5bc3a5aa3f1ed9eeb5a65b509d1bccb50ec43015 (patch)
treebc037147d1089e45c675ad281cea08becdebb7b6
parent0e7facad7640a67aafac54ae2b63ac07a4c1cbda (diff)
downloadscummvm-rg350-5bc3a5aa3f1ed9eeb5a65b509d1bccb50ec43015.tar.gz
scummvm-rg350-5bc3a5aa3f1ed9eeb5a65b509d1bccb50ec43015.tar.bz2
scummvm-rg350-5bc3a5aa3f1ed9eeb5a65b509d1bccb50ec43015.zip
GRAPHICS: Let drawLineAlg in VectorRenderer code take unsigned dx, dy.
-rw-r--r--graphics/VectorRendererSpec.cpp12
-rw-r--r--graphics/VectorRendererSpec.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp
index 64a4a5cbd6..c5a1d7b3e4 100644
--- a/graphics/VectorRendererSpec.cpp
+++ b/graphics/VectorRendererSpec.cpp
@@ -774,8 +774,8 @@ drawLine(int x1, int y1, int x2, int y2) {
SWAP(y1, y2);
}
- int dx = ABS(x2 - x1);
- int dy = ABS(y2 - y1);
+ uint dx = ABS(x2 - x1);
+ uint dy = ABS(y2 - y1);
// this is a point, not a line. stoopid.
if (dy == 0 && dx == 0)
@@ -1327,7 +1327,7 @@ drawBevelSquareAlg(int x, int y, int w, int h, int bevel, PixelType top_color, P
/** GENERIC LINE ALGORITHM **/
template<typename PixelType>
void VectorRendererSpec<PixelType>::
-drawLineAlg(int x1, int y1, int x2, int y2, int dx, int dy, PixelType color) {
+drawLineAlg(int x1, int y1, int x2, int y2, uint dx, uint dy, PixelType color) {
PixelType *ptr = (PixelType *)_activeSurface->getBasePtr(x1, y1);
int pitch = _activeSurface->pitch / _activeSurface->format.bytesPerPixel;
int xdir = (x2 > x1) ? 1 : -1;
@@ -1966,7 +1966,7 @@ drawRoundedSquareShadow(int x1, int y1, int r, int w, int h, int offset) {
/** LINES **/
template<typename PixelType>
void VectorRendererAA<PixelType>::
-drawLineAlg(int x1, int y1, int x2, int y2, int dx, int dy, PixelType color) {
+drawLineAlg(int x1, int y1, int x2, int y2, uint dx, uint dy, PixelType color) {
PixelType *ptr = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1);
int pitch = Base::_activeSurface->pitch / Base::_activeSurface->format.bytesPerPixel;
@@ -1977,7 +1977,7 @@ drawLineAlg(int x1, int y1, int x2, int y2, int dx, int dy, PixelType color) {
*ptr = (PixelType)color;
if (dx > dy) {
- gradient = (uint32)(dy << 16) / (uint32)dx;
+ gradient = (dy << 16) / dx;
error_acc = 0;
while (--dx) {
@@ -1994,7 +1994,7 @@ drawLineAlg(int x1, int y1, int x2, int y2, int dx, int dy, PixelType color) {
this->blendPixelPtr(ptr + pitch, color, alpha);
}
} else {
- gradient = (uint32)(dx << 16) / (uint32)dy;
+ gradient = (dx << 16) / dy;
error_acc = 0;
while (--dy) {
diff --git a/graphics/VectorRendererSpec.h b/graphics/VectorRendererSpec.h
index f47cc3997a..3e54608b8e 100644
--- a/graphics/VectorRendererSpec.h
+++ b/graphics/VectorRendererSpec.h
@@ -150,7 +150,7 @@ protected:
* @see VectorRendererAA::drawCircleAlg
*/
virtual void drawLineAlg(int x1, int y1, int x2, int y2,
- int dx, int dy, PixelType color);
+ uint dx, uint dy, PixelType color);
virtual void drawCircleAlg(int x, int y, int r,
PixelType color, FillMode fill_m);
@@ -278,7 +278,7 @@ protected:
*
* @see VectorRenderer::drawLineAlg()
*/
- virtual void drawLineAlg(int x1, int y1, int x2, int y2, int dx, int dy, PixelType color);
+ virtual void drawLineAlg(int x1, int y1, int x2, int y2, uint dx, uint dy, PixelType color);
/**
* "Wu's Circle Antialiasing Algorithm" as published by Xiaolin Wu, July 1991