changeset 2901:133601e3b255

Added RenderPiont() API Merged the drawing tests into a single test program
author Sam Lantinga <slouken@libsdl.org>
date Sun, 21 Dec 2008 17:39:41 +0000
parents 3a9636c83849
children 83c3a4b0e421
files include/SDL_surface.h include/SDL_video.h src/video/SDL_blendpoint.c src/video/SDL_draw.h src/video/SDL_drawline.c src/video/SDL_drawpoint.c src/video/SDL_renderer_gl.c src/video/SDL_renderer_sw.c src/video/SDL_sysvideo.h src/video/SDL_video.c src/video/directfb/SDL_DirectFB_render.c src/video/dummy/SDL_nullrender.c src/video/x11/SDL_x11render.c src/video/x11/SDL_x11sym.h test/testdraw2.c test/testfill2.c test/testlines2.c
diffstat 17 files changed, 848 insertions(+), 441 deletions(-) [+]
line wrap: on
line diff
--- a/include/SDL_surface.h	Sun Dec 21 08:59:56 2008 +0000
+++ b/include/SDL_surface.h	Sun Dec 21 17:39:41 2008 +0000
@@ -366,6 +366,25 @@
     (SDL_Surface * src, SDL_PixelFormat * fmt, Uint32 flags);
 
 /*
+ * This function draws a point with 'color'
+ * The color should be a pixel of the format used by the surface, and 
+ * can be generated by the SDL_MapRGB() function.
+ * This function returns 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_DrawPoint
+    (SDL_Surface * dst, int x, int y, Uint32 color);
+
+/*
+ * This function blends a point with an RGBA value
+ * The color should be a pixel of the format used by the surface, and 
+ * can be generated by the SDL_MapRGB() function.
+ * This function returns 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_BlendPoint
+    (SDL_Surface * dst, int x, int y, int blendMode,
+     Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+
+/*
  * This function draws a line with 'color'
  * The color should be a pixel of the format used by the surface, and 
  * can be generated by the SDL_MapRGB() function.
--- a/include/SDL_video.h	Sun Dec 21 08:59:56 2008 +0000
+++ b/include/SDL_video.h	Sun Dec 21 17:39:41 2008 +0000
@@ -1197,6 +1197,18 @@
 extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(int *blendMode);
 
 /**
+ * \fn int SDL_RenderPoint(int x, int y)
+ *
+ * \brief Draw a point on the current rendering target.
+ *
+ * \param x The x coordinate of the point
+ * \param y The y coordinate of the point
+ *
+ * \return 0 on success, or -1 if there is no rendering context current
+ */
+extern DECLSPEC int SDLCALL SDL_RenderPoint(int x, int y);
+
+/**
  * \fn int SDL_RenderLine(int x1, int y1, int x2, int y2)
  *
  * \brief Draw a line on the current rendering target.
@@ -1208,7 +1220,6 @@
  *
  * \return 0 on success, or -1 if there is no rendering context current
  */
-
 extern DECLSPEC int SDLCALL SDL_RenderLine(int x1, int y1, int x2, int y2);
 
 /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/SDL_blendpoint.c	Sun Dec 21 17:39:41 2008 +0000
