aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2017-05-30 16:49:04 -0400
committerPaul Gilbert2017-05-30 16:49:04 -0400
commit98ad7ca3556ddbac3067c68940add964b371157b (patch)
tree341bf7df52f50be4ca3ca2e3b3fdda14b5e306df /engines
parent0d35da379135650c70f3a317d3f907b7bd39f0df (diff)
downloadscummvm-rg350-98ad7ca3556ddbac3067c68940add964b371157b.tar.gz
scummvm-rg350-98ad7ca3556ddbac3067c68940add964b371157b.tar.bz2
scummvm-rg350-98ad7ca3556ddbac3067c68940add964b371157b.zip
TITANIC: CSurfaceArea fillRect is actually drawLine
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/star_control/photo_crosshairs.cpp16
-rw-r--r--engines/titanic/star_control/star_closeup.cpp12
-rw-r--r--engines/titanic/star_control/star_field.cpp34
-rw-r--r--engines/titanic/star_control/star_markers.cpp8
-rw-r--r--engines/titanic/star_control/star_points1.cpp2
-rw-r--r--engines/titanic/star_control/star_points2.cpp2
-rw-r--r--engines/titanic/star_control/surface_area.cpp16
-rw-r--r--engines/titanic/star_control/surface_area.h15
8 files changed, 56 insertions, 49 deletions
diff --git a/engines/titanic/star_control/photo_crosshairs.cpp b/engines/titanic/star_control/photo_crosshairs.cpp
index bc5b4eaa8a..eb6268ca96 100644
--- a/engines/titanic/star_control/photo_crosshairs.cpp
+++ b/engines/titanic/star_control/photo_crosshairs.cpp
@@ -167,10 +167,10 @@ void CPhotoCrosshairs::draw(CSurfaceArea *surfaceArea) {
const CStarPosition &src = _entries[idx];
double xp = src.x, yp = src.y;
- surfaceArea->fillRect(FRect(xp - 8.0, yp, xp - 4.0, yp));
- surfaceArea->fillRect(FRect(xp + 4.0, yp, xp + 8.0, yp));
- surfaceArea->fillRect(FRect(xp, yp - 8.0, xp, yp - 4.0));
- surfaceArea->fillRect(FRect(xp, yp + 4.0, xp, yp + 8.0));
+ surfaceArea->drawLine(FRect(xp - 8.0, yp, xp - 4.0, yp));
+ surfaceArea->drawLine(FRect(xp + 4.0, yp, xp + 8.0, yp));
+ surfaceArea->drawLine(FRect(xp, yp - 8.0, xp, yp - 4.0));
+ surfaceArea->drawLine(FRect(xp, yp + 4.0, xp, yp + 8.0));
}
surfaceArea->_pixel = savedPixel;
@@ -236,10 +236,10 @@ void CPhotoCrosshairs::drawAt(const FPoint &pt, CSurfaceArea *surfaceArea) {
SurfaceAreaMode savedMode = surfaceArea->setMode(SA_XOR);
- surfaceArea->fillRect(FRect(pt._x - 8.0, pt._y, pt._x - 4.0, pt._y));
- surfaceArea->fillRect(FRect(pt._x + 4.0, pt._y, pt._x + 8.0, pt._y));
- surfaceArea->fillRect(FRect(pt._x, pt._y - 8.0, pt._x, pt._y - 4.0));
- surfaceArea->fillRect(FRect(pt._x, pt._y + 4.0, pt._x, pt._y + 8.0));
+ surfaceArea->drawLine(FRect(pt._x - 8.0, pt._y, pt._x - 4.0, pt._y));
+ surfaceArea->drawLine(FRect(pt._x + 4.0, pt._y, pt._x + 8.0, pt._y));
+ surfaceArea->drawLine(FRect(pt._x, pt._y - 8.0, pt._x, pt._y - 4.0));
+ surfaceArea->drawLine(FRect(pt._x, pt._y + 4.0, pt._x, pt._y + 8.0));
surfaceArea->_pixel = savedPixel;
surfaceArea->setColorFromPixel();
diff --git a/engines/titanic/star_control/star_closeup.cpp b/engines/titanic/star_control/star_closeup.cpp
index 51383045b1..c5e5e584db 100644
--- a/engines/titanic/star_control/star_closeup.cpp
+++ b/engines/titanic/star_control/star_closeup.cpp
@@ -309,7 +309,7 @@ void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector
GridEntry &grid2 = _grid[d1._index2];
if (grid1._z > val1 && grid2._z > val1) {
- surfaceArea->fillRect(FRect(grid1._position._x, grid1._position._y,
+ surfaceArea->drawLine(FRect(grid1._position._x, grid1._position._y,
grid2._position._x, grid2._position._y));
}
}
@@ -331,7 +331,7 @@ void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector
GridEntry &grid2 = _grid[d1._index2];
if (grid1._z > val1 && grid2._z > val1) {
- surfaceArea->fillRect(FRect(grid1._position._x, grid1._position._y,
+ surfaceArea->drawLine(FRect(grid1._position._x, grid1._position._y,
grid2._position._x, grid2._position._y));
}
}
@@ -353,7 +353,7 @@ void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector
GridEntry &grid2 = _grid[d1._index2];
if (grid1._z > val1 && grid2._z > val1) {
- surfaceArea->fillRect(FRect(grid1._position._x, grid1._position._y,
+ surfaceArea->drawLine(FRect(grid1._position._x, grid1._position._y,
grid2._position._x, grid2._position._y));
}
}
@@ -413,7 +413,7 @@ void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector
GridEntry &grid2 = _grid[d1._index2];
if (grid2._z > val1 && grid1._z > val1) {
- surfaceArea->fillRect(FRect(grid1._position._x, grid1._position._y,
+ surfaceArea->drawLine(FRect(grid1._position._x, grid1._position._y,
grid2._position._x, grid2._position._y));
}
}
@@ -435,7 +435,7 @@ void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector
GridEntry &grid2 = _grid[d1._index2];
if (grid2._z > val1 && grid1._z > val1) {
- surfaceArea->fillRect(FRect(grid1._position._x, grid1._position._y,
+ surfaceArea->drawLine(FRect(grid1._position._x, grid1._position._y,
grid2._position._x, grid2._position._y));
}
}
@@ -457,7 +457,7 @@ void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector
GridEntry &grid2 = _grid[d1._index2];
if (grid2._z > val1 && grid1._z > val1) {
- surfaceArea->fillRect(FRect(grid1._position._x, grid1._position._y,
+ surfaceArea->drawLine(FRect(grid1._position._x, grid1._position._y,
grid2._position._x, grid2._position._y));
}
}
diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp
index b0d677ef77..aad6382d5d 100644
--- a/engines/titanic/star_control/star_field.cpp
+++ b/engines/titanic/star_control/star_field.cpp
@@ -147,22 +147,22 @@ void CStarField::drawCrosshairs(CSurfaceArea *surfaceArea) {
surfaceArea->_pixel = 0x323232;
surfaceArea->setColorFromPixel();
- surfaceArea->fillRect(FRect(202.60417, 63.75, 397.39584, 63.75));
- surfaceArea->fillRect(FRect(202.60417, 276.25, 397.39584, 276.25));
- surfaceArea->fillRect(FRect(193.75, 72.604164, 193.75, 267.39584));
- surfaceArea->fillRect(FRect(406.25, 72.604164, 406.25, 267.39584));
- surfaceArea->fillRect(FRect(202.60417, 63.75, 202.60417, 68.177086));
- surfaceArea->fillRect(FRect(397.39584, 63.75, 397.39584, 68.177086));
- surfaceArea->fillRect(FRect(202.60417, 276.25, 202.60417, 271.82291));
- surfaceArea->fillRect(FRect(397.39584, 276.25, 397.39584, 271.82291));
- surfaceArea->fillRect(FRect(193.75, 72.604164, 198.17708, 72.604164));
- surfaceArea->fillRect(FRect(193.75, 267.39584, 198.17708, 267.39584));
- surfaceArea->fillRect(FRect(406.25, 72.604164, 401.82291, 72.604164));
- surfaceArea->fillRect(FRect(406.25, 267.39584, 401.82291, 267.39584));
- surfaceArea->fillRect(FRect(300.0, 63.75, 300.0, 54.895832));
- surfaceArea->fillRect(FRect(300.0, 276.25, 300.0, 285.10416));
- surfaceArea->fillRect(FRect(193.75, 170.0, 184.89583, 170.0));
- surfaceArea->fillRect(FRect(406.25, 170.0, 415.10416, 170.0));
+ surfaceArea->drawLine(FRect(202.60417, 63.75, 397.39584, 63.75));
+ surfaceArea->drawLine(FRect(202.60417, 276.25, 397.39584, 276.25));
+ surfaceArea->drawLine(FRect(193.75, 72.604164, 193.75, 267.39584));
+ surfaceArea->drawLine(FRect(406.25, 72.604164, 406.25, 267.39584));
+ surfaceArea->drawLine(FRect(202.60417, 63.75, 202.60417, 68.177086));
+ surfaceArea->drawLine(FRect(397.39584, 63.75, 397.39584, 68.177086));
+ surfaceArea->drawLine(FRect(202.60417, 276.25, 202.60417, 271.82291));
+ surfaceArea->drawLine(FRect(397.39584, 276.25, 397.39584, 271.82291));
+ surfaceArea->drawLine(FRect(193.75, 72.604164, 198.17708, 72.604164));
+ surfaceArea->drawLine(FRect(193.75, 267.39584, 198.17708, 267.39584));
+ surfaceArea->drawLine(FRect(406.25, 72.604164, 401.82291, 72.604164));
+ surfaceArea->drawLine(FRect(406.25, 267.39584, 401.82291, 267.39584));
+ surfaceArea->drawLine(FRect(300.0, 63.75, 300.0, 54.895832));
+ surfaceArea->drawLine(FRect(300.0, 276.25, 300.0, 285.10416));
+ surfaceArea->drawLine(FRect(193.75, 170.0, 184.89583, 170.0));
+ surfaceArea->drawLine(FRect(406.25, 170.0, 415.10416, 170.0));
surfaceArea->_pixel = oldPixel;
surfaceArea->setColorFromPixel();
@@ -176,7 +176,7 @@ void CStarField::fn4(CSurfaceArea *surfaceArea, CStarCamera *camera) {
if (fn5(surfaceArea, camera, v1, v2, v3) > -1.0) {
surfaceArea->_pixel = 0xA0A0;
surfaceArea->setColorFromPixel();
- surfaceArea->fillRect(FRect(v1._x, v1._y, v3._x, v3._y));
+ surfaceArea->drawLine(FRect(v1._x, v1._y, v3._x, v3._y));
}
}
}
diff --git a/engines/titanic/star_control/star_markers.cpp b/engines/titanic/star_control/star_markers.cpp
index f9867d72df..deb34bf2a1 100644
--- a/engines/titanic/star_control/star_markers.cpp
+++ b/engines/titanic/star_control/star_markers.cpp
@@ -53,16 +53,16 @@ void CStarMarkers::draw(CSurfaceArea *surfaceArea, CStarCamera *camera, CStarClo
FRect r1(center._x + vTemp._x, center._y + vTemp._y,
center._x + vTemp._x + 4.0, center._y + vTemp._y + 4.0);
- surfaceArea->fillRect(r1);
+ surfaceArea->drawLine(r1);
FRect r2(r1.right, r1.bottom, r1.right + 4.0, r1.top);
- surfaceArea->fillRect(r2);
+ surfaceArea->drawLine(r2);
FRect r3(r2.right, r1.top, r1.right, r1.top - 4.0);
- surfaceArea->fillRect(r3);
+ surfaceArea->drawLine(r3);
FRect r4(r1.right, r1.top - 4.0, r1.left, r1.top);
- surfaceArea->fillRect(r4);
+ surfaceArea->drawLine(r4);
}
}
diff --git a/engines/titanic/star_control/star_points1.cpp b/engines/titanic/star_control/star_points1.cpp
index 1923711e15..8b5bdd14ed 100644
--- a/engines/titanic/star_control/star_points1.cpp
+++ b/engines/titanic/star_control/star_points1.cpp
@@ -95,7 +95,7 @@ void CStarPoints1::draw(CSurfaceArea *surface, CStarCamera *camera) {
r.right = vector4._x + vWidth2;
r.top = vector2._y + vHeight2;
r.left = vector2._x + vWidth2;
- surface->fillRect(r);
+ surface->drawLine(r);
}
vector1 = vector3;
diff --git a/engines/titanic/star_control/star_points2.cpp b/engines/titanic/star_control/star_points2.cpp
index 9097ffde2e..8a2a3becb4 100644
--- a/engines/titanic/star_control/star_points2.cpp
+++ b/engines/titanic/star_control/star_points2.cpp
@@ -106,7 +106,7 @@ void CStarPoints2::draw(CSurfaceArea *surface, CStarCamera *camera) {
r.right = vector4._x + vWidth2;
r.top = vector2._y + vHeight2;
r.left = vector2._x + vWidth2;
- surface->fillRect(r);
+ surface->drawLine(r);
}
}
}
diff --git a/engines/titanic/star_control/surface_area.cpp b/engines/titanic/star_control/surface_area.cpp
index d0881fd304..745ccc9cc1 100644
--- a/engines/titanic/star_control/surface_area.cpp
+++ b/engines/titanic/star_control/surface_area.cpp
@@ -109,7 +109,7 @@ void CSurfaceArea::pixelToRGB(uint pixel, uint *rgb) {
}
}
-double CSurfaceArea::fillRect(const FRect &rect) {
+double CSurfaceArea::drawLine(const FRect &rect) {
if (rect.empty())
return rect.top;
@@ -195,16 +195,16 @@ double CSurfaceArea::fillRect(const FRect &rect) {
// Fill area
if (_mode == SA_NONE) {
- s.fillRect(rr, _rgb);
+ s.drawLine(rr.left, rr.top, rr.right, rr.bottom, _rgb);
} else {
- colorRect(s, rr, _colorMask, _color);
+ drawLine(s, rr, _colorMask, _color);
}
return r.top;
}
template<typename T>
-static void colorRectFn(Graphics::Surface &s, const Common::Rect &r,
+static void drawLineFn(Graphics::Surface &s, const Common::Rect &r,
uint andMask, uint xorMask) {
for (int yp = r.top; yp < r.bottom; ++yp) {
T *pixelP = (T *)s.getBasePtr(r.left, yp);
@@ -213,17 +213,17 @@ static void colorRectFn(Graphics::Surface &s, const Common::Rect &r,
}
}
-void CSurfaceArea::colorRect(Graphics::Surface &s, const Common::Rect &r,
+void CSurfaceArea::drawLine(Graphics::Surface &s, const Common::Rect &r,
uint andMask, uint xorMask) {
switch (s.format.bytesPerPixel) {
case 1:
- colorRectFn<byte>(s, r, andMask, xorMask);
+ drawLineFn<byte>(s, r, andMask, xorMask);
break;
case 2:
- colorRectFn<uint16>(s, r, andMask, xorMask);
+ drawLineFn<uint16>(s, r, andMask, xorMask);
break;
default:
- colorRectFn<uint32>(s, r, andMask, xorMask);
+ drawLineFn<uint32>(s, r, andMask, xorMask);
break;
}
}
diff --git a/engines/titanic/star_control/surface_area.h b/engines/titanic/star_control/surface_area.h
index 4794a1514d..a7065f0cdd 100644
--- a/engines/titanic/star_control/surface_area.h
+++ b/engines/titanic/star_control/surface_area.h
@@ -49,9 +49,9 @@ private:
void pixelToRGB(uint pixel, uint *rgb);
/**
- * Alters the pixels of a specified rectangle using a passed and and xor mask
+ * Alters the pixels of a specified line using a passed and and xor mask
*/
- static void colorRect(Graphics::Surface &s, const Common::Rect &r, uint andMask, uint xorMask);
+ static void drawLine(Graphics::Surface &s, const Common::Rect &r, uint andMask, uint xorMask);
public:
int _field0;
int _width;
@@ -85,9 +85,16 @@ public:
void setColorFromPixel();
/**
- * Fills a rectangular area
+ * Draws a line on the surface
*/
- double fillRect(const FRect &rect);
+ double drawLine(const FRect &rect);
+
+ /**
+ * Draws a line on the surface
+ */
+ double drawLine(const Common::Point &pt1, const Common::Point &pt2) {
+ return drawLine(FRect(pt1.x, pt1.y, pt2.x, pt2.y));
+ }
};
} // End of namespace Titanic