[Scummvm-cvs-logs] SF.net SVN: scummvm: [29441] scummvm/trunk/graphics/surface.cpp
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Tue Nov 6 23:40:30 CET 2007
Revision: 29441
http://scummvm.svn.sourceforge.net/scummvm/?rev=29441&view=rev
Author: lordhoto
Date: 2007-11-06 14:40:29 -0800 (Tue, 06 Nov 2007)
Log Message:
-----------
Cleanup.
Modified Paths:
--------------
scummvm/trunk/graphics/surface.cpp
Modified: scummvm/trunk/graphics/surface.cpp
===================================================================
--- scummvm/trunk/graphics/surface.cpp 2007-11-06 22:34:55 UTC (rev 29440)
+++ scummvm/trunk/graphics/surface.cpp 2007-11-06 22:40:29 UTC (rev 29441)
@@ -28,27 +28,20 @@
namespace Graphics {
-static void plotPoint1(int x, int y, int color, void *data) {
+template<typename T>
+static void plotPoint(int x, int y, int color, void *data) {
Surface *s = (Surface *)data;
if (x >= 0 && x < s->w && y >= 0 && y < s->h) {
- byte *ptr = (byte *)s->getBasePtr(x, y);
- *ptr = (byte)color;
+ T *ptr = (T *)s->getBasePtr(x, y);
+ *ptr = (T)color;
}
}
-static void plotPoint2(int x, int y, int color, void *data) {
- Surface *s = (Surface *)data;
- if (x >= 0 && x < s->w && y >= 0 && y < s->h) {
- uint16 *ptr = (uint16 *)s->getBasePtr(x, y);
- *ptr = (uint16)color;
- }
-}
-
void Surface::drawLine(int x0, int y0, int x1, int y1, uint32 color) {
if (bytesPerPixel == 1)
- Graphics::drawLine(x0, y0, x1, y1, color, &plotPoint1, this);
+ Graphics::drawLine(x0, y0, x1, y1, color, plotPoint<byte>, this);
else if (bytesPerPixel == 2)
- Graphics::drawLine(x0, y0, x1, y1, color, &plotPoint2, this);
+ Graphics::drawLine(x0, y0, x1, y1, color, plotPoint<uint16>, this);
else
error("Surface::drawLine: bytesPerPixel must be 1 or 2");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list