@@ -0,0 +1,256 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2009 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include "SDL_draw.h"
+
+static int
+SDL_BlendPoint_RGB555(SDL_Surface * dst, int x, int y, int blendMode, Uint8 r,
+                      Uint8 g, Uint8 b, Uint8 a)
+{
+    unsigned inva = 0xff - a;
+
+    switch (blendMode) {
+    case SDL_BLENDMODE_BLEND:
+        DRAW_SETPIXELXY_BLEND_RGB555(x, y);
+        break;
+    case SDL_BLENDMODE_ADD:
+        DRAW_SETPIXELXY_ADD_RGB555(x, y);
+        break;
+    case SDL_BLENDMODE_MOD:
+        DRAW_SETPIXELXY_MOD_RGB555(x, y);
+        break;
+    default:
+        DRAW_SETPIXELXY_RGB555(x, y);
+        break;
+    }
+    return 0;
+}
+
+static int
+SDL_BlendPoint_RGB565(SDL_Surface * dst, int x, int y, int blendMode, Uint8 r,
+                      Uint8 g, Uint8 b, Uint8 a)
+{
+    unsigned inva = 0xff - a;
+
+    switch (blendMode) {
+    case SDL_BLENDMODE_BLEND:
+        DRAW_SETPIXELXY_BLEND_RGB565(x, y);
+        break;
+    case SDL_BLENDMODE_ADD:
+        DRAW_SETPIXELXY_ADD_RGB565(x, y);
+        break;
+    case SDL_BLENDMODE_MOD:
+        DRAW_SETPIXELXY_MOD_RGB565(x, y);
+        break;
+    default:
+        DRAW_SETPIXELXY_RGB565(x, y);
+        break;
+    }
+    return 0;
+}
+
+static int
+SDL_BlendPoint_RGB888(SDL_Surface * dst, int x, int y, int blendMode, Uint8 r,
+                      Uint8 g, Uint8 b, Uint8 a)
+{
+    unsigned inva = 0xff - a;
+
+    switch (blendMode) {
+    case SDL_BLENDMODE_BLEND:
+        DRAW_SETPIXELXY_BLEND_RGB888(x, y);
+        break;
+    case SDL_BLENDMODE_ADD:
+        DRAW_SETPIXELXY_ADD_RGB888(x, y);
+        break;
+    case SDL_BLENDMODE_MOD:
+        DRAW_SETPIXELXY_MOD_RGB888(x, y);
+        break;
+    default:
+        DRAW_SETPIXELXY_RGB888(x, y);
+        break;
+    }
+    return 0;
+}
+
+static int
+SDL_BlendPoint_ARGB8888(SDL_Surface * dst, int x, int y, int blendMode,
+                        Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+    unsigned inva = 0xff - a;
+
+    switch (blendMode) {
+    case SDL_BLENDMODE_BLEND:
+        DRAW_SETPIXELXY_BLEND_ARGB8888(x, y);
+        break;
+    case SDL_BLENDMODE_ADD:
+        DRAW_SETPIXELXY_ADD_ARGB8888(x, y);
+        break;
+    case SDL_BLENDMODE_MOD:
+        DRAW_SETPIXELXY_MOD_ARGB8888(x, y);
+        break;
+    default:
+        DRAW_SETPIXELXY_ARGB8888(x, y);
+        break;
+    }
+    return 0;
+}
+
+static int
+SDL_BlendPoint_RGB(SDL_Surface * dst, int x, int y, int blendMode, Uint8 r,
+                   Uint8 g, Uint8 b, Uint8 a)
+{
+    SDL_PixelFormat *fmt = dst->format;
+    unsigned inva = 0xff - a;
+
+    switch (fmt->BytesPerPixel) {
+    case 2:
+        switch (blendMode) {
+        case SDL_BLENDMODE_BLEND:
+            DRAW_SETPIXELXY2_BLEND_RGB(x, y);
+            break;
+        case SDL_BLENDMODE_ADD:
+            DRAW_SETPIXELXY2_ADD_RGB(x, y);
+            break;
+        case SDL_BLENDMODE_MOD:
+            DRAW_SETPIXELXY2_MOD_RGB(x, y);
+            break;
+        default:
+            DRAW_SETPIXELXY2_RGB(x, y);
+            break;
+        }
+        return 0;
+    case 4:
+        switch (blendMode) {
+        case SDL_BLENDMODE_BLEND:
+            DRAW_SETPIXELXY4_BLEND_RGB(x, y);
+            break;
+        case SDL_BLENDMODE_ADD:
+            DRAW_SETPIXELXY4_ADD_RGB(x, y);
+            break;
+        case SDL_BLENDMODE_MOD:
+            DRAW_SETPIXELXY4_MOD_RGB(x, y);
+            break;
+        default:
+            DRAW_SETPIXELXY4_RGB(x, y);
+            break;
+        }
+        return 0;
+    default:
+        SDL_Unsupported();
+        return -1;
+    }
+}
+
+static int
+SDL_BlendPoint_RGBA(SDL_Surface * dst, int x, int y, int blendMode, Uint8 r,
+                    Uint8 g, Uint8 b, Uint8 a)
+{
+    SDL_PixelFormat *fmt = dst->format;
+    unsigned inva = 0xff - a;
+
+    switch (fmt->BytesPerPixel) {
+    case 4:
+        switch (blendMode) {
+        case SDL_BLENDMODE_BLEND:
+            DRAW_SETPIXELXY4_BLEND_RGBA(x, y);
+            break;
+        case SDL_BLENDMODE_ADD:
+            DRAW_SETPIXELXY4_ADD_RGBA(x, y);
+            break;
+        case SDL_BLENDMODE_MOD:
+            DRAW_SETPIXELXY4_MOD_RGBA(x, y);
+            break;
+        default:
+            DRAW_SETPIXELXY4_RGBA(x, y);
+            break;
+        }
+        return 0;
+    default:
+        SDL_Unsupported();
+        return -1;
+    }
+}
+
+int
+SDL_BlendPoint(SDL_Surface * dst, int x, int y, int blendMode, Uint8 r,
+               Uint8 g, Uint8 b, Uint8 a)
+{
+    SDL_PixelFormat *fmt = dst->format;
+
+    /* This function doesn't work on surfaces < 8 bpp */
+    if (dst->format->BitsPerPixel < 8) {
+        SDL_SetError("SDL_BlendPoint(): Unsupported surface format");
+        return (-1);
+    }
+
+    /* Perform clipping */
+    if (x < dst->clip_rect.x || y < dst->clip_rect.y ||
+        x >= (dst->clip_rect.x + dst->clip_rect.w) ||
+        y >= (dst->clip_rect.y + dst->clip_rect.h)) {
+        return 0;
+    }
+
+    if ((blendMode == SDL_BLENDMODE_BLEND)
+        || (blendMode == SDL_BLENDMODE_ADD)) {
+        r = DRAW_MUL(r, a);
+        g = DRAW_MUL(g, a);
+        b = DRAW_MUL(b, a);
+    }
+
+    switch (fmt->BitsPerPixel) {
+    case 15:
+        switch (fmt->Rmask) {
+        case 0x7C00:
+            return SDL_BlendPoint_RGB555(dst, x, y, blendMode, r, g, b, a);
+        }
+        break;
+    case 16:
+        switch (fmt->Rmask) {
+        case 0xF800:
+            return SDL_BlendPoint_RGB565(dst, x, y, blendMode, r, g, b, a);
+        }
+        break;
+    case 32:
+        switch (fmt->Rmask) {
+        case 0x00FF0000:
+            if (!fmt->Amask) {
+                return SDL_BlendPoint_RGB888(dst, x, y, blendMode, r, g, b,
+                                             a);
+            } else {
+                return SDL_BlendPoint_ARGB8888(dst, x, y, blendMode, r, g, b,
+                                               a);
+            }
+            break;
+        }
+    default:
+        break;
+    }
+
+    if (!fmt->Amask) {
+        return SDL_BlendPoint_RGB(dst, x, y, blendMode, r, g, b, a);
+    } else {
+        return SDL_BlendPoint_RGBA(dst, x, y, blendMode, r, g, b, a);
+    }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/SDL_draw.h	Sun Dec 21 08:59:56 2008 +0000
+++ b/src/video/SDL_draw.h	Sun Dec 21 17:39:41 2008 +0000
@@ -29,6 +29,13 @@
 
 #define DRAW_MUL(_a, _b) (((unsigned)(_a)*(_b))/255)
 
+#define DRAW_FASTSETPIXEL(x, y, type, bpp, color) \
+    *(type *)(dst->pixels + y * dst->pitch + x * bpp) = (type) color
+
+#define DRAW_FASTSETPIXEL1(x, y) DRAW_FASTSETPIXEL(x, y, Uint8, 1, color);
+#define DRAW_FASTSETPIXEL2(x, y) DRAW_FASTSETPIXEL(x, y, Uint16, 2, color);
+#define DRAW_FASTSETPIXEL4(x, y) DRAW_FASTSETPIXEL(x, y, Uint32, 4, color);
+
 #define DRAW_SETPIXEL(setpixel) \
 do { \
     unsigned sr = r, sg = g, sb = b, sa = a; \
--- a/src/video/SDL_drawline.c	Sun Dec 21 08:59:56 2008 +0000
+++ b/src/video/SDL_drawline.c	Sun Dec 21 17:39:41 2008 +0000
@@ -23,13 +23,8 @@
 
 #include "SDL_draw.h"
 
-#define SETPIXEL(x, y, type, bpp, color) \
-    *(type *)(dst->pixels + y * dst->pitch + x * bpp) = (type) color
 
-#define SETPIXEL1(x, y) SETPIXEL(x, y, Uint8, 1, color);
-#define SETPIXEL2(x, y) SETPIXEL(x, y, Uint16, 2, color);
-#define SETPIXEL4(x, y) SETPIXEL(x, y, Uint32, 4, color);
-
+int
 SDL_DrawLine(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color)
 {
     /* This function doesn't work on surfaces < 8 bpp */
@@ -47,16 +42,16 @@
 
     switch (dst->format->BytesPerPixel) {
     case 1:
-        DRAWLINE(x1, y1, x2, y2, SETPIXEL1);
+        DRAWLINE(x1, y1, x2, y2, DRAW_FASTSETPIXEL1);
         break;
     case 2:
-        DRAWLINE(x1, y1, x2, y2, SETPIXEL2);
+        DRAWLINE(x1, y1, x2, y2, DRAW_FASTSETPIXEL2);
         break;
     case 3:
         SDL_Unsupported();
         return -1;
     case 4:
-        DRAWLINE(x1, y1, x2, y2, SETPIXEL4);
+        DRAWLINE(x1, y1, x2, y2, DRAW_FASTSETPIXEL4);
         break;
     }
     return 0;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/SDL_drawpoint.c	Sun Dec 21 17:39:41 2008 +0000
@@ -0,0 +1,60 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2009 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include "SDL_draw.h"
+
+
+int
+SDL_DrawPoint(SDL_Surface * dst, int x, int y, Uint32 color)
+{
+    /* This function doesn't work on surfaces < 8 bpp */
+    if (dst->format->BitsPerPixel < 8) {
+        SDL_SetError("SDL_DrawLine(): Unsupported surface format");
+        return (-1);
+    }
+
+    /* Perform clipping */
+    if (x < dst->clip_rect.x || y < dst->clip_rect.y ||
+        x >= (dst->clip_rect.x + dst->clip_rect.w) ||
+        y >= (dst->clip_rect.y + dst->clip_rect.h)) {
+        return 0;
+    }
+
+    switch (dst->format->BytesPerPixel) {
+    case 1:
+        DRAW_FASTSETPIXEL1(x, y);
+        break;
+    case 2:
+        DRAW_FASTSETPIXEL2(x, y);
+        break;
+    case 3:
+        SDL_Unsupported();
+        return -1;
+    case 4:
+        DRAW_FASTSETPIXEL4(x, y);
+        break;
+    }
+    return 0;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/SDL_renderer_gl.c	Sun Dec 21 08:59:56 2008 +0000
+++ b/src/video/SDL_renderer_gl.c	Sun Dec 21 17:39:41 2008 +0000
@@ -98,6 +98,7 @@
                             int numrects, const SDL_Rect * rects);
 static int GL_SetDrawColor(SDL_Renderer * renderer);
 static int GL_SetDrawBlendMode(SDL_Renderer * renderer);
+static int GL_RenderPoint(SDL_Renderer * renderer, int x, int y);
 static int GL_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2,
                          int y2);
 static int GL_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect);
@@ -313,6 +314,7 @@
     renderer->DirtyTexture = GL_DirtyTexture;
     renderer->SetDrawColor = GL_SetDrawColor;
     renderer->SetDrawBlendMode = GL_SetDrawBlendMode;
+    renderer->RenderPoint = GL_RenderPoint;
     renderer->RenderLine = GL_RenderLine;
     renderer->RenderFill = GL_RenderFill;
     renderer->RenderCopy = GL_RenderCopy;
@@ -1097,11 +1099,9 @@
 }
 
 static int
