changeset 298:fd4dcd3fe08f trunk

[svn] - make linedrawing code support offscreen surfaces more robustly.
author nenolod
date Wed, 22 Nov 2006 21:57:19 -0800
parents 44ad758c2d98
children ee8246755369
files ChangeLog src/paranormal/drawing.c
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Nov 22 21:44:54 2006 -0800
+++ b/ChangeLog	Wed Nov 22 21:57:19 2006 -0800
@@ -1,3 +1,11 @@
+2006-11-23 05:44:54 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [648]
+  - better default values for Scope.
+  
+  trunk/src/paranormal/wave.c |    6 +++---
+  1 file changed, 3 insertions(+), 3 deletions(-)
+
+
 2006-11-23 05:30:18 +0000  William Pitcock <nenolod@nenolod.net>
   revision [646]
   - fix handling of strings
--- a/src/paranormal/drawing.c	Wed Nov 22 21:44:54 2006 -0800
+++ b/src/paranormal/drawing.c	Wed Nov 22 21:57:19 2006 -0800
@@ -17,6 +17,9 @@
   gint dx = x1 - x0;
   gint dy = y1 - y0;
 
+  if (x0 > pn_image_data->width || x0 < 0 || y0 > pn_image_data->height || y0 < 0)
+     return;
+
   pn_image_data->surface[0][PN_IMG_INDEX(x0, y0)] = value;
 
   if (dx != 0)
@@ -30,6 +33,9 @@
           x0 += dx;
           y0 = m * x0 + b;
 
+          if (x0 > pn_image_data->width || x0 < 0 || y0 > pn_image_data->height || y0 < 0)
+            continue;
+
           pn_image_data->surface[0][PN_IMG_INDEX(x0, y0)] = value;
         }
     }