mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-11 13:29:21 +03:00
[project @ 2005-03-14 13:58:43 by rjw]
Minimise flicker when viewing non-HTML files. svn path=/import/netsurf/; revision=1535
This commit is contained in:
parent
950d8e27a0
commit
501da1c487
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
114
riscos/window.c
114
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user