[project @ 2003-09-10 17:10:25 by bursa]
Set graphics window when rendering objects. svn path=/import/netsurf/; revision=279
This commit is contained in:
parent
f185bb4d0d
commit
9c2e649290
|
@ -57,7 +57,8 @@ struct handler_entry {
|
||||||
void (*reformat)(struct content *c, unsigned int width, unsigned int height);
|
void (*reformat)(struct content *c, unsigned int width, unsigned int height);
|
||||||
void (*destroy)(struct content *c);
|
void (*destroy)(struct content *c);
|
||||||
void (*redraw)(struct content *c, long x, long y,
|
void (*redraw)(struct content *c, long x, long y,
|
||||||
unsigned long width, unsigned long height);
|
unsigned long width, unsigned long height,
|
||||||
|
long clip_x0, long clip_y0, long clip_x1, long clip_y1);
|
||||||
void (*add_instance)(struct content *c, struct browser_window *bw,
|
void (*add_instance)(struct content *c, struct browser_window *bw,
|
||||||
struct content *page, struct box *box,
|
struct content *page, struct box *box,
|
||||||
struct object_params *params, void **state);
|
struct object_params *params, void **state);
|
||||||
|
@ -288,11 +289,13 @@ void content_destroy(struct content *c)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void content_redraw(struct content *c, long x, long y,
|
void content_redraw(struct content *c, long x, long y,
|
||||||
unsigned long width, unsigned long height)
|
unsigned long width, unsigned long height,
|
||||||
|
long clip_x0, long clip_y0, long clip_x1, long clip_y1)
|
||||||
{
|
{
|
||||||
assert(c != 0);
|
assert(c != 0);
|
||||||
if (handler_map[c->type].redraw != 0)
|
if (handler_map[c->type].redraw != 0)
|
||||||
handler_map[c->type].redraw(c, x, y, width, height);
|
handler_map[c->type].redraw(c, x, y, width, height,
|
||||||
|
clip_x0, clip_y0, clip_x1, clip_y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,8 @@ void content_revive(struct content *c, unsigned long width, unsigned long height
|
||||||
void content_reformat(struct content *c, unsigned long width, unsigned long height);
|
void content_reformat(struct content *c, unsigned long width, unsigned long height);
|
||||||
void content_destroy(struct content *c);
|
void content_destroy(struct content *c);
|
||||||
void content_redraw(struct content *c, long x, long y,
|
void content_redraw(struct content *c, long x, long y,
|
||||||
unsigned long width, unsigned long height);
|
unsigned long width, unsigned long height,
|
||||||
|
long clip_x0, long clip_y0, long clip_x1, long clip_y1);
|
||||||
void content_add_user(struct content *c,
|
void content_add_user(struct content *c,
|
||||||
void (*callback)(content_msg msg, struct content *c, void *p1,
|
void (*callback)(content_msg msg, struct content *c, void *p1,
|
||||||
void *p2, const char *error),
|
void *p2, const char *error),
|
||||||
|
|
|
@ -81,6 +81,7 @@ void plugin_decode(void *a, void *b, void *c, void *d)
|
||||||
}
|
}
|
||||||
|
|
||||||
void html_redraw(struct content *c, long x, long y,
|
void html_redraw(struct content *c, long x, long y,
|
||||||
unsigned long width, unsigned long height)
|
unsigned long width, unsigned long height,
|
||||||
|
long x0, long y0, long x1, long y1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@ void html_remove_instance(struct content *c, struct browser_window *bw,
|
||||||
struct content *page, struct box *box,
|
struct content *page, struct box *box,
|
||||||
struct object_params *params, void **state);
|
struct object_params *params, void **state);
|
||||||
void html_redraw(struct content *c, long x, long y,
|
void html_redraw(struct content *c, long x, long y,
|
||||||
unsigned long width, unsigned long height);
|
unsigned long width, unsigned long height,
|
||||||
|
long clip_x0, long clip_y0, long clip_x1, long clip_y1);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -119,7 +119,8 @@ void nsgif_reformat(struct content *c, unsigned int width, unsigned int height)
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsgif_redraw(struct content *c, long x, long y,
|
void nsgif_redraw(struct content *c, long x, long y,
|
||||||
unsigned long width, unsigned long height)
|
unsigned long width, unsigned long height,
|
||||||
|
long clip_x0, long clip_y0, long clip_x1, long clip_y1)
|
||||||
{
|
{
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
osspriteop_trans_tab *table;
|
osspriteop_trans_tab *table;
|
||||||
|
|
|
@ -28,5 +28,6 @@ void nsgif_revive(struct content *c, unsigned int width, unsigned int height);
|
||||||
void nsgif_reformat(struct content *c, unsigned int width, unsigned int height);
|
void nsgif_reformat(struct content *c, unsigned int width, unsigned int height);
|
||||||
void nsgif_destroy(struct content *c);
|
void nsgif_destroy(struct content *c);
|
||||||
void nsgif_redraw(struct content *c, long x, long y,
|
void nsgif_redraw(struct content *c, long x, long y,
|
||||||
unsigned long width, unsigned long height);
|
unsigned long width, unsigned long height,
|
||||||
|
long clip_x0, long clip_y0, long clip_x1, long clip_y1);
|
||||||
#endif
|
#endif
|
||||||
|
|
11
riscos/gui.c
11
riscos/gui.c
|
@ -39,7 +39,6 @@ static char password_v[] = "D*";
|
||||||
|
|
||||||
char *NETSURF_DIR;
|
char *NETSURF_DIR;
|
||||||
gui_window *window_list = 0;
|
gui_window *window_list = 0;
|
||||||
os_box *clip;
|
|
||||||
|
|
||||||
int gadget_subtract_x;
|
int gadget_subtract_x;
|
||||||
int gadget_subtract_y;
|
int gadget_subtract_y;
|
||||||
|
@ -71,11 +70,6 @@ void gui_remove_gadget(struct gui_gadget* g);
|
||||||
|
|
||||||
static int window_x_units(int scr_units, wimp_window_state* win);
|
static int window_x_units(int scr_units, wimp_window_state* win);
|
||||||
static int window_y_units(int scr_units, wimp_window_state* win);
|
static int window_y_units(int scr_units, wimp_window_state* win);
|
||||||
static void ro_gui_window_redraw_box(struct content *content, struct box * box,
|
|
||||||
signed long x, signed long y, os_box* clip,
|
|
||||||
unsigned long current_background_color,
|
|
||||||
signed long gadget_subtract_x, signed long gadget_subtract_y,
|
|
||||||
bool *select_on);
|
|
||||||
static void ro_gui_toolbar_redraw(gui_window* g, wimp_draw* redraw);
|
static void ro_gui_toolbar_redraw(gui_window* g, wimp_draw* redraw);
|
||||||
static void gui_disable_icon(wimp_w w, wimp_i i);
|
static void gui_disable_icon(wimp_w w, wimp_i i);
|
||||||
static void gui_enable_icon(wimp_w w, wimp_i i);
|
static void gui_enable_icon(wimp_w w, wimp_i i);
|
||||||
|
@ -357,11 +351,12 @@ void ro_gui_window_redraw(gui_window* g, wimp_draw* redraw)
|
||||||
|
|
||||||
while (more)
|
while (more)
|
||||||
{
|
{
|
||||||
clip = &redraw->clip;
|
|
||||||
content_redraw(c,
|
content_redraw(c,
|
||||||
(int) redraw->box.x0 - (int) redraw->xscroll,
|
(int) redraw->box.x0 - (int) redraw->xscroll,
|
||||||
(int) redraw->box.y1 - (int) redraw->yscroll,
|
(int) redraw->box.y1 - (int) redraw->yscroll,
|
||||||
c->width * 2, c->height * 2);
|
c->width * 2, c->height * 2,
|
||||||
|
redraw->clip.x0, redraw->clip.y0,
|
||||||
|
redraw->clip.x1 - 1, redraw->clip.y1 - 1);
|
||||||
more = wimp_get_rectangle(redraw);
|
more = wimp_get_rectangle(redraw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#ifndef _NETSURF_RISCOS_GUI_H_
|
#ifndef _NETSURF_RISCOS_GUI_H_
|
||||||
#define _NETSURF_RISCOS_GUI_H_
|
#define _NETSURF_RISCOS_GUI_H_
|
||||||
|
|
||||||
#include "oslib/os.h"
|
|
||||||
#include "oslib/wimp.h"
|
#include "oslib/wimp.h"
|
||||||
#include "netsurf/desktop/browser.h"
|
#include "netsurf/desktop/browser.h"
|
||||||
#include "netsurf/desktop/netsurf.h"
|
#include "netsurf/desktop/netsurf.h"
|
||||||
|
@ -25,7 +24,6 @@ extern int current_menu_x, current_menu_y, iconbar_menu_height;
|
||||||
extern struct gui_gadget *current_gadget;
|
extern struct gui_gadget *current_gadget;
|
||||||
extern const char *HOME_URL;
|
extern const char *HOME_URL;
|
||||||
extern gui_window *window_list;
|
extern gui_window *window_list;
|
||||||
extern os_box *clip;
|
|
||||||
|
|
||||||
|
|
||||||
struct gui_window
|
struct gui_window
|
||||||
|
|
|
@ -17,13 +17,15 @@
|
||||||
#include "netsurf/utils/log.h"
|
#include "netsurf/utils/log.h"
|
||||||
|
|
||||||
static void html_redraw_box(struct content *content, struct box * box,
|
static void html_redraw_box(struct content *content, struct box * box,
|
||||||
signed long x, signed long y, os_box* clip,
|
signed long x, signed long y,
|
||||||
unsigned long current_background_color,
|
unsigned long current_background_color,
|
||||||
signed long gadget_subtract_x, signed long gadget_subtract_y,
|
signed long gadget_subtract_x, signed long gadget_subtract_y,
|
||||||
bool *select_on);
|
bool *select_on,
|
||||||
|
long clip_x0, long clip_y0, long clip_x1, long clip_y1);
|
||||||
|
|
||||||
void html_redraw(struct content *c, long x, long y,
|
void html_redraw(struct content *c, long x, long y,
|
||||||
unsigned long width, unsigned long height)
|
unsigned long width, unsigned long height,
|
||||||
|
long clip_x0, long clip_y0, long clip_x1, long clip_y1)
|
||||||
{
|
{
|
||||||
bool select_on = false;
|
bool select_on = false;
|
||||||
unsigned long background_colour = 0xffffff;
|
unsigned long background_colour = 0xffffff;
|
||||||
|
@ -42,8 +44,8 @@ void html_redraw(struct content *c, long x, long y,
|
||||||
background_colour = c->data.html.background_colour;
|
background_colour = c->data.html.background_colour;
|
||||||
}
|
}
|
||||||
|
|
||||||
html_redraw_box(c, box, x, y, clip, background_colour, x, y,
|
html_redraw_box(c, box, x, y, background_colour, x, y,
|
||||||
&select_on);
|
&select_on, clip_x0, clip_y0, clip_x1, clip_y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,19 +67,20 @@ static char select_text_none[] = "<None>";
|
||||||
static char empty_text[] = "";
|
static char empty_text[] = "";
|
||||||
|
|
||||||
void html_redraw_box(struct content *content, struct box * box,
|
void html_redraw_box(struct content *content, struct box * box,
|
||||||
signed long x, signed long y, os_box* clip,
|
signed long x, signed long y,
|
||||||
unsigned long current_background_color,
|
unsigned long current_background_color,
|
||||||
signed long gadget_subtract_x, signed long gadget_subtract_y,
|
signed long gadget_subtract_x, signed long gadget_subtract_y,
|
||||||
bool *select_on)
|
bool *select_on,
|
||||||
|
long clip_x0, long clip_y0, long clip_x1, long clip_y1)
|
||||||
{
|
{
|
||||||
struct box *c;
|
struct box *c;
|
||||||
char *select_text;
|
char *select_text;
|
||||||
struct formoption *opt;
|
struct formoption *opt;
|
||||||
|
|
||||||
if (x + (signed long) (box->x * 2 + box->width * 2) /* right edge */ < clip->x0 ||
|
if (x + (signed long) (box->x * 2 + box->width * 2) /* right edge */ < clip_x0 ||
|
||||||
x + (signed long) (box->x * 2) /* left edge */ > clip->x1 ||
|
x + (signed long) (box->x * 2) /* left edge */ > clip_x1 ||
|
||||||
y - (signed long) (box->y * 2 + box->height * 2 + 8) /* bottom edge */ > clip->y1 ||
|
y - (signed long) (box->y * 2 + box->height * 2 + 8) /* bottom edge */ > clip_y1 ||
|
||||||
y - (signed long) (box->y * 2) /* top edge */ < clip->y0)
|
y - (signed long) (box->y * 2) /* top edge */ < clip_y0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (box->style != 0 && box->style->background_color != TRANSPARENT) {
|
if (box->style != 0 && box->style->background_color != TRANSPARENT) {
|
||||||
|
@ -88,10 +91,35 @@ void html_redraw_box(struct content *content, struct box * box,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (box->object) {
|
if (box->object) {
|
||||||
|
long x0 = x + box->x * 2;
|
||||||
|
long y1 = y - box->y * 2 - 1;
|
||||||
|
long x1 = x0 + box->width * 2 - 1;
|
||||||
|
long y0 = y1 - box->height * 2 + 1;
|
||||||
|
|
||||||
|
LOG(("%s %li %li %li %li", box->object->url, x0, y0, x1, y1));
|
||||||
|
|
||||||
|
if (x0 < clip_x0) x0 = clip_x0;
|
||||||
|
if (y0 < clip_y0) y0 = clip_y0;
|
||||||
|
if (clip_x1 < x1) x1 = clip_x1;
|
||||||
|
if (clip_y1 < y1) y1 = clip_y1;
|
||||||
|
|
||||||
|
os_set_graphics_window();
|
||||||
|
os_writec((char) (x0 & 0xff)); os_writec((char) (x0 >> 8));
|
||||||
|
os_writec((char) (y0 & 0xff)); os_writec((char) (y0 >> 8));
|
||||||
|
os_writec((char) (x1 & 0xff)); os_writec((char) (x1 >> 8));
|
||||||
|
os_writec((char) (y1 & 0xff)); os_writec((char) (y1 >> 8));
|
||||||
|
|
||||||
content_redraw(box->object,
|
content_redraw(box->object,
|
||||||
(int) x + (int) box->x * 2,
|
(int) x + (int) box->x * 2,
|
||||||
(int) y - (int) box->y * 2,
|
(int) y - (int) box->y * 2,
|
||||||
box->width * 2, box->height * 2);
|
box->width * 2, box->height * 2,
|
||||||
|
x0, y0, x1, y1);
|
||||||
|
|
||||||
|
os_set_graphics_window();
|
||||||
|
os_writec((char) (clip_x0 & 0xff)); os_writec((char) (clip_x0 >> 8));
|
||||||
|
os_writec((char) (clip_y0 & 0xff)); os_writec((char) (clip_y0 >> 8));
|
||||||
|
os_writec((char) (clip_x1 & 0xff)); os_writec((char) (clip_x1 >> 8));
|
||||||
|
os_writec((char) (clip_y1 & 0xff)); os_writec((char) (clip_y1 >> 8));
|
||||||
|
|
||||||
} else if (box->gadget) {
|
} else if (box->gadget) {
|
||||||
wimp_icon icon;
|
wimp_icon icon;
|
||||||
|
@ -312,13 +340,15 @@ void html_redraw_box(struct content *content, struct box * box,
|
||||||
for (c = box->children; c != 0; c = c->next)
|
for (c = box->children; c != 0; c = c->next)
|
||||||
if (c->type != BOX_FLOAT_LEFT && c->type != BOX_FLOAT_RIGHT)
|
if (c->type != BOX_FLOAT_LEFT && c->type != BOX_FLOAT_RIGHT)
|
||||||
html_redraw_box(content, c, (int) x + (int) box->x * 2,
|
html_redraw_box(content, c, (int) x + (int) box->x * 2,
|
||||||
(int) y - (int) box->y * 2, clip, current_background_color,
|
(int) y - (int) box->y * 2, current_background_color,
|
||||||
gadget_subtract_x, gadget_subtract_y, select_on);
|
gadget_subtract_x, gadget_subtract_y, select_on,
|
||||||
|
clip_x0, clip_y0, clip_x1, clip_y1);
|
||||||
|
|
||||||
for (c = box->float_children; c != 0; c = c->next_float)
|
for (c = box->float_children; c != 0; c = c->next_float)
|
||||||
html_redraw_box(content, c, (int) x + (int) box->x * 2,
|
html_redraw_box(content, c, (int) x + (int) box->x * 2,
|
||||||
(int) y - (int) box->y * 2, clip, current_background_color,
|
(int) y - (int) box->y * 2, current_background_color,
|
||||||
gadget_subtract_x, gadget_subtract_y, select_on);
|
gadget_subtract_x, gadget_subtract_y, select_on,
|
||||||
|
clip_x0, clip_y0, clip_x1, clip_y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* } else {
|
/* } else {
|
||||||
|
|
|
@ -70,7 +70,8 @@ void jpeg_destroy(struct content *c)
|
||||||
|
|
||||||
|
|
||||||
void jpeg_redraw(struct content *c, long x, long y,
|
void jpeg_redraw(struct content *c, long x, long y,
|
||||||
unsigned long width, unsigned long height)
|
unsigned long width, unsigned long height,
|
||||||
|
long clip_x0, long clip_y0, long clip_x1, long clip_y1)
|
||||||
{
|
{
|
||||||
os_factors factors;
|
os_factors factors;
|
||||||
factors.xmul = width;
|
factors.xmul = width;
|
||||||
|
|
|
@ -22,6 +22,7 @@ void jpeg_revive(struct content *c, unsigned int width, unsigned int height);
|
||||||
void jpeg_reformat(struct content *c, unsigned int width, unsigned int height);
|
void jpeg_reformat(struct content *c, unsigned int width, unsigned int height);
|
||||||
void jpeg_destroy(struct content *c);
|
void jpeg_destroy(struct content *c);
|
||||||
void jpeg_redraw(struct content *c, long x, long y,
|
void jpeg_redraw(struct content *c, long x, long y,
|
||||||
unsigned long width, unsigned long height);
|
unsigned long width, unsigned long height,
|
||||||
|
long clip_x0, long clip_y0, long clip_x1, long clip_y1);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -301,7 +301,8 @@ void nspng_destroy(struct content *c)
|
||||||
|
|
||||||
|
|
||||||
void nspng_redraw(struct content *c, long x, long y,
|
void nspng_redraw(struct content *c, long x, long y,
|
||||||
unsigned long width, unsigned long height)
|
unsigned long width, unsigned long height,
|
||||||
|
long clip_x0, long clip_y0, long clip_x1, long clip_y1)
|
||||||
{
|
{
|
||||||
int size;
|
int size;
|
||||||
osspriteop_trans_tab *table;
|
osspriteop_trans_tab *table;
|
||||||
|
|
|
@ -31,5 +31,6 @@ void nspng_revive(struct content *c, unsigned int width, unsigned int height);
|
||||||
void nspng_reformat(struct content *c, unsigned int width, unsigned int height);
|
void nspng_reformat(struct content *c, unsigned int width, unsigned int height);
|
||||||
void nspng_destroy(struct content *c);
|
void nspng_destroy(struct content *c);
|
||||||
void nspng_redraw(struct content *c, long x, long y,
|
void nspng_redraw(struct content *c, long x, long y,
|
||||||
unsigned long width, unsigned long height);
|
unsigned long width, unsigned long height,
|
||||||
|
long clip_x0, long clip_y0, long clip_x1, long clip_y1);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue