aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2011-10-27 19:20:28 -0400
committerMatthew Hoops2011-10-27 19:20:28 -0400
commitc2af197edb7719ca4d4ad77d778c135db6149ba4 (patch)
treedd25b339fb877ad6c7fced735d25296f7eec68b7
parent627684ca73833117425f3fd9d2257efb2157cb3c (diff)
downloadscummvm-rg350-c2af197edb7719ca4d4ad77d778c135db6149ba4.tar.gz
scummvm-rg350-c2af197edb7719ca4d4ad77d778c135db6149ba4.tar.bz2
scummvm-rg350-c2af197edb7719ca4d4ad77d778c135db6149ba4.zip
GRAPHICS: Add a Surface wrapper for drawThickLine
-rw-r--r--graphics/surface.cpp11
-rw-r--r--graphics/surface.h16
2 files changed, 27 insertions, 0 deletions
diff --git a/graphics/surface.cpp b/graphics/surface.cpp
index e0b25f22e9..c1c676ed0b 100644
--- a/graphics/surface.cpp
+++ b/graphics/surface.cpp
@@ -48,6 +48,17 @@ void Surface::drawLine(int x0, int y0, int x1, int y1, uint32 color) {
error("Surface::drawLine: bytesPerPixel must be 1, 2, or 4");
}
+void Surface::drawThickLine(int x0, int y0, int x1, int y1, int penX, int penY, uint32 color) {
+ if (format.bytesPerPixel == 1)
+ Graphics::drawThickLine(x0, y0, x1, y1, penX, penY, color, plotPoint<byte>, this);
+ else if (format.bytesPerPixel == 2)
+ Graphics::drawThickLine(x0, y0, x1, y1, penX, penY, color, plotPoint<uint16>, this);
+ else if (format.bytesPerPixel == 4)
+ Graphics::drawThickLine(x0, y0, x1, y1, penX, penY, color, plotPoint<uint32>, this);
+ else
+ error("Surface::drawThickLine: bytesPerPixel must be 1, 2, or 4");
+}
+
void Surface::create(uint16 width, uint16 height, const PixelFormat &f) {
free();
diff --git a/graphics/surface.h b/graphics/surface.h
index 018a283aad..9d91a601e4 100644
--- a/graphics/surface.h
+++ b/graphics/surface.h
@@ -142,10 +142,26 @@ struct Surface {
* @param x1 The x coordinate of the end point.
* @param y1 The y coordinate of the end point.
* @param color The color of the line.
+ * @note This is just a wrapper around Graphics::drawLine
*/
void drawLine(int x0, int y0, int x1, int y1, uint32 color);
/**
+ * Draw a thick line.
+ *
+ * @param x0 The x coordinate of the start point.
+ * @param y0 The y coordiante of the start point.
+ * @param x1 The x coordinate of the end point.
+ * @param y1 The y coordinate of the end point.
+ * @param penX The width of the pen (thickness in the x direction)
+ * @param penY The height of the pen (thickness in the y direction)
+ * @param color The color of the line.
+ * @note This is just a wrapper around Graphics::drawThickLine
+ * @note The x/y coordinates of the start and end points are the upper-left most part of the pen
+ */
+ void drawThickLine(int x0, int y0, int x1, int y1, int penX, int penY, uint32 color);
+
+ /**
* Draw a horizontal line.
*
* @param x The start x coordinate of the line.