-GL_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
+GL_RenderPoint(SDL_Renderer * renderer, int x, int y)
 {
     GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
-    //data->glLineWidth(1.0);
-    //data->glPointSize(1.0);
 
     SetBlendMode(data, renderer->blendMode);
 
@@ -1110,16 +1110,30 @@
                     (GLfloat) renderer->b * inv255f,
                     (GLfloat) renderer->a * inv255f);
 
-    if ((x1 == x2) && (y1 == y2)) {
-        data->glBegin(GL_POINTS);
-        data->glVertex2i(x1, y1);
-        data->glEnd();
-    } else {
-        data->glBegin(GL_LINES);
-        data->glVertex2i(x1, y1);
-        data->glVertex2i(x2, y2);
-        data->glEnd();
-    }
+    data->glBegin(GL_POINTS);
+    data->glVertex2i(x, y);
+    data->glEnd();
+
+    return 0;
+}
+
+static int
+GL_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
+{
+    GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+
+    SetBlendMode(data, renderer->blendMode);
+
+    data->glColor4f((GLfloat) renderer->r * inv255f,
+                    (GLfloat) renderer->g * inv255f,
+                    (GLfloat) renderer->b * inv255f,
+                    (GLfloat) renderer->a * inv255f);
+
+    data->glBegin(GL_LINES);
+    data->glVertex2i(x1, y1);
+    data->glVertex2i(x2, y2);
+    data->glEnd();
+
     return 0;
 }
 
--- a/src/video/SDL_renderer_sw.c	Sun Dec 21 08:59:56 2008 +0000
+++ b/src/video/SDL_renderer_sw.c	Sun Dec 21 17:39:41 2008 +0000
@@ -61,6 +61,7 @@
 static void SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
 static int SW_SetDrawColor(SDL_Renderer * renderer);
 static int SW_SetDrawBlendMode(SDL_Renderer * renderer);
+static int SW_RenderPoint(SDL_Renderer * renderer, int x, int y);
 static int SW_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2,
                          int y2);
 static int SW_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect);
@@ -227,6 +228,7 @@
 
     renderer->SetDrawColor = SW_SetDrawColor;
     renderer->SetDrawBlendMode = SW_SetDrawBlendMode;
+    renderer->RenderPoint = SW_RenderPoint;
     renderer->RenderLine = SW_RenderLine;
     renderer->RenderFill = SW_RenderFill;
     renderer->RenderCopy = SW_RenderCopy;
@@ -538,6 +540,49 @@
 }
 
 static int
+SW_RenderPoint(SDL_Renderer * renderer, int x, int y)
+{
+    SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
+    int status;
+
+    if (data->renderer->info.flags & SDL_RENDERER_PRESENTCOPY) {
+        SDL_Rect rect;
+
+        rect.x = x;
+        rect.y = y;
+        rect.w = 1;
+        rect.h = 1;
+        SDL_AddDirtyRect(&data->dirty, &rect);
+    }
+
+    if (data->renderer->LockTexture(data->renderer,
+                                    data->texture[data->current_texture],
+                                    &data->surface.clip_rect, 1,
+                                    &data->surface.pixels,
+                                    &data->surface.pitch) < 0) {
+        return -1;
+    }
+
+    if (renderer->blendMode == SDL_BLENDMODE_NONE ||
+        renderer->blendMode == SDL_BLENDMODE_MASK) {
+        Uint32 color =
+            SDL_MapRGBA(data->surface.format, renderer->r, renderer->g,
+                        renderer->b, renderer->a);
+
+        status = SDL_DrawPoint(&data->surface, x, y, color);
+    } else {
+        status =
+            SDL_BlendPoint(&data->surface, x, y, renderer->blendMode,
+                           renderer->r, renderer->g, renderer->b,
+                           renderer->a);
+    }
+
+    data->renderer->UnlockTexture(data->renderer,
+                                  data->texture[data->current_texture]);
+    return status;
+}
+
+static int
 SW_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
 {
     SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
@@ -571,7 +616,8 @@
         return -1;
     }
 
