r5394 vince - in /branches/vince/netsurf-fb: Makefile Makefile.sources framebuffer/fb_plotters.c

netsurf at semichrome.net netsurf at semichrome.net
Mon Sep 22 00:00:03 BST 2008


Author: vince
Date: Sun Sep 21 18:00:03 2008
New Revision: 5394

URL: http://source.netsurf-browser.org?rev=5394&view=rev
Log:
Fix off by one error in line plotting clipping

Modified:
    branches/vince/netsurf-fb/Makefile
    branches/vince/netsurf-fb/Makefile.sources
    branches/vince/netsurf-fb/framebuffer/fb_plotters.c

Modified: branches/vince/netsurf-fb/Makefile
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/Makefile?rev=5394&r1=5393&r2=5394&view=diff
==============================================================================
--- branches/vince/netsurf-fb/Makefile (original)
+++ branches/vince/netsurf-fb/Makefile Sun Sep 21 18:00:03 2008
@@ -471,7 +471,8 @@
     CFLAGS += -std=c99 -I. -I/usr/lib/able/include -Dsmall $(WARNFLAGS)
     LDFLAGS += -lxml2 -lz -ljpeg -lcurl -lm 
     SUBTARGET := -able
-  else
+  endif
+  ifeq ($(NETSURF_FB_FRONTEND),dummy)
     $(eval $(call pkg_config_find_and_add,RSVG,librsvg-2.0,SVG rendering))
     $(eval $(call pkg_config_find_and_add,ROSPRITE,librosprite,RISC OS sprite rendering))
     $(eval $(call pkg_config_find_and_add,HUBBUB,libhubbub,Hubbub HTML parser))

Modified: branches/vince/netsurf-fb/Makefile.sources
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/Makefile.sources?rev=5394&r1=5393&r2=5394&view=diff
==============================================================================
--- branches/vince/netsurf-fb/Makefile.sources (original)
+++ branches/vince/netsurf-fb/Makefile.sources Sun Sep 21 18:00:03 2008
@@ -100,7 +100,8 @@
 endif
 ifeq ($(NETSURF_FB_FRONTEND),able)
 S_FRAMEBUFFER += fb_frontend_ablefb.c
-else
+endif
+ifeq ($(NETSURF_FB_FRONTEND),dummy)
 S_FRAMEBUFFER += fb_frontend_dummy.c
 endif
 

Modified: branches/vince/netsurf-fb/framebuffer/fb_plotters.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_plotters.c?rev=5394&r1=5393&r2=5394&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_plotters.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_plotters.c Sun Sep 21 18:00:03 2008
@@ -94,10 +94,10 @@
 bool fb_plotters_clip_line(const bbox_t *clip, 
                            int *x0, int *y0, int *x1, int *y1)
 {
-        char region1 = REGION(*x0, *y0,
-                               clip->x0, clip->x1, clip->y0, clip->y1);
-        char region2 = REGION(*x1, *y1,
-                               clip->x0, clip->x1, clip->y0, clip->y1);
+        char region1;
+        char region2;
+        region1 = REGION(*x0, *y0, clip->x0, clip->x1 - 1, clip->y0, clip->y1 - 1);
+        region2 = REGION(*x1, *y1, clip->x0, clip->x1 - 1, clip->y0, clip->y1 - 1);
 
         while (region1 | region2) {
                 if (region1 & region2) {
@@ -110,8 +110,8 @@
                         if (region1 & 8) { 
                                 /* divide line at bottom */
                                 *x0 = (*x0 + (*x1-*x0) *
-                                       (clip->y1 - *y0) / (*y1-*y0));
-                                *y0 = clip->y1;
+                                       (clip->y1 - 1 - *y0) / (*y1-*y0));
+                                *y0 = clip->y1 - 1;
                         } else if (region1 & 4) { 
                                 /* divide line at top */
                                 *x0 = (*x0 + (*x1-*x0) *
@@ -120,8 +120,8 @@
                         } else if (region1 & 2) { 
                                 /* divide line at right */
                                 *y0 = (*y0 +(*y1-*y0) *
-                                       (clip->x1 - *x0) / (*x1-*x0));
-                                *x0 = clip->x1;
+                                       (clip->x1  - 1 - *x0) / (*x1-*x0));
+                                *x0 = clip->x1 - 1;
                         } else if (region1 & 1) { 
                                 /* divide line at right */
                                 *y0 = (*y0 +(*y1-*y0) *
@@ -130,14 +130,14 @@
                         }
 
                         region1 = REGION(*x0, *y0,
-                                         clip->x0, clip->x1, clip->y0, clip->y1);
+                                         clip->x0, clip->x1 - 1, clip->y0, clip->y1 - 1);
                 } else {
                         /* second point */
                         if (region2 & 8) {  
                                 /* divide line at bottom*/
                                 *x1 = (*x0 + (*x1-*x0) *
-                                       (clip->y1 - *y0) / (*y1-*y0));
-                                *y1 = clip->y1;
+                                       (clip->y1  - 1 - *y0) / (*y1-*y0));
+                                *y1 = clip->y1 - 1;
                         } else if (region2 & 4) { 
                                 /* divide line at top*/
                                 *x1 = (*x0 +(*x1-*x0) *
@@ -146,8 +146,8 @@
                         } else if (region2 & 2) { 
                                 /* divide line at right*/
                                 *y1 = (*y0 +(*y1-*y0) *
-                                       (clip->x1 - *x0) / (*x1 - *x0));
-                                *x1 = clip->x1;
+                                       (clip->x1  - 1 - *x0) / (*x1 - *x0));
+                                *x1 = clip->x1 - 1;
                         } else if (region2 & 1) { 
                                 /* divide line at right*/
                                 *y1 = (*y0 +(*y1-*y0) *
@@ -156,7 +156,7 @@
                         }
 
                         region2 = REGION(*x1, *y1,
-                                         clip->x0, clip->x1, clip->y0, clip->y1);
+                                         clip->x0, clip->x1 - 1, clip->y0, clip->y1 - 1);
                 }
         }
 




More information about the netsurf-commits mailing list