From 532e8264541ee321ff5921ad19841a4ada8d6ee5 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Thu, 26 Feb 2009 13:25:36 +0000 Subject: Remove fb_widget_image_[st] and begin to pave the way for pointer hotspots svn path=/trunk/netsurf/; revision=6628 --- framebuffer/fb_bitmap.h | 3 +++ framebuffer/fb_image_data.c | 57 +++++++++++++++++++++++++++++++-------------- framebuffer/fb_image_data.h | 20 +++++++--------- framebuffer/fb_rootwindow.c | 14 +++-------- 4 files changed, 54 insertions(+), 40 deletions(-) diff --git a/framebuffer/fb_bitmap.h b/framebuffer/fb_bitmap.h index 6e11ad956..cbe7ed6b1 100644 --- a/framebuffer/fb_bitmap.h +++ b/framebuffer/fb_bitmap.h @@ -23,6 +23,9 @@ struct bitmap { int width; int height; uint8_t *pixdata; + /* The following two are only used for cursors */ + int hot_x; + int hot_y; }; #endif diff --git a/framebuffer/fb_image_data.c b/framebuffer/fb_image_data.c index 275104e81..79c7cb0f7 100644 --- a/framebuffer/fb_image_data.c +++ b/framebuffer/fb_image_data.c @@ -22,8 +22,11 @@ #include "framebuffer/fb_bitmap.h" struct bitmap pointer_image = { - 12, 22, - (uint8_t *) + .width = 12, + .height = 22, + .hot_x = 0, + .hot_y = 0, + .pixdata = (uint8_t *) "33L\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0""33L\37733L\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""33L\377\273\273\324\3773" @@ -65,8 +68,11 @@ struct bitmap pointer_image = { }; struct bitmap caret_image = { - 7, 19, - (uint8_t *) + .width = 7, + .height = 19, + .hot_x = 0, + .hot_y = 0, + .pixdata = (uint8_t *) "33L\37733L\37733L\377\0\0\0\0""33L\37733L\37733L\37733L\377\273\273\324\377" "\360\360\377\37733L\377\360\360\377\377\273\273\324\37733L\377\0\0\0\0""3" "3L\377\273\273\324\377\360\360\377\377\273\273\324\37733L\377\0\0\0\0\0\0" @@ -88,8 +94,11 @@ struct bitmap caret_image = { }; struct bitmap hand_image = { - 16, 22, - (uint8_t *) + .width = 16, + .height = 22, + .hot_x = 0, + .hot_y = 0, + .pixdata = (uint8_t *) "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""33L\37733L\377\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0""33L\377\273\273\324\377\273\273\324\37733L\377\0\0\0\0\0\0\0\0" @@ -149,9 +158,12 @@ struct bitmap hand_image = { "\0\0\0\0", }; -const fb_widget_image_t left_arrow = { - 22, 25, 4, - (uint8_t *) +struct bitmap left_arrow = { + .width = 22, + .height = 25, + .hot_x = 0, + .hot_y = 0, + .pixdata = (uint8_t *) "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" @@ -249,9 +261,12 @@ const fb_widget_image_t left_arrow = { "\6", }; -const fb_widget_image_t right_arrow = { - 22, 25, 4, - (uint8_t *) +struct bitmap right_arrow = { + .width = 22, + .height = 25, + .hot_x = 0, + .hot_y = 0, + .pixdata = (uint8_t *) "\0\10\0""0\0\11\0\350\0\10\0\206\0\10\0\14\377\377\377\0\377\377\377\0\377" "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" @@ -349,9 +364,12 @@ const fb_widget_image_t right_arrow = { "\377\377\377\0\377\377\377\0", }; -const fb_widget_image_t reload = { - 24, 25, 4, - (uint8_t *) +struct bitmap reload = { + .width = 24, + .height = 25, + .hot_x = 0, + .hot_y = 0, + .pixdata = (uint8_t *) "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\0\10\0" "\36\0\10\0O\0\10\0H\0\10\0!\0\10\0\2\377\377\377\0\377\377\377\0\377\377" @@ -453,9 +471,12 @@ const fb_widget_image_t reload = { "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0", }; -const fb_widget_image_t stop_image = { - 25, 25, 4, - (uint8_t *) +struct bitmap stop_image = { + .width = 25, + .height = 25, + .hot_x = 0, + .hot_y = 0, + .pixdata = (uint8_t *) "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" diff --git a/framebuffer/fb_image_data.h b/framebuffer/fb_image_data.h index c381bc6ad..1f45650ff 100644 --- a/framebuffer/fb_image_data.h +++ b/framebuffer/fb_image_data.h @@ -16,20 +16,18 @@ * along with this program. If not, see . */ -struct fb_widget_image_s { - unsigned int width; - unsigned int height; - unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ - unsigned char *pixel_data; -}; +#ifndef FB_IMAGE_DATA +#define FB_IMAGE_DATA -typedef struct fb_widget_image_s fb_widget_image_t; +#include "framebuffer/fb_bitmap.h" -extern const fb_widget_image_t left_arrow; -extern const fb_widget_image_t right_arrow; -extern const fb_widget_image_t reload; -extern const fb_widget_image_t stop_image; +extern struct bitmap left_arrow; +extern struct bitmap right_arrow; +extern struct bitmap reload; +extern struct bitmap stop_image; extern struct bitmap pointer_image; extern struct bitmap hand_image; extern struct bitmap caret_image; + +#endif /* FB_IMAGE_DATA */ diff --git a/framebuffer/fb_rootwindow.c b/framebuffer/fb_rootwindow.c index c10ec68aa..1ec5aa918 100644 --- a/framebuffer/fb_rootwindow.c +++ b/framebuffer/fb_rootwindow.c @@ -225,7 +225,7 @@ fb_widget_url_input(struct fb_widget *widget, struct gui_window *g, int value) static struct fb_widget * fb_add_button_widget(int x, int y, - const fb_widget_image_t *widget_image, + struct bitmap *widget_image, fb_widget_mouseclick_t click_rtn) { struct fb_widget *new_widget; @@ -242,16 +242,8 @@ fb_add_button_widget(int x, new_widget->click = click_rtn; - new_widget->bitmap = bitmap_create(widget_image->width, - widget_image->height, - 0); - - memcpy(new_widget->bitmap->pixdata, - widget_image->pixel_data, - widget_image->width * - widget_image->height * - widget_image->bytes_per_pixel); - + new_widget->bitmap = widget_image; + fb_insert_widget(new_widget); return new_widget; -- cgit v1.2.3