r5342 vince - in /branches/vince/netsurf-fb/framebuffer: fb_16bpp_plotters.c fb_32bpp_plotters.c fb_8bpp_plotters.c fb_init_linux.c fb_plotters.c fb_plotters.h

netsurf at semichrome.net netsurf at semichrome.net
Tue Sep 16 00:39:36 BST 2008


Author: vince
Date: Mon Sep 15 18:39:36 2008
New Revision: 5342

URL: http://source.netsurf-browser.org?rev=5342&view=rev
Log:
consolidate polygon plotters

Modified:
    branches/vince/netsurf-fb/framebuffer/fb_16bpp_plotters.c
    branches/vince/netsurf-fb/framebuffer/fb_32bpp_plotters.c
    branches/vince/netsurf-fb/framebuffer/fb_8bpp_plotters.c
    branches/vince/netsurf-fb/framebuffer/fb_init_linux.c
    branches/vince/netsurf-fb/framebuffer/fb_plotters.c
    branches/vince/netsurf-fb/framebuffer/fb_plotters.h

Modified: branches/vince/netsurf-fb/framebuffer/fb_16bpp_plotters.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_16bpp_plotters.c?rev=5342&r1=5341&r2=5342&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_16bpp_plotters.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_16bpp_plotters.c Mon Sep 15 18:39:36 2008
@@ -154,15 +154,8 @@
 
 static bool fb_16bpp_polygon(int *p, unsigned int n, colour fill)
 {
-        int pnt;
-        int *cur;
         /*LOG(("p %p, n %d, fill 0x%lx", p, n, fill));*/
-        
-        for (pnt = 1; pnt < n; pnt++) {
-                cur = p + (pnt << 1);
-                fb_16bpp_line(cur[-2], cur[-1], cur[0], cur[1], 1, fill, false, false);
-        }
-	return true;
+        return fb_plotters_polygon(p, n, fill, fb_16bpp_line);
 }
 
 

Modified: branches/vince/netsurf-fb/framebuffer/fb_32bpp_plotters.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_32bpp_plotters.c?rev=5342&r1=5341&r2=5342&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_32bpp_plotters.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_32bpp_plotters.c Mon Sep 15 18:39:36 2008
@@ -58,7 +58,7 @@
 static bool fb_32bpp_polygon(int *p, unsigned int n, colour fill)
 {
         LOG(("%s(%p, %d, 0x%lx)\n", __func__, p,n,fill));
-	return true;
+        return fb_plotters_polygon(p, n, fill, fb_32bpp_line);
 }
 
 

Modified: branches/vince/netsurf-fb/framebuffer/fb_8bpp_plotters.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_8bpp_plotters.c?rev=5342&r1=5341&r2=5342&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_8bpp_plotters.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_8bpp_plotters.c Mon Sep 15 18:39:36 2008
@@ -57,8 +57,8 @@
 
 static bool fb_8bpp_polygon(int *p, unsigned int n, colour fill)
 {
-        LOG(("%s(%p, %d, 0x%lx)\n", __func__, p,n,fill));
-	return true;
+        /*LOG(("%p, %d, 0x%lx", p,n,fill));*/
+        return fb_plotters_polygon(p, n, fill, fb_8bpp_line);
 }
 
 

Modified: branches/vince/netsurf-fb/framebuffer/fb_init_linux.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_init_linux.c?rev=5342&r1=5341&r2=5342&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_init_linux.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_init_linux.c Mon Sep 15 18:39:36 2008
@@ -21,8 +21,10 @@
 #include <linux/input.h>
 
 #include "css/css.h"
+#include "desktop/browser.h"
 #include "framebuffer/fb_gui.h"
 #include "framebuffer/fb_plotters.h"
+#include "framebuffer/fb_schedule.h"
 
 #include "utils/log.h"
 
@@ -56,20 +58,21 @@
 /* devices                                                              */
 
 struct DEVS {
-        char *fb0;
-        char *fbnr;
-        char *ttynr;
+        const char *fb0;
+        const char *fbnr;
+        const char *ttynr;
 };
 
 struct DEVS devs_default = {
-fb0:   "/dev/fb0",
-fbnr:  "/dev/fb%d",
-ttynr: "/dev/tty%d",
+        .fb0 =  "/dev/fb0",
+        .fbnr = "/dev/fb%d",
+        .ttynr = "/dev/tty%d",
 };
+
 struct DEVS devs_devfs = {
-fb0:   "/dev/fb/0",
-fbnr:  "/dev/fb/%d",
-ttynr: "/dev/vc/%d",
+        .fb0 = "/dev/fb/0",
+        .fbnr = "/dev/fb/%d",
+        .ttynr = "/dev/vc/%d",
 };
 struct DEVS *devices;
 
@@ -146,7 +149,7 @@
 /* -------------------------------------------------------------------- */
 /* initialisation & cleanup                                             */
 
-void
+static void
 fb_memset (void *addr, int c, size_t len)
 {
 #if 1 /* defined(__powerpc__) */
@@ -295,7 +298,8 @@
 }
 
 /* Hmm. radeonfb needs this. matroxfb doesn't. */
-static int fb_activate_current(int tty)
+static int 
+fb_activate_current(int tty)
 {
         struct vt_stat vts;
     
@@ -314,7 +318,34 @@
         return 0;
 }
 