-    if (renderer->blendMode == SDL_BLENDMODE_NONE) {
+    if (renderer->blendMode == SDL_BLENDMODE_NONE ||
+        renderer->blendMode == SDL_BLENDMODE_MASK) {
         Uint32 color =
             SDL_MapRGBA(data->surface.format, renderer->r, renderer->g,
                         renderer->b, renderer->a);
--- a/src/video/SDL_sysvideo.h	Sun Dec 21 08:59:56 2008 +0000
+++ b/src/video/SDL_sysvideo.h	Sun Dec 21 17:39:41 2008 +0000
@@ -90,6 +90,7 @@
                           int numrects, const SDL_Rect * rects);
     int (*SetDrawColor) (SDL_Renderer * renderer);
     int (*SetDrawBlendMode) (SDL_Renderer * renderer);
+    int (*RenderPoint) (SDL_Renderer * renderer, int x, int y);
     int (*RenderLine) (SDL_Renderer * renderer, int x1, int y1, int x2,
                        int y2);
     int (*RenderFill) (SDL_Renderer * renderer, const SDL_Rect * rect);
--- a/src/video/SDL_video.c	Sun Dec 21 08:59:56 2008 +0000
+++ b/src/video/SDL_video.c	Sun Dec 21 17:39:41 2008 +0000
@@ -2070,6 +2070,70 @@
     return 0;
 }
 
+int
+SDL_RenderPoint(int x, int y)
+{
+    SDL_Renderer *renderer;
+    SDL_Window *window;
+    SDL_Rect real_rect;
+
+    if (!_this) {
+        SDL_UninitializedVideo();
+        return -1;
+    }
+    renderer = SDL_CurrentDisplay.current_renderer;
+    if (!renderer) {
+        return -1;
+    }
+    if (!renderer->RenderPoint) {
+        SDL_Unsupported();
+        return -1;
+    }
+    window = SDL_GetWindowFromID(renderer->window);
+    if (x < 0 || y < 0 || x >= window->w || y >= window->h) {
+        return 0;
+    }
+    return renderer->RenderPoint(renderer, x, y);
+}
+
+int
+SDL_RenderLine(int x1, int y1, int x2, int y2)
+{
+    SDL_Renderer *renderer;
+    SDL_Window *window;
+    SDL_Rect real_rect;
+
+    if (x1 == x2 && y1 == y2) {
+        return SDL_RenderPoint(x1, y1);
+    }
+
+    if (!_this) {
+        SDL_UninitializedVideo();
+        return -1;
+    }
+    renderer = SDL_CurrentDisplay.current_renderer;
+    if (!renderer) {
+        return -1;
+    }
+    if (!renderer->RenderLine) {
+        SDL_Unsupported();
+        return -1;
+    }
+#if 0
+    //FIXME: Need line intersect routine
+    window = SDL_GetWindowFromID(renderer->window);
+    real_rect.x = 0;
+    real_rect.y = 0;
+    real_rect.w = window->w;
+    real_rect.h = window->h;
+    if (rect) {
+        if (!SDL_IntersectRect(rect, &real_rect, &real_rect)) {
+            return 0;
+        }
+    }
+#endif
+    return renderer->RenderLine(renderer, x1, y1, x2, y2);
+}
 
 int
 SDL_RenderFill(const SDL_Rect * rect)
@@ -2104,41 +2168,6 @@
 }
 
 int
-SDL_RenderLine(int x1, int y1, int x2, int y2)
-{
-    SDL_Renderer *renderer;
-    SDL_Window *window;
-    SDL_Rect real_rect;
-
-    if (!_this) {
-        SDL_UninitializedVideo();
-        return -1;
-    }
-    renderer = SDL_CurrentDisplay.current_renderer;
-    if (!renderer) {
-        return -1;
-    }
-    if (!renderer->RenderLine) {
-        SDL_Unsupported();
-        return -1;
-    }
-#if 0
-    //FIXME: Need line intersect routine
-    window = SDL_GetWindowFromID(renderer->window);
-    real_rect.x = 0;
-    real_rect.y = 0;
-    real_rect.w = window->w;
-    real_rect.h = window->h;
-    if (rect) {
-        if (!SDL_IntersectRect(rect, &real_rect, &real_rect)) {
-            return 0;
-        }
-    }
-#endif
-    return renderer->RenderLine(renderer, x1, y1, x2, y2);
-}
-
-int
 SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect * srcrect,
                const SDL_Rect * dstrect)
 {
--- a/src/video/directfb/SDL_DirectFB_render.c	Sun Dec 21 08:59:56 2008 +0000
+++ b/src/video/directfb/SDL_DirectFB_render.c	Sun Dec 21 17:39:41 2008 +0000
@@ -73,6 +73,7 @@
                                   const SDL_Rect * rects);
 static int DirectFB_SetDrawColor(SDL_Renderer * renderer);
 static int DirectFB_SetDrawBlendMode(SDL_Renderer * renderer);
+static int DirectFB_RenderPoint(SDL_Renderer * renderer, int x, int y);
 static int DirectFB_RenderLine(SDL_Renderer * renderer, int x1, int y1,
                                int x2, int y2);
 static int DirectFB_RenderFill(SDL_Renderer * renderer,
@@ -295,6 +296,7 @@
     renderer->DirtyTexture = DirectFB_DirtyTexture;
     renderer->SetDrawColor = DirectFB_SetDrawColor;
     renderer->SetDrawBlendMode = DirectFB_SetDrawBlendMode;
+    renderer->RenderPoint = DirectFB_RenderPoint;
     renderer->RenderLine = DirectFB_RenderLine;
     renderer->RenderFill = DirectFB_RenderFill;
     renderer->RenderCopy = DirectFB_RenderCopy;
@@ -844,6 +846,19 @@
 }
 
 static int
+DirectFB_RenderPoint(SDL_Renderer * renderer, int x, int y)
+{
+    DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
+    DFBResult ret;
+
+    PrepareDraw(renderer);
+    SDL_DFB_CHECKERR(data->surface->DrawPoint(data->surface, x, y));
+    return 0;
+  error:
+    return -1;
+}
+
+static int
 DirectFB_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
 {
     DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
--- a/src/video/dummy/SDL_nullrender.c	Sun Dec 21 08:59:56 2008 +0000
+++ b/src/video/dummy/SDL_nullrender.c	Sun Dec 21 17:39:41 2008 +0000
@@ -33,6 +33,7 @@
                                               Uint32 flags);
 static int SDL_DUMMY_SetDrawColor(SDL_Renderer * renderer);
 static int SDL_DUMMY_SetDrawBlendMode(SDL_Renderer * renderer);
