summaryrefslogtreecommitdiff
path: root/riscos/content-handlers
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/content-handlers
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/content-handlers')
-rw-r--r--riscos/content-handlers/artworks.c37
-rw-r--r--riscos/content-handlers/draw.c31
-rw-r--r--riscos/content-handlers/sprite.c20
3 files changed, 40 insertions, 48 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);
}