-int
+static void
+fb_cleanup(void)
+{
+        /* restore console */
+        if (-1 == ioctl(fb,FBIOPUT_VSCREENINFO,&fb_ovar))
+                perror("ioctl FBIOPUT_VSCREENINFO");
+        if (-1 == ioctl(fb,FBIOGET_FSCREENINFO,&fb_fix))
+                perror("ioctl FBIOGET_FSCREENINFO");
+        if (fb_ovar.bits_per_pixel == 8 ||
+            fb_fix.visual == FB_VISUAL_DIRECTCOLOR) {
+                if (-1 == ioctl(fb,FBIOPUTCMAP,&ocmap))
+                        perror("ioctl FBIOPUTCMAP");
+        }
+        close(fb);
+
+        if (-1 == ioctl(tty,KDSETMODE, kd_mode))
+                perror("ioctl KDSETMODE");
+        if (-1 == ioctl(tty,VT_SETMODE, &vt_omode))
+                perror("ioctl VT_SETMODE");
+        if (orig_vt_no && -1 == ioctl(tty, VT_ACTIVATE, orig_vt_no))
+                perror("ioctl VT_ACTIVATE");
+        if (orig_vt_no && -1 == ioctl(tty, VT_WAITACTIVE, orig_vt_no))
+                perror("ioctl VT_WAITACTIVE");
+        tcsetattr(tty, TCSANOW, &term);
+        close(tty);
+}
+
+static int
 fb_init(char *device, char *mode, int bpp, int vt)
 {
         char   fbdev[16];
@@ -427,32 +458,6 @@
         exit(1);
 }
 
-void
-fb_cleanup(void)
-{
-        /* restore console */
-        if (-1 == ioctl(fb,FBIOPUT_VSCREENINFO,&fb_ovar))
-                perror("ioctl FBIOPUT_VSCREENINFO");
-        if (-1 == ioctl(fb,FBIOGET_FSCREENINFO,&fb_fix))
-                perror("ioctl FBIOGET_FSCREENINFO");
-        if (fb_ovar.bits_per_pixel == 8 ||
-            fb_fix.visual == FB_VISUAL_DIRECTCOLOR) {
-                if (-1 == ioctl(fb,FBIOPUTCMAP,&ocmap))
-                        perror("ioctl FBIOPUTCMAP");
-        }
-        close(fb);
-
-        if (-1 == ioctl(tty,KDSETMODE, kd_mode))
-                perror("ioctl KDSETMODE");
-        if (-1 == ioctl(tty,VT_SETMODE, &vt_omode))
-                perror("ioctl VT_SETMODE");
-        if (orig_vt_no && -1 == ioctl(tty, VT_ACTIVATE, orig_vt_no))
-                perror("ioctl VT_ACTIVATE");
-        if (orig_vt_no && -1 == ioctl(tty, VT_WAITACTIVE, orig_vt_no))
-                perror("ioctl VT_WAITACTIVE");
-        tcsetattr(tty, TCSANOW, &term);
-        close(tty);
-}
 
 /* -------------------------------------------------------------------- */
 /* handle fatal errors                                                  */
@@ -465,7 +470,7 @@
         siglongjmp(fb_fatal_cleanup,signal);
 }
 
-void
+static void
 fb_catch_exit_signals(void)
 {
         struct sigaction act,old;
@@ -498,7 +503,10 @@
 {
         framebuffer_t *newfb;
         int ploop;
+
         fb_init("/dev/fb0", "800x600-70", 16, 1);
+        fb_switch_init();
+        fb_catch_exit_signals();
 
         newfb = calloc(1, sizeof(framebuffer_t));
 

Modified: branches/vince/netsurf-fb/framebuffer/fb_plotters.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_plotters.c?rev=5342&r1=5341&r2=5342&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_plotters.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_plotters.c Mon Sep 15 18:39:36 2008
@@ -187,6 +187,22 @@
         return r | (g << 8) | (b << 16);
 }
 
+bool
+fb_plotters_polygon(int *p, unsigned int n, colour fill,bool (linefn)(int x0, int y0, int x1, int y1, int width, colour c, bool dotted, bool dashed))
+{
+        unsigned int pnt;
+        int *cur;
+        
+        for (pnt = 1; pnt < n; pnt++) {
+                cur = p + (pnt << 1);
+                linefn(cur[-2], cur[-1], cur[0], cur[1], 1, fill, false, false);
+        }
+
+        linefn(cur[0], cur[1], p[0], p[1], 1, fill, false, false);
+
+	return true;
+}
+
 /*
  * Local Variables:
  * c-basic-offset:8

Modified: branches/vince/netsurf-fb/framebuffer/fb_plotters.h
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_plotters.h?rev=5342&r1=5341&r2=5342&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_plotters.h (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_plotters.h Mon Sep 15 18:39:36 2008
@@ -43,10 +43,13 @@
 bool fb_plotters_clip_line_ctx(int *x0, int *y0, int *x1, int *y1);
 bool fb_plotters_clip_line(const bbox_t *clip, int *x0, int *y0, int *x1, int *y1);
 
+bool fb_plotters_polygon(int *p, unsigned int n, colour fill, bool (linefn)(int x0, int y0, int x1, int y1, int width, colour c, bool dotted, bool dashed));
+
 colour fb_plotters_ablend(colour pixel, colour scrpixel);
 
 /* generic plotter entry points */
 bool fb_clip(int x0, int y0, int x1, int y1);
 
 
+
 #endif




More information about the netsurf-commits mailing list