+static int SDL_DUMMY_RenderPoint(SDL_Renderer * renderer, int x, int y);
 static int SDL_DUMMY_RenderLine(SDL_Renderer * renderer, int x1, int y1,
                                 int x2, int y2);
 static int SDL_DUMMY_RenderFill(SDL_Renderer * renderer,
@@ -94,6 +95,7 @@
 
     renderer->SetDrawColor = SDL_DUMMY_SetDrawColor;
     renderer->SetDrawBlendMode = SDL_DUMMY_SetDrawBlendMode;
+    renderer->RenderPoint = SDL_DUMMY_RenderPoint;
     renderer->RenderLine = SDL_DUMMY_RenderLine;
     renderer->RenderFill = SDL_DUMMY_RenderFill;
     renderer->RenderCopy = SDL_DUMMY_RenderCopy;
@@ -143,6 +145,29 @@
 }
 
 static int
+SDL_DUMMY_RenderPoint(SDL_Renderer * renderer, int x, int y)
+{
+    SDL_DUMMY_RenderData *data =
+        (SDL_DUMMY_RenderData *) renderer->driverdata;
+    SDL_Surface *target = data->screens[data->current_screen];
+    int status;
+
+    if (renderer->blendMode == SDL_BLENDMODE_NONE ||
+        renderer->blendMode == SDL_BLENDMODE_MASK) {
+        Uint32 color =
+            SDL_MapRGBA(target->format, renderer->r, renderer->g, renderer->b,
+                        renderer->a);
+
+        status = SDL_DrawPoint(target, x, y, color);
+    } else {
+        status =
+            SDL_BlendPoint(target, x, y, renderer->blendMode, renderer->r,
+                           renderer->g, renderer->b, renderer->a);
+    }
+    return status;
+}
+
+static int
 SDL_DUMMY_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
 {
     SDL_DUMMY_RenderData *data =
@@ -150,7 +175,8 @@
     SDL_Surface *target = data->screens[data->current_screen];
     int status;
 
-    if (renderer->blendMode == SDL_BLENDMODE_NONE) {
+    if (renderer->blendMode == SDL_BLENDMODE_NONE ||
+        renderer->blendMode == SDL_BLENDMODE_MASK) {
         Uint32 color =
             SDL_MapRGBA(target->format, renderer->r, renderer->g, renderer->b,
                         renderer->a);
--- a/src/video/x11/SDL_x11render.c	Sun Dec 21 08:59:56 2008 +0000
+++ b/src/video/x11/SDL_x11render.c	Sun Dec 21 17:39:41 2008 +0000
@@ -49,6 +49,7 @@
 static void X11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
 static int X11_SetDrawColor(SDL_Renderer * renderer);
 static int X11_SetDrawBlendMode(SDL_Renderer * renderer);
+static int X11_RenderPoint(SDL_Renderer * renderer, int x, int y);
 static int X11_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2,
                           int y2);
 static int X11_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect);
@@ -196,6 +197,7 @@
     renderer->UnlockTexture = X11_UnlockTexture;
     renderer->SetDrawColor = X11_SetDrawColor;
     renderer->SetDrawBlendMode = X11_SetDrawBlendMode;
+    renderer->RenderPoint = X11_RenderPoint;
     renderer->RenderLine = X11_RenderLine;
     renderer->RenderFill = X11_RenderFill;
     renderer->RenderCopy = X11_RenderCopy;
@@ -593,6 +595,28 @@
 }
 
 static int
