summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2005-03-14 13:58:43 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2005-03-14 13:58:43 +0000
commit501da1c487f04fbbe04c3cc2a130a4583621681c (patch)
tree0246ee27f677f9dfd494018f070926159b674b39 /riscos
parent950d8e27a041119009bede022cb5a2502131a94b (diff)
downloadnetsurf-501da1c487f04fbbe04c3cc2a130a4583621681c.tar.gz
netsurf-501da1c487f04fbbe04c3cc2a130a4583621681c.tar.bz2
[project @ 2005-03-14 13:58:43 by rjw]
Minimise flicker when viewing non-HTML files. svn path=/import/netsurf/; revision=1535
Diffstat (limited to 'riscos')
-rw-r--r--riscos/dialog.c23
-rw-r--r--riscos/wimp.c43
-rw-r--r--riscos/wimp.h2
-rw-r--r--riscos/window.c114
4 files changed, 128 insertions, 54 deletions
diff --git a/riscos/dialog.c b/riscos/dialog.c
index 26f689d12..1ffae34cc 100644
--- a/riscos/dialog.c
+++ b/riscos/dialog.c
@@ -469,35 +469,16 @@ void ro_gui_dialog_click(wimp_pointer *pointer)
void ro_gui_dialog_redraw(wimp_draw *redraw)
{
- os_error *error;
- osbool more;
struct toolbar_display *display;
- for (display = toolbars; display; display = display->next) {
+ for (display = toolbars; display; display = display->next)
if ((display->toolbar) && (display->toolbar->toolbar_handle ==
redraw->w)) {
ro_gui_theme_redraw(display->toolbar, redraw);
return;
}
- }
-
- error = xwimp_redraw_window(redraw, &more);
- if (error) {
- LOG(("xwimp_redraw_window: 0x%x: %s",
- error->errnum, error->errmess));
- warn_user("WimpError", error->errmess);
- return;
- }
- while (more) {
- error = xwimp_get_rectangle(redraw, &more);
- if (error) {
- LOG(("xwimp_get_rectangle: 0x%x: %s",
- error->errnum, error->errmess));
- warn_user("WimpError", error->errmess);
- return;
- }
- }
+ ro_gui_user_redraw(redraw, false, (os_gcol)0);
}
diff --git a/riscos/wimp.c b/riscos/wimp.c
index a9e2a29d4..54a3cf815 100644
--- a/riscos/wimp.c
+++ b/riscos/wimp.c
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include "oslib/colourtrans.h"
#include "oslib/os.h"
#include "oslib/osfile.h"
#include "oslib/wimp.h"
@@ -626,3 +627,45 @@ void ro_gui_open_pane(wimp_w parent, wimp_w pane, int offset)
return;
}
}
+
+
+/**
+ * Performs simple user redraw for a window.
+ *
+ * \param user_fill whether to fill the redraw area
+ * \param user_colour the colour to use when filling
+ */
+
+void ro_gui_user_redraw(wimp_draw *redraw, bool user_fill, os_colour user_colour)
+{
+ os_error *error;
+ osbool more;
+
+ error = xwimp_redraw_window(redraw, &more);
+ if (error) {
+ LOG(("xwimp_redraw_window: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ return;
+ }
+ while (more) {
+ if (user_fill) {
+ error = xcolourtrans_set_gcol(user_colour,
+ colourtrans_SET_BG,
+ os_ACTION_OVERWRITE, 0, 0);
+ if (error) {
+ LOG(("xcolourtrans_set_gcol: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("MiscError", error->errmess);
+ }
+ os_clg();
+ }
+ error = xwimp_get_rectangle(redraw, &more);
+ if (error) {
+ LOG(("xwimp_get_rectangle: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ return;
+ }
+ }
+}
diff --git a/riscos/wimp.h b/riscos/wimp.h
index b0ab4c7df..aaf048a0f 100644
--- a/riscos/wimp.h
+++ b/riscos/wimp.h
@@ -55,5 +55,5 @@ void ro_gui_open_pane(wimp_w parent, wimp_w pane, int offset);
wimp_w ro_gui_set_window_background_colour(wimp_w window, wimp_colour background);
void ro_gui_set_icon_colours(wimp_w window, wimp_i icon,
wimp_colour foreground, wimp_colour background);
-
+void ro_gui_user_redraw(wimp_draw *redraw, bool user_fill, os_colour user_colour);
#endif
diff --git a/riscos/window.c b/riscos/window.c
index 82a041d95..90ef2df42 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -438,31 +438,62 @@ void ro_gui_window_redraw(struct gui_window *g, wimp_draw *redraw)
{
osbool more;
bool clear_background = false;
+ bool clear_partial = false;
float scale = 1;
struct content *c = g->bw->current_content;
int clip_x0, clip_y0, clip_x1, clip_y1;
+ int content_y1, content_x1;
os_error *error;
+ osspriteop_area *area;
+ osspriteop_header *header;
+
+ /* Handle no content quickly
+ */
+ if (!c) {
+ ro_gui_user_redraw(redraw, true, os_COLOUR_WHITE);
+ return;
+ }
plot = ro_plotters;
ro_plot_set_scale(g->option.scale);
-
- /* Set the current redraw gui_window to get options from
- */
ro_gui_current_redraw_gui = g;
/* We should clear the background, except for HTML.
*/
- if (!c) {
- clear_background = true;
- } else {
- switch (c->type) {
- case CONTENT_HTML:
- break;
- default:
- clear_background = true;
- scale = g->option.scale;
- break;
- }
+ switch (c->type) {
+ case CONTENT_HTML:
+ break;
+ case CONTENT_CSS:
+ case CONTENT_TEXTPLAIN:
+#ifdef WITH_JPEG
+ case CONTENT_JPEG:
+#endif
+ clear_partial = true;
+ clear_background = true;
+ scale = g->option.scale;
+ break;
+
+
+#ifdef WITH_SPRITE
+ case CONTENT_SPRITE:
+ area = (osspriteop_area *)c->data.sprite.data;
+ header = (osspriteop_header *)((char*)area + area->first);
+ clear_partial = (header->image) == (header->mask);
+#endif
+#ifdef WITH_GIF
+ case CONTENT_GIF:
+#endif
+#ifdef WITH_MNG
+ case CONTENT_JNG:
+ case CONTENT_MNG:
+ case CONTENT_PNG:
+#endif
+ if (c->bitmap)
+ clear_partial = bitmap_get_opaque(c->bitmap);
+ default:
+ clear_background = true;
+ scale = g->option.scale;
+ break;
}
error = xwimp_redraw_window(redraw, &more);
@@ -473,8 +504,16 @@ void ro_gui_window_redraw(struct gui_window *g, wimp_draw *redraw)
return;
}
while (more) {
+ ro_plot_origin_x = redraw->box.x0 - redraw->xscroll;
+ ro_plot_origin_y = redraw->box.y1 - redraw->yscroll;
+ clip_x0 = (redraw->clip.x0 - ro_plot_origin_x) / 2;
+ clip_y0 = (ro_plot_origin_y - redraw->clip.y1) / 2;
+ clip_x1 = (redraw->clip.x1 - ro_plot_origin_x) / 2;
+ clip_y1 = (ro_plot_origin_y - redraw->clip.y0) / 2;
+
if (ro_gui_current_redraw_gui->option.buffer_everything)
ro_gui_buffer_open(redraw);
+
if (clear_background) {
error = xcolourtrans_set_gcol(os_COLOUR_WHITE,
colourtrans_SET_BG,
@@ -484,24 +523,39 @@ void ro_gui_window_redraw(struct gui_window *g, wimp_draw *redraw)
error->errnum, error->errmess));
warn_user("MiscError", error->errmess);
}
- os_clg();
+ if (clear_partial) {
+ content_x1 = ro_plot_origin_x + c->width * 2 * scale;
+ content_y1 = ro_plot_origin_y - c->height * 2 * scale;
+ if (content_y1 > redraw->clip.y0) {
+ xos_plot(os_MOVE_TO,
+ ro_plot_origin_x,
+ content_y1);
+ xos_plot(os_PLOT_BG_TO | os_PLOT_RECTANGLE,
+ redraw->clip.x1,
+ redraw->clip.y0);
+ }
+ if (content_x1 < redraw->clip.x1) {
+ xos_plot(os_MOVE_TO,
+ content_x1,
+ ro_plot_origin_y);
+ xos_plot(os_PLOT_BG_TO | os_PLOT_RECTANGLE,
+ redraw->clip.x1,
+ content_y1);
+ }
+ } else {
+ os_clg();
+ }
}
- if (c) {
- ro_plot_origin_x = redraw->box.x0 - redraw->xscroll;
- ro_plot_origin_y = redraw->box.y1 - redraw->yscroll;
- clip_x0 = (redraw->clip.x0 - ro_plot_origin_x) / 2;
- clip_y0 = (ro_plot_origin_y - redraw->clip.y1) / 2;
- clip_x1 = (redraw->clip.x1 - ro_plot_origin_x) / 2;
- clip_y1 = (ro_plot_origin_y - redraw->clip.y0) / 2;
- content_redraw(c, 0, 0,
- c->width * scale, c->height * scale,
- clip_x0, clip_y0, clip_x1, clip_y1,
- g->option.scale,
- 0xFFFFFF);
- }
+ content_redraw(c, 0, 0,
+ c->width * scale, c->height * scale,
+ clip_x0, clip_y0, clip_x1, clip_y1,
+ g->option.scale,
+ 0xFFFFFF);
+
if (ro_gui_current_redraw_gui->option.buffer_everything)
ro_gui_buffer_close();
+
error = xwimp_get_rectangle(redraw, &more);
/* RISC OS 3.7 returns an error here if enough buffer was
claimed to cause a new dynamic area to be created. It
@@ -518,10 +572,6 @@ void ro_gui_window_redraw(struct gui_window *g, wimp_draw *redraw)
return;
}
}
-
- /* Reset the current redraw gui_window to prevent thumbnails from
- retaining options
- */
ro_gui_current_redraw_gui = NULL;
}