summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2011-06-28 20:17:39 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2011-06-28 20:17:39 +0000
commit3128ecf2a5c94102e0e1659f947a345d36750afe (patch)
treea744c73c5464360bbddd1de5a4c83907abbc0048 /riscos
parent4d19457c59fa911743137277d312ac2935293f8b (diff)
downloadnetsurf-3128ecf2a5c94102e0e1659f947a345d36750afe.tar.gz
netsurf-3128ecf2a5c94102e0e1659f947a345d36750afe.tar.bz2
Unify content_redraw params in content_redraw_data struct. Core and RISC OS content handlers updated.
svn path=/trunk/netsurf/; revision=12529
Diffstat (limited to 'riscos')
-rw-r--r--riscos/content-handlers/artworks.c37
-rw-r--r--riscos/content-handlers/draw.c31
-rw-r--r--riscos/content-handlers/sprite.c20
-rw-r--r--riscos/gui/url_bar.c21
-rw-r--r--riscos/print.c33
-rw-r--r--riscos/save_draw.c15
6 files changed, 89 insertions, 68 deletions
diff --git a/riscos/content-handlers/artworks.c b/riscos/content-handlers/artworks.c
index be1ba7dd2..1794f9164 100644
--- a/riscos/content-handlers/artworks.c
+++ b/riscos/content-handlers/artworks.c
@@ -110,10 +110,8 @@ static nserror artworks_create(const content_handler *handler,
bool quirks, struct content **c);
static bool artworks_convert(struct content *c);
static void artworks_destroy(struct content *c);
-static bool artworks_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y);
+static bool artworks_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip);
static nserror artworks_clone(const struct content *old, struct content **newc);
static content_type artworks_content_type(lwc_string *mime_type);
@@ -331,10 +329,8 @@ void artworks_destroy(struct content *c)
* Redraw a CONTENT_ARTWORKS.
*/
-bool artworks_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+bool artworks_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
{
static const ns_os_vdu_var_list vars = {
os_MODEVAR_XEIG_FACTOR,
@@ -367,15 +363,16 @@ bool artworks_redraw(struct content *c, int x, int y,
&aw->render_workspace);
/* Scaled image. Transform units (65536*OS units) */
- matrix.entries[0][0] = width * 65536 / c->width;
+ matrix.entries[0][0] = data->width * 65536 / c->width;
matrix.entries[0][1] = 0;
matrix.entries[1][0] = 0;
- matrix.entries[1][1] = height * 65536 / c->height;
+ matrix.entries[1][1] = data->height * 65536 / c->height;
/* Draw units. (x,y) = bottom left */
- matrix.entries[2][0] = ro_plot_origin_x * 256 + x * 512 -
- aw->x0 * width / c->width;
- matrix.entries[2][1] = ro_plot_origin_y * 256 - (y + height) * 512 -
- aw->y0 * height / c->height;
+ matrix.entries[2][0] = ro_plot_origin_x * 256 + data->x * 512 -
+ aw->x0 * data->width / c->width;
+ matrix.entries[2][1] = ro_plot_origin_y * 256 -
+ (data->y + data->height) * 512 -
+ aw->y0 * data->height / c->height;
info.ditherx = ro_plot_origin_x;
info.dithery = ro_plot_origin_y;
@@ -392,16 +389,18 @@ bool artworks_redraw(struct content *c, int x, int y,
info.clip_y1 = ((c->height - clip_y0) * 512) + aw->y0 + 511;
}
else {
- info.clip_x0 = (clip_x0 * 512 / scale) + aw->x0 - 511;
- info.clip_y0 = ((c->height - (clip_y1 / scale)) * 512) + aw->y0 - 511;
- info.clip_x1 = (clip_x1 * 512 / scale) + aw->x0 + 511;
- info.clip_y1 = ((c->height - (clip_y0 / scale)) * 512) + aw->y0 + 511;
+ info.clip_x0 = (clip_x0 * 512 / data->scale) + aw->x0 - 511;
+ info.clip_y0 = ((c->height - (clip_y1 / data->scale)) * 512) +
+ aw->y0 - 511;
+ info.clip_x1 = (clip_x1 * 512 / data->scale) + aw->x0 + 511;
+ info.clip_y1 = ((c->height - (clip_y0 / data->scale)) * 512) +
+ aw->y0 + 511;
}
info.print_lowx = 0;
info.print_lowy = 0;
info.print_handle = 0;
- info.bgcolour = 0x20000000 | background_colour;
+ info.bgcolour = 0x20000000 | data->background_colour;
error = xos_read_vdu_variables(PTR_OS_VDU_VAR_LIST(&vars), vals);
if (error) {
diff --git a/riscos/content-handlers/draw.c b/riscos/content-handlers/draw.c
index 97346580e..e8a9d654a 100644
--- a/riscos/content-handlers/draw.c
+++ b/riscos/content-handlers/draw.c
@@ -50,10 +50,8 @@ static nserror draw_create(const content_handler *handler,
bool quirks, struct content **c);
static bool draw_convert(struct content *c);
static void draw_destroy(struct content *c);
-static bool draw_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y);
+static bool draw_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip);
static nserror draw_clone(const struct content *old, struct content **newc);
static content_type draw_content_type(lwc_string *mime_type);
@@ -208,16 +206,14 @@ void draw_destroy(struct content *c)
* Redraw a CONTENT_DRAW.
*/
-bool draw_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+bool draw_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
{
draw_content *draw = (draw_content *) c;
os_trfm matrix;
const char *source_data;
unsigned long source_size;
- const void *data;
+ const void *src_data;
os_error *error;
if (plot.flush && !plot.flush())
@@ -227,20 +223,21 @@ bool draw_redraw(struct content *c, int x, int y,
return false;
source_data = content__get_source_data(c, &source_size);
- data = source_data;
+ src_data = source_data;
/* Scaled image. Transform units (65536*OS units) */
- matrix.entries[0][0] = width * 65536 / c->width;
+ matrix.entries[0][0] = data->width * 65536 / c->width;
matrix.entries[0][1] = 0;
matrix.entries[1][0] = 0;
- matrix.entries[1][1] = height * 65536 / c->height;
+ matrix.entries[1][1] = data->height * 65536 / c->height;
/* Draw units. (x,y) = bottom left */
- matrix.entries[2][0] = ro_plot_origin_x * 256 + x * 512 -
- draw->x0 * width / c->width;
- matrix.entries[2][1] = ro_plot_origin_y * 256 - (y + height) * 512 -
- draw->y0 * height / c->height;
+ matrix.entries[2][0] = ro_plot_origin_x * 256 + data->x * 512 -
+ draw->x0 * data->width / c->width;
+ matrix.entries[2][1] = ro_plot_origin_y * 256 -
+ (data->y + data->height) * 512 -
+ draw->y0 * data->height / c->height;
- error = xdrawfile_render(0, (drawfile_diagram *) data,
+ error = xdrawfile_render(0, (drawfile_diagram *) src_data,
(int) source_size, &matrix, 0, 0);
if (error) {
LOG(("xdrawfile_render: 0x%x: %s",
diff --git a/riscos/content-handlers/sprite.c b/riscos/content-handlers/sprite.c
index b4f370e1a..f10c0166f 100644
--- a/riscos/content-handlers/sprite.c
+++ b/riscos/content-handlers/sprite.c
@@ -52,10 +52,8 @@ static nserror sprite_create(const content_handler *handler,
bool quirks, struct content **c);
static bool sprite_convert(struct content *c);
static void sprite_destroy(struct content *c);
-static bool sprite_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y);
+static bool sprite_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip);
static nserror sprite_clone(const struct content *old, struct content **newc);
static content_type sprite_content_type(lwc_string *mime_type);
@@ -208,10 +206,8 @@ void sprite_destroy(struct content *c)
* Redraw a CONTENT_SPRITE.
*/
-bool sprite_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+bool sprite_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
{
sprite_content *sprite = (sprite_content *) c;
@@ -219,12 +215,12 @@ bool sprite_redraw(struct content *c, int x, int y,
return false;
return image_redraw(sprite->data,
- ro_plot_origin_x + x * 2,
- ro_plot_origin_y - y * 2,
- width, height,
+ ro_plot_origin_x + data->x * 2,
+ ro_plot_origin_y - data->y * 2,
+ data->width, data->height,
c->width,
c->height,
- background_colour,
+ data->background_colour,
false, false, false,
IMAGE_PLOT_OS);
}
diff --git a/riscos/gui/url_bar.c b/riscos/gui/url_bar.c
index ba9ab4533..d92e8fc8d 100644
--- a/riscos/gui/url_bar.c
+++ b/riscos/gui/url_bar.c
@@ -581,6 +581,8 @@ void ro_gui_url_bar_redraw(struct url_bar *url_bar, wimp_draw *redraw)
xwimp_plot_icon(&icon);
} else {
+ struct content_redraw_data data;
+
xwimp_set_colour(wimp_COLOUR_WHITE);
xos_plot(os_MOVE_TO,
(redraw->box.x0 - redraw->xscroll) +
@@ -598,13 +600,18 @@ void ro_gui_url_bar_redraw(struct url_bar *url_bar, wimp_draw *redraw)
clip.x1 = (redraw->clip.x1 - ro_plot_origin_x) / 2;
clip.y1 = (ro_plot_origin_y - redraw->clip.y1) / 2;
- content_redraw(url_bar->favicon_content,
- (url_bar->favicon_extent.x0 +
- url_bar->favicon_offset.x) / 2,
- (url_bar->favicon_offset.y -
- url_bar->favicon_extent.y1) / 2,
- url_bar->favicon_width, url_bar->favicon_height,
- &clip, 1, 0, false, false);
+ data.x = (url_bar->favicon_extent.x0 +
+ url_bar->favicon_offset.x) / 2;
+ data.y = (url_bar->favicon_offset.y -
+ url_bar->favicon_extent.y1) / 2;
+ data.width = url_bar->favicon_width;
+ data.height = url_bar->favicon_height;
+ data.background_colour = 0xFFFFFF;
+ data.scale = 1;
+ data.repeat_x = false;
+ data.repeat_y = false;
+
+ content_redraw(url_bar->favicon_content, &data, &clip);
}
}
diff --git a/riscos/print.c b/riscos/print.c
index ef2a507af..18c6db9cd 100644
--- a/riscos/print.c
+++ b/riscos/print.c
@@ -688,18 +688,25 @@ bool print_document(struct gui_window *g, const char *filename)
}
while (more) {
+ struct content_redraw_data data;
+
LOG(("redrawing area: [(%d, %d), (%d, %d)]",
b.x0, b.y0, b.x1, b.y1));
clip.x0 = (b.x0 - ro_plot_origin_x) / 2;
clip.y0 = (ro_plot_origin_y - b.y1) / 2;
clip.x1 = (b.x1 - ro_plot_origin_x) / 2;
clip.y1 = (ro_plot_origin_y - b.y0) / 2;
- if (!content_redraw(h, 0, 0,
- content_get_width(h),
- content_get_height(h),
- &clip,
- print_scale,
- 0xFFFFFF, false, false)) {
+
+ data.x = 0;
+ data.y = 0;
+ data.width = content_get_width(h);
+ data.height = content_get_height(h);
+ data.background_colour = 0xFFFFFF;
+ data.scale = print_scale;
+ data.repeat_x = false;
+ data.repeat_y = false;
+
+ if (!content_redraw(h, &data, &clip)) {
error_message = "redraw error";
goto error;
}
@@ -795,6 +802,7 @@ const char *print_declare_fonts(hlcache_handle *h)
{
unsigned int i;
struct rect clip;
+ struct content_redraw_data data;
const char *error_message = 0;
os_error *error;
@@ -806,10 +814,17 @@ const char *print_declare_fonts(hlcache_handle *h)
clip.x0 = clip.y0 = INT_MIN;
clip.x1 = clip.y1 = INT_MAX;
+ data.x = 0;
+ data.y = 0;
+ data.width = content_get_width(h);
+ data.height = content_get_height(h);
+ data.background_colour = 0xFFFFFF;
+ data.scale = 1;
+ data.repeat_x = false;
+ data.repeat_y = false;
+
plot = print_fonts_plotters;
- if (!content_redraw(h, 0, 0, content_get_width(h),
- content_get_height(h),
- &clip, 1, 0xffffff, false, false)) {
+ if (!content_redraw(h, &data, &clip)) {
if (print_fonts_error)
return print_fonts_error;
return "Declaring fonts failed.";
diff --git a/riscos/save_draw.c b/riscos/save_draw.c
index 63730bd00..5c8f61a3d 100644
--- a/riscos/save_draw.c
+++ b/riscos/save_draw.c
@@ -90,6 +90,7 @@ bool save_as_draw(hlcache_handle *h, const char *path)
pencil_code code;
char *drawfile_buffer;
struct rect clip;
+ struct content_redraw_data data;
size_t drawfile_size;
os_error *error;
@@ -105,11 +106,17 @@ bool save_as_draw(hlcache_handle *h, const char *path)
clip.x0 = clip.y0 = INT_MIN;
clip.x1 = clip.y1 = INT_MAX;
+ data.x = 0;
+ data.y = -ro_save_draw_height;
+ data.width = ro_save_draw_width;
+ data.height = ro_save_draw_height;
+ data.background_colour = 0xFFFFFF;
+ data.scale = 1;
+ data.repeat_x = false;
+ data.repeat_y = false;
+
plot = ro_save_draw_plotters;
- if (!content_redraw(h, 0, -ro_save_draw_height,
- ro_save_draw_width, ro_save_draw_height,
- &clip, 1, 0xFFFFFF, false, false))
- {
+ if (!content_redraw(h, &data, &clip)) {
pencil_free(ro_save_draw_diagram);
return false;
}