+X11_RenderPoint(SDL_Renderer * renderer, int x, int y)
+{
+    X11_RenderData *data = (X11_RenderData *) renderer->driverdata;
+    unsigned long foreground;
+
+    if (data->makedirty) {
+        SDL_Rect rect;
+
+        rect.x = x;
+        rect.y = y;
+        rect.w = 1;
+        rect.h = 1;
+        SDL_AddDirtyRect(&data->dirty, &rect);
+    }
+
+    foreground = renderdrawcolor(renderer, 1);
+    XSetForeground(data->display, data->gc, foreground);
+    XDrawPoint(data->display, data->drawable, data->gc, x, y);
+    return 0;
+}
+
+static int
 X11_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
 {
     X11_RenderData *data = (X11_RenderData *) renderer->driverdata;
--- a/src/video/x11/SDL_x11sym.h	Sun Dec 21 08:59:56 2008 +0000
+++ b/src/video/x11/SDL_x11sym.h	Sun Dec 21 17:39:41 2008 +0000
@@ -96,6 +96,7 @@
 SDL_X11_SYM(int,XPending,(Display* a),(a),return)
 SDL_X11_SYM(int,XPutImage,(Display* a,Drawable b,GC c,XImage* d,int e,int f,int g,int h,unsigned int i,unsigned int j),(a,b,c,d,e,f,g,h,i,j),return)
 SDL_X11_SYM(int,XDrawLine,(Display* a, Drawable b, GC c, int d, int e, int f, int g),(a,b,c,d,e,f,g),return)
+SDL_X11_SYM(int,XDrawPoint,(Display* a, Drawable b, GC c, int d, int e),(a,b,c,d,e),return)
 SDL_X11_SYM(int,XQueryColors,(Display* a,Colormap b,XColor* c,int d),(a,b,c,d),return)
 SDL_X11_SYM(int,XQueryKeymap,(Display* a,char *b),(a,b),return)
 SDL_X11_SYM(Bool,XQueryPointer,(Display* a,Window b,Window* c,Window* d,int* e,int* f,int* g,int* h,unsigned int* i),(a,b,c,d,e,f,g,h,i),return)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testdraw2.c	Sun Dec 21 17:39:41 2008 +0000
@@ -0,0 +1,284 @@
+
+/* Simple program:  draw as many random objects on the screen as possible */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+
+#include "common.h"
+
+#define NUM_OBJECTS	100
+
+static CommonState *state;
+static int num_objects;
+static SDL_bool cycle_color;
+static SDL_bool cycle_alpha;
+static int cycle_direction = 1;
+static int current_alpha = 255;
+static int current_color = 255;
+static SDL_BlendMode blendMode = SDL_BLENDMODE_NONE;
+
+void
+DrawPoints(SDL_WindowID window)
+{
+    int i;
+    int x, y;
+    int window_w, window_h;
+
+    /* Query the sizes */
+    SDL_GetWindowSize(window, &window_w, &window_h);
+
+    SDL_SetRenderDrawBlendMode(blendMode);
+    for (i = 0; i < num_objects; ++i) {
+        /* Cycle the color and alpha, if desired */
+        if (cycle_color) {
+            current_color += cycle_direction;
+            if (current_color < 0) {
+                current_color = 0;
+                cycle_direction = -cycle_direction;
+            }
+            if (current_color > 255) {
+                current_color = 255;
+                cycle_direction = -cycle_direction;
+            }
+        }
+        if (cycle_alpha) {
+            current_alpha += cycle_direction;
+            if (current_alpha < 0) {
+                current_alpha = 0;
+                cycle_direction = -cycle_direction;
+            }
+            if (current_alpha > 255) {
+                current_alpha = 255;
+                cycle_direction = -cycle_direction;
+            }
+        }
+        SDL_SetRenderDrawColor(255, (Uint8) current_color,
+                               (Uint8) current_color, (Uint8) current_alpha);
+
+        x = rand() % window_w;
+        y = rand() % window_h;
+        SDL_RenderPoint(x, y);
+    }
+    SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE);
+}
+
+void
+DrawLines(SDL_WindowID window)
+{
+    int i;
+    int x1, y1, x2, y2;
+    int window_w, window_h;
+
+    /* Query the sizes */
+    SDL_GetWindowSize(window, &window_w, &window_h);
+
+    SDL_SetRenderDrawBlendMode(blendMode);
+    for (i = 0; i < num_objects; ++i) {
+        /* Cycle the color and alpha, if desired */
+        if (cycle_color) {
+            current_color += cycle_direction;
+            if (current_color < 0) {
+                current_color = 0;
+                cycle_direction = -cycle_direction;
+            }
+            if (current_color > 255) {
+                current_color = 255;
+                cycle_direction = -cycle_direction;
+            }
+        }
+        if (cycle_alpha) {
+            current_alpha += cycle_direction;
+            if (current_alpha < 0) {
+                current_alpha = 0;
+                cycle_direction = -cycle_direction;
+            }
+            if (current_alpha > 255) {
+                current_alpha = 255;
+                cycle_direction = -cycle_direction;
+            }
+        }
+        SDL_SetRenderDrawColor(255, (Uint8) current_color,
+                               (Uint8) current_color, (Uint8) current_alpha);
+
+        if (i == 0) {
+            SDL_RenderLine(0, 0, window_w, window_h);
+            SDL_RenderLine(0, window_h, window_w, 0);
+            SDL_RenderLine(0, window_h / 2, window_w, window_h / 2);
+            SDL_RenderLine(window_w / 2, 0, window_w / 2, window_h);
+        } else {
+            x1 = rand() % window_w;
+            x2 = rand() % window_w;
+            y1 = rand() % window_h;
+            y2 = rand() % window_h;
+            SDL_RenderLine(x1, y1, x2, y2);
+        }
+    }
+    SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE);
+}
+
+void
+DrawRects(SDL_WindowID window)
+{
+    int i;
+    SDL_Rect rect;
+    int window_w, window_h;
+
+    /* Query the sizes */
+    SDL_GetWindowSize(window, &window_w, &window_h);
+
+    SDL_SetRenderDrawBlendMode(blendMode);
+    for (i = 0; i < num_objects/4; ++i) {
+        /* Cycle the color and alpha, if desired */
+        if (cycle_color) {
+            current_color += cycle_direction;
+            if (current_color < 0) {
+                current_color = 0;
+                cycle_direction = -cycle_direction;
+            }
+            if (current_color > 255) {
+                current_color = 255;
+                cycle_direction = -cycle_direction;
+            }
+        }
+        if (cycle_alpha) {
+            current_alpha += cycle_direction;
+            if (current_alpha < 0) {
+                current_alpha = 0;
+                cycle_direction = -cycle_direction;
+            }
+            if (current_alpha > 255) {
+                current_alpha = 255;
+                cycle_direction = -cycle_direction;
+            }
+        }
+        SDL_SetRenderDrawColor(255, (Uint8) current_color,
+                               (Uint8) current_color, (Uint8) current_alpha);
+
+        rect.w = rand() % (window_h / 2);
+        rect.h = rand() % (window_h / 2);
+        rect.x = (rand() % window_w) - (rect.w / 2);
+        rect.y = (rand() % window_w) - (rect.h / 2);
+        SDL_RenderFill(&rect);
+    }
+    SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE);
+}
+
+int
+main(int argc, char *argv[])
+{
+    int i, done;
+    SDL_Event event;
+    Uint32 then, now, frames;
+
+    /* Initialize parameters */
+    num_objects = NUM_OBJECTS;
+
+    /* Initialize test framework */
+    state = CommonCreateState(argv, SDL_INIT_VIDEO);
+    if (!state) {
+        return 1;
+    }
+    for (i = 1; i < argc;) {
+        int consumed;
+
+        consumed = CommonArg(state, i);
+        if (consumed == 0) {
+            consumed = -1;
+            if (SDL_strcasecmp(argv[i], "--blend") == 0) {
+                if (argv[i + 1]) {
+                    if (SDL_strcasecmp(argv[i + 1], "none") == 0) {
+                        blendMode = SDL_BLENDMODE_NONE;
+                        consumed = 2;
+                    } else if (SDL_strcasecmp(argv[i + 1], "mask") == 0) {
+                        blendMode = SDL_BLENDMODE_MASK;
+                        consumed = 2;
+                    } else if (SDL_strcasecmp(argv[i + 1], "blend") == 0) {
+                        blendMode = SDL_BLENDMODE_BLEND;
+                        consumed = 2;
+                    } else if (SDL_strcasecmp(argv[i + 1], "add") == 0) {
+                        blendMode = SDL_BLENDMODE_ADD;
+                        consumed = 2;
+                    } else if (SDL_strcasecmp(argv[i + 1], "mod") == 0) {
+                        blendMode = SDL_BLENDMODE_MOD;
+                        consumed = 2;
+                    }
+                }
+            } else if (SDL_strcasecmp(argv[i], "--cyclecolor") == 0) {
+                cycle_color = SDL_TRUE;
+                consumed = 1;
+            } else if (SDL_strcasecmp(argv[i], "--cyclealpha") == 0) {
+                cycle_alpha = SDL_TRUE;
+                consumed = 1;
+            } else if (SDL_isdigit(*argv[i])) {
+                num_objects = SDL_atoi(argv[i]);
+                consumed = 1;
+            }
+        }
+        if (consumed < 0) {
+            fprintf(stderr,
+                    "Usage: %s %s [--blend none|mask|blend|add|mod] [--cyclecolor] [--cyclealpha]\n",
+                    argv[0], CommonUsage(state));
+            return 1;
+        }
+        i += consumed;
+    }
+    if (!CommonInit(state)) {
+        return 2;
+    }
+
+    /* Create the windows and initialize the renderers */
+    for (i = 0; i < state->num_windows; ++i) {
+        SDL_SelectRenderer(state->windows[i]);
+        SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
+        SDL_RenderFill(NULL);
+    }
+
+    srand(time(NULL));
+
+    /* Main render loop */
+    frames = 0;
+    then = SDL_GetTicks();
+    done = 0;
+    while (!done) {
+        /* Check for events */
+        ++frames;
+        while (SDL_PollEvent(&event)) {
+            CommonEvent(state, &event, &done);
+            switch (event.type) {
+            case SDL_WINDOWEVENT:
+                switch (event.window.event) {
+                case SDL_WINDOWEVENT_EXPOSED:
+                    SDL_SelectRenderer(event.window.windowID);
+                    SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
+                    SDL_RenderFill(NULL);
+                    break;
+                }
+                break;
+            default:
+                break;
+            }
+        }
+        for (i = 0; i < state->num_windows; ++i) {
+            SDL_SelectRenderer(state->windows[i]);
+            SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
+            SDL_RenderFill(NULL);
+
+            DrawRects(state->windows[i]);
+            DrawLines(state->windows[i]);
+            DrawPoints(state->windows[i]);
+
+            SDL_RenderPresent();
+        }
+    }
+
+    /* Print out some timing information */
+    now = SDL_GetTicks();
+    if (now > then) {
+        double fps = ((double) frames * 1000) / (now - then);
+        printf("%2.2f frames per second\n", fps);
+    }
+    return 0;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/test/testfill2.c	Sun Dec 21 08:59:56 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +0,0 @@
-
-/* Simple program:  draw as many random rectangles on the screen as possible */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-
-#include "common.h"
-
-#define NUM_RECTS	100
-
-static CommonState *state;
-static int num_rects;
-static SDL_bool cycle_color;
-static SDL_bool cycle_alpha;
-static int cycle_direction = 1;
-static int current_alpha = 255;
-static int current_color = 255;
-static SDL_BlendMode blendMode = SDL_BLENDMODE_NONE;
-
-void
-DrawRects(SDL_WindowID window)
-{
-    int i, n;
-    SDL_Rect rect;
-    int window_w, window_h;
-
-    SDL_SelectRenderer(window);
-
-    /* Query the sizes */
-    SDL_GetWindowSize(window, &window_w, &window_h);
-
-    /* Move the sprite, bounce at the wall, and draw */
-    n = 0;
-    SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
-    SDL_RenderFill(NULL);
-
-    SDL_SetRenderDrawBlendMode(blendMode);
-    for (i = 0; i < num_rects; ++i) {
-        /* Cycle the color and alpha, if desired */
-        if (cycle_color) {
-            current_color += cycle_direction;
-            if (current_color < 0) {
-                current_color = 0;
-                cycle_direction = -cycle_direction;
-            }
-            if (current_color > 255) {
-                current_color = 255;
-                cycle_direction = -cycle_direction;
-            }
-        }
-        if (cycle_alpha) {
-            current_alpha += cycle_direction;
-            if (current_alpha < 0) {
-                current_alpha = 0;
-                cycle_direction = -cycle_direction;
-            }
-            if (current_alpha > 255) {
-                current_alpha = 255;
-                cycle_direction = -cycle_direction;
-            }
-        }
-        SDL_SetRenderDrawColor(255, (Uint8) current_color,
-                               (Uint8) current_color, (Uint8) current_alpha);
-
-        rect.w = rand() % (window_h / 2);
-        rect.h = rand() % (window_h / 2);
-        rect.x = (rand() % window_w) - (rect.w / 2);
-        rect.y = (rand() % window_w) - (rect.h / 2);
-        SDL_RenderFill(&rect);
-    }
-    SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE);
-
-    /* Update the screen! */
-    SDL_RenderPresent();
-}
-
-int
-main(int argc, char *argv[])
-{
-    int i, done;
-    SDL_Event event;
-    Uint32 then, now, frames;
-
-    /* Initialize parameters */
-    num_rects = NUM_RECTS;
-
-    /* Initialize test framework */
-    state = CommonCreateState(argv, SDL_INIT_VIDEO);
-    if (!state) {
-        return 1;
-    }
-    for (i = 1; i < argc;) {
-        int consumed;
-
-        consumed = CommonArg(state, i);
-        if (consumed == 0) {
-            consumed = -1;
-            if (SDL_strcasecmp(argv[i], "--blend") == 0) {
-                if (argv[i + 1]) {
-                    if (SDL_strcasecmp(argv[i + 1], "none") == 0) {
-                        blendMode = SDL_BLENDMODE_NONE;
-                        consumed = 2;
-                    } else if (SDL_strcasecmp(argv[i + 1], "mask") == 0) {
-                        blendMode = SDL_BLENDMODE_MASK;
-                        consumed = 2;
-                    } else if (SDL_strcasecmp(argv[i + 1], "blend") == 0) {
-                        blendMode = SDL_BLENDMODE_BLEND;
-                        consumed = 2;
-                    } else if (SDL_strcasecmp(argv[i + 1], "add") == 0) {
-                        blendMode = SDL_BLENDMODE_ADD;
-                        consumed = 2;
-                    } else if (SDL_strcasecmp(argv[i + 1], "mod") == 0) {
-                        blendMode = SDL_BLENDMODE_MOD;
-                        consumed = 2;
-                    }
-                }
-            } else if (SDL_strcasecmp(argv[i], "--cyclecolor") == 0) {
-                cycle_color = SDL_TRUE;
-                consumed = 1;
-            } else if (SDL_strcasecmp(argv[i], "--cyclealpha") == 0) {
-                cycle_alpha = SDL_TRUE;
-                consumed = 1;
-            } else if (SDL_isdigit(*argv[i])) {
-                num_rects = SDL_atoi(argv[i]);
-                consumed = 1;
-            }
-        }
-        if (consumed < 0) {
-            fprintf(stderr,
-                    "Usage: %s %s [--blend none|mask|blend|add|mod] [--cyclecolor] [--cyclealpha]\n",
-                    argv[0], CommonUsage(state));
-            return 1;
-        }
-        i += consumed;
-    }
-    if (!CommonInit(state)) {
-        return 2;
-    }
-
-    /* Create the windows and initialize the renderers */
-    for (i = 0; i < state->num_windows; ++i) {
-        SDL_SelectRenderer(state->windows[i]);
-        SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
-        SDL_RenderFill(NULL);
-    }
-
-    srand(time(NULL));
-
-    /* Main render loop */
-    frames = 0;
-    then = SDL_GetTicks();
-    done = 0;
-    while (!done) {
-        /* Check for events */
-        ++frames;
-        while (SDL_PollEvent(&event)) {
-            CommonEvent(state, &event, &done);
-            switch (event.type) {
-            case SDL_WINDOWEVENT:
-                switch (event.window.event) {
-                case SDL_WINDOWEVENT_EXPOSED:
-                    SDL_SelectRenderer(event.window.windowID);
-                    SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
-                    SDL_RenderFill(NULL);
-                    break;
-                }
-                break;
-            default:
-                break;
-            }
-        }
-        for (i = 0; i < state->num_windows; ++i) {
-            DrawRects(state->windows[i]);
-        }
-    }
-
-    /* Print out some timing information */
-    now = SDL_GetTicks();
-    if (now > then) {
-        double fps = ((double) frames * 1000) / (now - then);
-        printf("%2.2f frames per second\n", fps);
-    }
-    return 0;
-}
-
-/* vi: set ts=4 sw=4 expandtab: */
--- a/test/testlines2.c	Sun Dec 21 08:59:56 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,194 +0,0 @@
-
-/* Simple program:  draw as many random lines on the screen as possible */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-
-#include "common.h"
-
-#define NUM_LINES	100
-
-static CommonState *state;
-static int num_lines;
-static SDL_bool cycle_color;
-static SDL_bool cycle_alpha;
-static int cycle_direction = 1;
-static int current_alpha = 255;
-static int current_color = 255;
-static SDL_BlendMode blendMode = SDL_BLENDMODE_NONE;
-
-void
-DrawLines(SDL_WindowID window)
-{
-    int i, n;
-    int x1, y1, x2, y2;
-    int window_w, window_h;
-
-    SDL_SelectRenderer(window);
-
-    /* Query the sizes */
-    SDL_GetWindowSize(window, &window_w, &window_h);
-
-    /* Move the sprite, bounce at the wall, and draw */
-    n = 0;
-    SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
-    SDL_RenderFill(NULL);
-
-    SDL_SetRenderDrawBlendMode(blendMode);
-    for (i = 0; i < num_lines; ++i) {
-        /* Cycle the color and alpha, if desired */
-        if (cycle_color) {
-            current_color += cycle_direction;
-            if (current_color < 0) {
-                current_color = 0;
-                cycle_direction = -cycle_direction;
-            }
-            if (current_color > 255) {
-                current_color = 255;
-                cycle_direction = -cycle_direction;
-            }
-        }
-        if (cycle_alpha) {
-            current_alpha += cycle_direction;
-            if (current_alpha < 0) {
-                current_alpha = 0;
-                cycle_direction = -cycle_direction;
-            }
-            if (current_alpha > 255) {
-                current_alpha = 255;
-                cycle_direction = -cycle_direction;
-            }
-        }
-        SDL_SetRenderDrawColor(255, (Uint8) current_color,
-                               (Uint8) current_color, (Uint8) current_alpha);
-
-        if (i == 0) {
-            SDL_RenderLine(0, 0, window_w, window_h);
-            SDL_RenderLine(0, window_h, window_w, 0);
-            SDL_RenderLine(0, window_h / 2, window_w, window_h / 2);
-            SDL_RenderLine(window_w / 2, 0, window_w / 2, window_h);
-        } else {
-            x1 = rand() % window_w;
-            x2 = rand() % window_w;
-            y1 = rand() % window_h;
-            y2 = rand() % window_h;
-            SDL_RenderLine(x1, y1, x2, y2);
-        }
-    }
-    SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE);
-
-    /* Update the screen! */
-    SDL_RenderPresent();
-}
-
-int
-main(int argc, char *argv[])
-{
-    int i, done;
-    SDL_Event event;
-    Uint32 then, now, frames;
-
-    /* Initialize parameters */
-    num_lines = NUM_LINES;
-
-    /* Initialize test framework */
-    state = CommonCreateState(argv, SDL_INIT_VIDEO);
-    if (!state) {
-        return 1;
-    }
-    for (i = 1; i < argc;) {
-        int consumed;
-
-        consumed = CommonArg(state, i);
-        if (consumed == 0) {
-            consumed = -1;
-            if (SDL_strcasecmp(argv[i], "--blend") == 0) {
-                if (argv[i + 1]) {
-                    if (SDL_strcasecmp(argv[i + 1], "none") == 0) {
-                        blendMode = SDL_BLENDMODE_NONE;
-                        consumed = 2;
-                    } else if (SDL_strcasecmp(argv[i + 1], "mask") == 0) {
-                        blendMode = SDL_BLENDMODE_MASK;
-                        consumed = 2;
-                    } else if (SDL_strcasecmp(argv[i + 1], "blend") == 0) {
-                        blendMode = SDL_BLENDMODE_BLEND;
-                        consumed = 2;
-                    } else if (SDL_strcasecmp(argv[i + 1], "add") == 0) {
-                        blendMode = SDL_BLENDMODE_ADD;
-                        consumed = 2;
-                    } else if (SDL_strcasecmp(argv[i + 1], "mod") == 0) {
-                        blendMode = SDL_BLENDMODE_MOD;
-                        consumed = 2;
-                    }
-                }
-            } else if (SDL_strcasecmp(argv[i], "--cyclecolor") == 0) {
-                cycle_color = SDL_TRUE;
-                consumed = 1;
-            } else if (SDL_strcasecmp(argv[i], "--cyclealpha") == 0) {
-                cycle_alpha = SDL_TRUE;
-                consumed = 1;
-            } else if (SDL_isdigit(*argv[i])) {
-                num_lines = SDL_atoi(argv[i]);
-                consumed = 1;
-            }
-        }
-        if (consumed < 0) {
-            fprintf(stderr,
-                    "Usage: %s %s [--blend none|mask|blend|add|mod] [--cyclecolor] [--cyclealpha]\n",
-                    argv[0], CommonUsage(state));
-            return 1;
-        }
-        i += consumed;
-    }
-    if (!CommonInit(state)) {
-        return 2;
-    }
-
-    /* Create the windows and initialize the renderers */
-    for (i = 0; i < state->num_windows; ++i) {
-        SDL_SelectRenderer(state->windows[i]);
-        SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
-        SDL_RenderFill(NULL);
-    }
-
-    srand(time(NULL));
-
-    /* Main render loop */
-    frames = 0;
-    then = SDL_GetTicks();
-    done = 0;
-    while (!done) {
-        /* Check for events */
-        ++frames;
-        while (SDL_PollEvent(&event)) {
-            CommonEvent(state, &event, &done);
-            switch (event.type) {
-            case SDL_WINDOWEVENT:
-                switch (event.window.event) {
-                case SDL_WINDOWEVENT_EXPOSED:
-                    SDL_SelectRenderer(event.window.windowID);
-                    SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
-                    SDL_RenderFill(NULL);
-                    break;
-                }
-                break;
-            default:
-                break;
-            }
-        }
-        for (i = 0; i < state->num_windows; ++i) {
-            DrawLines(state->windows[i]);
-        }
-    }
-
-    /* Print out some timing information */
-    now = SDL_GetTicks();
-    if (now > then) {
-        double fps = ((double) frames * 1000) / (now - then);
-        printf("%2.2f frames per second\n", fps);
-    }
-    return 0;
-}
-
-/* vi: set ts=4 sw=4 expandtab: */