summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2004-04-24 23:42:32 +0000
committerJames Bursa <james@netsurf-browser.org>2004-04-24 23:42:32 +0000
commit1f07fc6de5ae4e9999efb1fc1cd0f25a27f1bd64 (patch)
treed1f926d45423a1b68a82e40d2a876542110a3f16 /riscos
parentbfb0116bea8078950c905b5872849d763beea728 (diff)
downloadnetsurf-1f07fc6de5ae4e9999efb1fc1cd0f25a27f1bd64.tar.gz
netsurf-1f07fc6de5ae4e9999efb1fc1cd0f25a27f1bd64.tar.bz2
[project @ 2004-04-24 23:42:31 by bursa]
Replace void pointer in content callbacks with union content_msg_data. Fix animated gif flickering (except for scaled or masked gifs). Add gif to the debug builds. svn path=/import/netsurf/; revision=801
Diffstat (limited to 'riscos')
-rw-r--r--riscos/gif.c28
-rw-r--r--riscos/menus.c10
-rw-r--r--riscos/window.c45
3 files changed, 54 insertions, 29 deletions
diff --git a/riscos/gif.c b/riscos/gif.c
index 94fdc6a42..6e50889a1 100644
--- a/riscos/gif.c
+++ b/riscos/gif.c
@@ -33,7 +33,7 @@
All GIFs are dynamically decompressed using the routines that gifread.c
provides. Whilst this allows support for progressive decoding, it is
not implemented here as NetSurf currently does not provide such support.
-
+
[rjw] - Sun 4th April 2004
*/
@@ -54,18 +54,18 @@ void nsgif_create(struct content *c, const char *params[]) {
int nsgif_convert(struct content *c, unsigned int iwidth, unsigned int iheight) {
struct gif_animation *gif;
-
+
/* Create our animation
*/
gif = c->data.gif.gif;
gif->gif_data = c->source_data;
gif->buffer_size = c->source_size;
gif->buffer_position = 0; // Paranoid
-
+
/* Initialise the GIF
*/
gif_initialise(gif);
-
+
/* Store our content width
*/
c->width = gif->width;
@@ -88,10 +88,10 @@ void nsgif_redraw(struct content *c, long x, long y,
unsigned long width, unsigned long height,
long clip_x0, long clip_y0, long clip_x1, long clip_y1,
float scale) {
-
+
int previous_frame;
unsigned int frame;
-
+
/* Decode from the last frame to the current frame
*/
previous_frame = c->data.gif.gif->decoded_frame;
@@ -132,6 +132,7 @@ void nsgif_destroy(struct content *c)
void nsgif_animate(void *p)
{
struct content *c = p;
+ union content_msg_data data;
/* at the moment just advance by one frame */
c->data.gif.current_frame++;
@@ -147,7 +148,20 @@ void nsgif_animate(void *p)
schedule(c->data.gif.gif->frame_delays[c->data.gif.current_frame],
nsgif_animate, c);
- content_broadcast(c, CONTENT_MSG_REDRAW, 0);
+ /* area within gif to redraw (currently whole gif) */
+ data.redraw.x = 0;
+ data.redraw.y = 0;
+ data.redraw.width = c->width;
+ data.redraw.height = c->height;
+
+ /* redraw background (true) or plot on top (false) */
+ data.redraw.full_redraw = false;
+
+ /* other data */
+ data.redraw.object = c;
+ data.redraw.object_x = 0;
+ data.redraw.object_y = 0;
+ content_broadcast(c, CONTENT_MSG_REDRAW, data);
}
#endif
diff --git a/riscos/menus.c b/riscos/menus.c
index 07f83748a..212537fce 100644
--- a/riscos/menus.c
+++ b/riscos/menus.c
@@ -187,7 +187,7 @@ void translate_menu(wimp_menu *menu)
menu->entries[0].menu_flags |= wimp_MENU_TITLE_INDIRECTED;
}
-
+
/* items */
do {
indirected_text = (char *)messages_get(menu->entries[i].data.text);
@@ -325,7 +325,7 @@ void ro_gui_menu_selection(wimp_selection *selection)
if (selection->items[2] == 1) option_filter_sprites = !option_filter_sprites;
if (selection->items[2] >= 0) {
ro_gui_menu_prepare_images();
- content_broadcast(c, CONTENT_MSG_REDRAW, 0);
+/* content_broadcast(c, CONTENT_MSG_REDRAW, 0); */
}
break;
@@ -374,7 +374,7 @@ void ro_gui_menu_warning(wimp_message_menu_warning *warning)
// if ((warning->selection.items[0] != 0) && (warning->selection.items[0] != 3))
// return;
-
+
switch (warning->selection.items[0]) {
case 0: /* Page -> */
switch (warning->selection.items[1]) {
@@ -393,7 +393,7 @@ void ro_gui_menu_warning(wimp_message_menu_warning *warning)
case 2: /* Save complete */
gui_current_save_type = GUI_SAVE_COMPLETE;
break;
-
+
case 0: /* Page info */
ro_gui_menu_pageinfo(warning);
@@ -478,7 +478,7 @@ void ro_gui_menu_prepare_save(struct content *c)
static void ro_gui_menu_prepare_images(void) {
if (current_menu != browser_menu) return;
-
+
/* We don't currently have any local options so we update from the global ones
*/
browser_image_menu->entries[0].menu_flags &= ~wimp_MENU_TICKED;
diff --git a/riscos/window.c b/riscos/window.c
index 9afe4f623..15ea21ba6 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -93,7 +93,7 @@ gui_window *gui_create_browser_window(struct browser_window *bw)
window.title_fg = wimp_COLOUR_BLACK;
window.title_bg = wimp_COLOUR_LIGHT_GREY;
window.work_fg = wimp_COLOUR_LIGHT_GREY;
- window.work_bg = wimp_COLOUR_WHITE;
+ window.work_bg = wimp_COLOUR_TRANSPARENT;
window.scroll_outer = wimp_COLOUR_DARK_GREY;
window.scroll_inner = wimp_COLOUR_MID_LIGHT_GREY;
window.highlight_bg = wimp_COLOUR_CREAM;
@@ -264,13 +264,10 @@ void ro_gui_window_redraw(gui_window* g, wimp_draw* redraw)
* Redraw an area of a window.
*
* \param g gui_window
- * \param x0 minimum x
- * \param y0 minimum y
- * \param x1 maximum x
- * \param y1 maximum y
+ * \param data content_msg_data union with filled in redraw data
*/
-void gui_window_update_box(gui_window *g, int x0, int y0, int x1, int y1)
+void gui_window_update_box(gui_window *g, const union content_msg_data *data)
{
struct content *c = g->data.browser.bw->current_content;
osbool more;
@@ -278,10 +275,10 @@ void gui_window_update_box(gui_window *g, int x0, int y0, int x1, int y1)
wimp_draw update;
update.w = g->window;
- update.box.x0 = x0 * 2;
- update.box.y0 = -y1 * 2;
- update.box.x1 = x1 * 2;
- update.box.y1 = -y0 * 2;
+ update.box.x0 = data->redraw.x * 2;
+ update.box.y0 = -(data->redraw.y + data->redraw.height) * 2;
+ update.box.x1 = (data->redraw.x + data->redraw.width) * 2;
+ update.box.y1 = -data->redraw.y * 2;
error = xwimp_update_window(&update, &more);
if (error) {
LOG(("xwimp_update_window: 0x%x: %s",
@@ -290,13 +287,27 @@ void gui_window_update_box(gui_window *g, int x0, int y0, int x1, int y1)
}
while (more) {
- content_redraw(c,
- update.box.x0 - update.xscroll,
- update.box.y1 - update.yscroll,
- c->width * 2, c->height * 2,
- update.clip.x0, update.clip.y0,
- update.clip.x1 - 1, update.clip.y1 - 1,
- g->scale);
+ if (data->redraw.full_redraw) {
+ content_redraw(c,
+ update.box.x0 - update.xscroll,
+ update.box.y1 - update.yscroll,
+ c->width * 2, c->height * 2,
+ update.clip.x0, update.clip.y0,
+ update.clip.x1 - 1, update.clip.y1 - 1,
+ g->scale);
+ } else {
+ assert(data->redraw.object);
+ content_redraw(data->redraw.object,
+ update.box.x0 - update.xscroll +
+ data->redraw.object_x * 2,
+ update.box.y1 - update.yscroll -
+ data->redraw.object_y * 2,
+ data->redraw.object->width * 2,
+ data->redraw.object->height * 2,
+ update.clip.x0, update.clip.y0,
+ update.clip.x1 - 1, update.clip.y1 - 1,
+ g->scale);
+ }
error = xwimp_get_rectangle(&update, &more);
if (error) {