mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 14:31:20 +03:00
Unify content_redraw params in content_redraw_data struct. Core and RISC OS content handlers updated.
svn path=/trunk/netsurf/; revision=12529
This commit is contained in:
parent
4d19457c59
commit
3128ecf2a5
@ -489,10 +489,8 @@ void content__request_redraw(struct content *c,
|
||||
* redraw function if it doesn't exist.
|
||||
*/
|
||||
|
||||
bool content_redraw(hlcache_handle *h, int x, int y,
|
||||
int width, int height, const struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y)
|
||||
bool content_redraw(hlcache_handle *h, struct content_redraw_data *data,
|
||||
const struct rect *clip)
|
||||
{
|
||||
struct content *c = hlcache_handle_get_content(h);
|
||||
|
||||
@ -508,9 +506,7 @@ bool content_redraw(hlcache_handle *h, int x, int y,
|
||||
return true;
|
||||
}
|
||||
|
||||
return c->handler->redraw(c, x, y, width, height,
|
||||
clip, scale, background_colour,
|
||||
repeat_x, repeat_y);
|
||||
return c->handler->redraw(c, data, clip);
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,6 +94,27 @@ union content_msg_data {
|
||||
struct llcache_handle *download;
|
||||
};
|
||||
|
||||
|
||||
struct content_redraw_data {
|
||||
int x; /** coordinate for top-left of redraw */
|
||||
int y; /** coordinate for top-left of redraw */
|
||||
|
||||
/** dimensions to render content at
|
||||
* (for scaling contents with intrinsic dimensions) */
|
||||
int width; /* horizontal */
|
||||
int height; /* vertical */
|
||||
|
||||
/** the background colour */
|
||||
colour background_colour;
|
||||
|
||||
/** Scale for redraw
|
||||
* (for scaling contents without intrinsic dimensions) */
|
||||
float scale; /* scale factor */
|
||||
|
||||
bool repeat_x; /* whether content is tiled in x direction */
|
||||
bool repeat_y; /* whether content is tiled in y direction */
|
||||
};
|
||||
|
||||
/* The following are for hlcache */
|
||||
void content_destroy(struct content *c);
|
||||
|
||||
@ -127,10 +148,8 @@ void content_mouse_track(struct hlcache_handle *h, struct browser_window *bw,
|
||||
browser_mouse_state mouse, int x, int y);
|
||||
void content_mouse_action(struct hlcache_handle *h, struct browser_window *bw,
|
||||
browser_mouse_state mouse, int x, int y);
|
||||
bool content_redraw(struct hlcache_handle *h, int x, int y,
|
||||
int width, int height, const struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y);
|
||||
bool content_redraw(struct hlcache_handle *h, struct content_redraw_data *data,
|
||||
const struct rect *clip);
|
||||
void content_open(struct hlcache_handle *h, struct browser_window *bw,
|
||||
struct content *page, struct box *box,
|
||||
struct object_params *params);
|
||||
|
@ -54,10 +54,8 @@ struct content_handler {
|
||||
browser_mouse_state mouse, int x, int y);
|
||||
void (*mouse_action)(struct content *c, struct browser_window *bw,
|
||||
browser_mouse_state mouse, int x, int y);
|
||||
bool (*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 (*redraw)(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip);
|
||||
void (*open)(struct content *c, struct browser_window *bw,
|
||||
struct content *page,
|
||||
struct box *box,
|
||||
|
@ -100,6 +100,7 @@ bool browser_window_redraw(struct browser_window *bw, int x, int y,
|
||||
int height = 0;
|
||||
bool plot_ok = true;
|
||||
content_type content_type;
|
||||
struct content_redraw_data data;
|
||||
|
||||
if (bw == NULL) {
|
||||
LOG(("NULL browser window"));
|
||||
@ -131,10 +132,20 @@ bool browser_window_redraw(struct browser_window *bw, int x, int y,
|
||||
plot_ok &= plot.rectangle(clip->x0, clip->y0,
|
||||
clip->x1, clip->y1, plot_style_fill_white);
|
||||
}
|
||||
|
||||
/* Set up content redraw data */
|
||||
data.x = x;
|
||||
data.y = y;
|
||||
data.width = width;
|
||||
data.height = height;
|
||||
|
||||
data.background_colour = 0xFFFFFF;
|
||||
data.scale = bw->scale;
|
||||
data.repeat_x = false;
|
||||
data.repeat_y = false;
|
||||
|
||||
/* Render the content */
|
||||
plot_ok &= content_redraw(bw->current_content, x, y, width, height,
|
||||
clip, bw->scale, 0xFFFFFF, false, false);
|
||||
plot_ok &= content_redraw(bw->current_content, &data, clip);
|
||||
|
||||
if (bw->browser_window_type != BROWSER_WINDOW_IFRAME &&
|
||||
plot.option_knockout)
|
||||
|
@ -122,6 +122,7 @@ bool print_draw_next_page(const struct printer *printer,
|
||||
struct print_settings *settings)
|
||||
{
|
||||
struct rect clip;
|
||||
struct content_redraw_data data;
|
||||
|
||||
plot = *(printer->plotter);
|
||||
html_redraw_printing_top_cropped = INT_MAX;
|
||||
@ -130,14 +131,21 @@ bool print_draw_next_page(const struct printer *printer,
|
||||
clip.y0 = 0;
|
||||
clip.x1 = page_content_width * settings->scale;
|
||||
clip.y1 = page_content_height * settings->scale;
|
||||
|
||||
|
||||
data.x = 0;
|
||||
data.y = -done_height;
|
||||
data.width = 0;
|
||||
data.height = 0;
|
||||
data.background_colour = 0xFFFFFF;
|
||||
data.scale = settings->scale;
|
||||
data.repeat_x = false;
|
||||
data.repeat_y = false;
|
||||
|
||||
html_redraw_printing = true;
|
||||
html_redraw_printing_border = clip.y1;
|
||||
|
||||
|
||||
printer->print_next_page();
|
||||
if (!content_redraw(printed_content, 0, -done_height,
|
||||
0, 0,
|
||||
&clip, settings->scale, 0xffffff, false, false))
|
||||
if (!content_redraw(printed_content, &data, &clip))
|
||||
return false;
|
||||
|
||||
done_height += page_content_height -
|
||||
|
@ -60,6 +60,7 @@ bool thumbnail_redraw(struct hlcache_handle *content,
|
||||
int width, int height)
|
||||
{
|
||||
struct rect clip;
|
||||
struct content_redraw_data data;
|
||||
float scale;
|
||||
bool plot_ok = true;
|
||||
|
||||
@ -86,9 +87,19 @@ bool thumbnail_redraw(struct hlcache_handle *content,
|
||||
/* Find the scale we're using */
|
||||
scale = thumbnail_get_redraw_scale(content, width);
|
||||
|
||||
/* Set up content redraw data */
|
||||
data.x = 0;
|
||||
data.y = 0;
|
||||
data.width = width;
|
||||
data.height = height;
|
||||
|
||||
data.background_colour = 0xFFFFFF;
|
||||
data.scale = scale;
|
||||
data.repeat_x = false;
|
||||
data.repeat_y = false;
|
||||
|
||||
/* Render the content */
|
||||
plot_ok &= content_redraw(content, 0, 0, width, height, &clip, scale,
|
||||
0xFFFFFF, false, false);
|
||||
plot_ok &= content_redraw(content, &data, &clip);
|
||||
|
||||
if (plot.option_knockout)
|
||||
knockout_plot_end();
|
||||
|
@ -1655,10 +1655,21 @@ static void tree_draw_node_element(struct tree *tree,
|
||||
|
||||
if (c.x1 > c.x0 && c.y1 > c.y0) {
|
||||
/* Valid clip rectangles only */
|
||||
struct content_redraw_data data;
|
||||
|
||||
plot.clip(&c);
|
||||
content_redraw(icon , x, y + icon_inset,
|
||||
TREE_ICON_SIZE, TREE_ICON_SIZE,
|
||||
&c, 1, 0, false, false);
|
||||
|
||||
data.x = x;
|
||||
data.y = y + icon_inset;
|
||||
data.width = TREE_ICON_SIZE;
|
||||
data.height = TREE_ICON_SIZE;
|
||||
|
||||
data.background_colour = 0xFFFFFF;
|
||||
data.scale = 1;
|
||||
data.repeat_x = false;
|
||||
data.repeat_y = false;
|
||||
|
||||
content_redraw(icon, &data, &c);
|
||||
|
||||
/* Restore previous clipping area */
|
||||
plot.clip(clip);
|
||||
|
14
image/bmp.c
14
image/bmp.c
@ -197,10 +197,8 @@ static bool nsbmp_convert(struct content *c)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool nsbmp_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 nsbmp_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip)
|
||||
{
|
||||
nsbmp_content *bmp = (nsbmp_content *) c;
|
||||
bitmap_flags_t flags = BITMAPF_NONE;
|
||||
@ -211,13 +209,13 @@ static bool nsbmp_redraw(struct content *c, int x, int y,
|
||||
|
||||
c->bitmap = bmp->bmp->bitmap;
|
||||
|
||||
if (repeat_x)
|
||||
if (data->repeat_x)
|
||||
flags |= BITMAPF_REPEAT_X;
|
||||
if (repeat_y)
|
||||
if (data->repeat_y)
|
||||
flags |= BITMAPF_REPEAT_Y;
|
||||
|
||||
return plot.bitmap(x, y, width, height, c->bitmap,
|
||||
background_colour, flags);
|
||||
return plot.bitmap(data->x, data->y, data->width, data->height,
|
||||
c->bitmap, data->background_colour, flags);
|
||||
}
|
||||
|
||||
|
||||
|
16
image/gif.c
16
image/gif.c
@ -338,10 +338,8 @@ static gif_result nsgif_get_frame(struct content *c)
|
||||
return res;
|
||||
}
|
||||
|
||||
static bool nsgif_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 nsgif_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip)
|
||||
{
|
||||
nsgif_content *gif = (nsgif_content *) c;
|
||||
bitmap_flags_t flags = BITMAPF_NONE;
|
||||
@ -352,16 +350,16 @@ static bool nsgif_redraw(struct content *c, int x, int y,
|
||||
|
||||
c->bitmap = gif->gif->frame_image;
|
||||
|
||||
if ((width == -1) && (height == -1))
|
||||
if ((data->width == -1) && (data->height == -1))
|
||||
return true;
|
||||
|
||||
if (repeat_x)
|
||||
if (data->repeat_x)
|
||||
flags |= BITMAPF_REPEAT_X;
|
||||
if (repeat_y)
|
||||
if (data->repeat_y)
|
||||
flags |= BITMAPF_REPEAT_Y;
|
||||
|
||||
return plot.bitmap(x, y, width, height, c->bitmap,
|
||||
background_colour, flags);
|
||||
return plot.bitmap(data->x, data->y, data->width, data->height,
|
||||
c->bitmap, data->background_colour, flags);
|
||||
}
|
||||
|
||||
|
||||
|
15
image/ico.c
15
image/ico.c
@ -157,13 +157,11 @@ static bool nsico_convert(struct content *c)
|
||||
}
|
||||
|
||||
|
||||
static bool nsico_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 nsico_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip)
|
||||
{
|
||||
nsico_content *ico = (nsico_content *) c;
|
||||
struct bmp_image *bmp = ico_find(ico->ico, width, height);
|
||||
struct bmp_image *bmp = ico_find(ico->ico, data->width, data->height);
|
||||
bitmap_flags_t flags = BITMAPF_NONE;
|
||||
|
||||
if (!bmp->decoded)
|
||||
@ -172,12 +170,13 @@ static bool nsico_redraw(struct content *c, int x, int y,
|
||||
|
||||
c->bitmap = bmp->bitmap;
|
||||
|
||||
if (repeat_x)
|
||||
if (data->repeat_x)
|
||||
flags |= BITMAPF_REPEAT_X;
|
||||
if (repeat_y)
|
||||
if (data->repeat_y)
|
||||
flags |= BITMAPF_REPEAT_Y;
|
||||
|
||||
return plot.bitmap(x, y, width, height, c->bitmap, background_colour, flags);
|
||||
return plot.bitmap(data->x, data->y, data->width, data->height,
|
||||
c->bitmap, data->background_colour, flags);
|
||||
}
|
||||
|
||||
|
||||
|
15
image/jpeg.c
15
image/jpeg.c
@ -277,21 +277,18 @@ static void nsjpeg_destroy(struct content *c)
|
||||
/**
|
||||
* Redraw a CONTENT_JPEG with appropriate tiling.
|
||||
*/
|
||||
static bool nsjpeg_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 nsjpeg_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip)
|
||||
{
|
||||
bitmap_flags_t flags = BITMAPF_NONE;
|
||||
|
||||
if (repeat_x)
|
||||
if (data->repeat_x)
|
||||
flags |= BITMAPF_REPEAT_X;
|
||||
if (repeat_y)
|
||||
if (data->repeat_y)
|
||||
flags |= BITMAPF_REPEAT_Y;
|
||||
|
||||
return plot.bitmap(x, y, width, height,
|
||||
c->bitmap, background_colour,
|
||||
flags);
|
||||
return plot.bitmap(data->x, data->y, data->width, data->height,
|
||||
c->bitmap, data->background_colour, flags);
|
||||
}
|
||||
|
||||
|
||||
|
21
image/mng.c
21
image/mng.c
@ -67,10 +67,8 @@ static bool nsmng_process_data(struct content *c, const char *data,
|
||||
unsigned int size);
|
||||
static bool nsmng_convert(struct content *c);
|
||||
static void nsmng_destroy(struct content *c);
|
||||
static bool nsmng_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 nsmng_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip);
|
||||
static nserror nsmng_clone(const struct content *old, struct content **newc);
|
||||
static content_type nsmng_content_type(lwc_string *mime_type);
|
||||
|
||||
@ -687,10 +685,8 @@ void nsmng_destroy(struct content *c)
|
||||
}
|
||||
|
||||
|
||||
bool nsmng_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 nsmng_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip)
|
||||
{
|
||||
nsmng_content *mng = (nsmng_content *) c;
|
||||
bool ret;
|
||||
@ -704,14 +700,13 @@ bool nsmng_redraw(struct content *c, int x, int y,
|
||||
mng->opaque_test_pending = false;
|
||||
}
|
||||
|
||||
if (repeat_x)
|
||||
if (data->repeat_x)
|
||||
flags |= BITMAPF_REPEAT_X;
|
||||
if (repeat_y)
|
||||
if (data->repeat_y)
|
||||
flags |= BITMAPF_REPEAT_Y;
|
||||
|
||||
ret = plot.bitmap(x, y, width, height,
|
||||
c->bitmap, background_colour,
|
||||
flags);
|
||||
ret = plot.bitmap(data->x, data->y, data->width, data->height,
|
||||
c->bitmap, data->background_colour, flags);
|
||||
|
||||
/* Check if we need to restart the animation
|
||||
*/
|
||||
|
@ -50,10 +50,8 @@ static nserror nssprite_create(const content_handler *handler,
|
||||
bool quirks, struct content **c);
|
||||
static bool nssprite_convert(struct content *c);
|
||||
static void nssprite_destroy(struct content *c);
|
||||
static bool nssprite_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 nssprite_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip);
|
||||
static nserror nssprite_clone(const struct content *old, struct content **newc);
|
||||
static content_type nssprite_content_type(lwc_string *mime_type);
|
||||
|
||||
@ -240,20 +238,18 @@ void nssprite_destroy(struct content *c)
|
||||
* Redraw a CONTENT_SPRITE.
|
||||
*/
|
||||
|
||||
bool nssprite_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 nssprite_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip)
|
||||
{
|
||||
bitmap_flags_t flags = BITMAPF_NONE;
|
||||
|
||||
if (repeat_x)
|
||||
if (data->repeat_x)
|
||||
flags |= BITMAPF_REPEAT_X;
|
||||
if (repeat_y)
|
||||
if (data->repeat_y)
|
||||
flags |= BITMAPF_REPEAT_Y;
|
||||
|
||||
return plot.bitmap(x, y, width, height,
|
||||
c->bitmap, background_colour, flags);
|
||||
return plot.bitmap(data->x, data->y, data->width, data->height,
|
||||
c->bitmap, data->background_colour, flags);
|
||||
}
|
||||
|
||||
|
||||
|
14
image/png.c
14
image/png.c
@ -362,23 +362,21 @@ static void nspng_destroy(struct content *c)
|
||||
}
|
||||
|
||||
|
||||
static bool nspng_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 nspng_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip)
|
||||
{
|
||||
nspng_content *png_c = (nspng_content *) c;
|
||||
bitmap_flags_t flags = BITMAPF_NONE;
|
||||
|
||||
assert(png_c->bitmap != NULL);
|
||||
|
||||
if (repeat_x)
|
||||
if (data->repeat_x)
|
||||
flags |= BITMAPF_REPEAT_X;
|
||||
if (repeat_y)
|
||||
if (data->repeat_y)
|
||||
flags |= BITMAPF_REPEAT_Y;
|
||||
|
||||
return plot.bitmap(x, y, width, height,
|
||||
png_c->bitmap, background_colour, flags);
|
||||
return plot.bitmap(data->x, data->y, data->width, data->height,
|
||||
png_c->bitmap, data->background_colour, flags);
|
||||
}
|
||||
|
||||
static nserror nspng_clone(const struct content *old_c, struct content **new_c)
|
||||
|
14
image/rsvg.c
14
image/rsvg.c
@ -229,22 +229,20 @@ static bool rsvg_convert(struct content *c)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool rsvg_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 rsvg_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip)
|
||||
{
|
||||
bitmap_flags_t flags = BITMAPF_NONE;
|
||||
|
||||
assert(c->bitmap != NULL);
|
||||
|
||||
if (repeat_x)
|
||||
if (data->repeat_x)
|
||||
flags |= BITMAPF_REPEAT_X;
|
||||
if (repeat_y)
|
||||
if (data->repeat_y)
|
||||
flags |= BITMAPF_REPEAT_Y;
|
||||
|
||||
return plot.bitmap(x, y, width, height,
|
||||
c->bitmap, background_colour, flags);
|
||||
return plot.bitmap(data->x, data->y, data->width, data->height,
|
||||
c->bitmap, data->background_colour, flags);
|
||||
}
|
||||
|
||||
static void rsvg_destroy(struct content *c)
|
||||
|
40
image/svg.c
40
image/svg.c
@ -51,10 +51,8 @@ static nserror svg_create_svg_data(svg_content *c);
|
||||
static bool svg_convert(struct content *c);
|
||||
static void svg_destroy(struct content *c);
|
||||
static void svg_reformat(struct content *c, int width, int height);
|
||||
static bool svg_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 svg_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip);
|
||||
static nserror svg_clone(const struct content *old, struct content **newc);
|
||||
static content_type svg_content_type(lwc_string *mime_type);
|
||||
|
||||
@ -285,21 +283,22 @@ static bool svg_redraw_internal(struct content *c, int x, int y,
|
||||
* Redraw a CONTENT_SVG.
|
||||
*/
|
||||
|
||||
bool svg_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 svg_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip)
|
||||
{
|
||||
if ((width <= 0) && (height <= 0)) {
|
||||
int x = data->x;
|
||||
int y = data->y;
|
||||
|
||||
if ((data->width <= 0) && (data->height <= 0)) {
|
||||
/* No point trying to plot SVG if it does not occupy a valid
|
||||
* area */
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((repeat_x == false) && (repeat_y == false)) {
|
||||
if ((data->repeat_x == false) && (data->repeat_y == false)) {
|
||||
/* Simple case: SVG is not tiled */
|
||||
return svg_redraw_internal(c, x, y, width, height,
|
||||
clip, scale, background_colour);
|
||||
return svg_redraw_internal(c, x, y, data->width, data->height,
|
||||
clip, data->scale, data->background_colour);
|
||||
} else {
|
||||
/* Tiled redraw required. SVG repeats to extents of clip
|
||||
* rectangle, in x, y or both directions */
|
||||
@ -307,26 +306,27 @@ bool svg_redraw(struct content *c, int x, int y,
|
||||
|
||||
/* Find the redraw boundaries to loop within */
|
||||
x0 = x;
|
||||
if (repeat_x) {
|
||||
for (; x0 > clip->x0; x0 -= width);
|
||||
if (data->repeat_x) {
|
||||
for (; x0 > clip->x0; x0 -= data->width);
|
||||
x1 = clip->x1;
|
||||
} else {
|
||||
x1 = x + 1;
|
||||
}
|
||||
y0 = y;
|
||||
if (repeat_y) {
|
||||
for (; y0 > clip->y0; y0 -= height);
|
||||
if (data->repeat_y) {
|
||||
for (; y0 > clip->y0; y0 -= data->height);
|
||||
y1 = clip->y1;
|
||||
} else {
|
||||
y1 = y + 1;
|
||||
}
|
||||
|
||||
/* Repeatedly plot the SVG across the area */
|
||||
for (y = y0; y < y1; y += height) {
|
||||
for (x = x0; x < x1; x += width) {
|
||||
for (y = y0; y < y1; y += data->height) {
|
||||
for (x = x0; x < x1; x += data->width) {
|
||||
if (!svg_redraw_internal(c, x, y,
|
||||
width, height, clip, scale,
|
||||
background_colour)) {
|
||||
data->width, data->height,
|
||||
clip, data->scale,
|
||||
data->background_colour)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
20
image/webp.c
20
image/webp.c
@ -47,10 +47,8 @@ static nserror webp_create(const content_handler *handler,
|
||||
bool quirks, struct content **c);
|
||||
static bool webp_convert(struct content *c);
|
||||
static void webp_destroy(struct content *c);
|
||||
static bool webp_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 webp_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip);
|
||||
static nserror webp_clone(const struct content *old, struct content **newc);
|
||||
static content_type webp_content_type(lwc_string *mime_type);
|
||||
|
||||
@ -213,20 +211,18 @@ void webp_destroy(struct content *c)
|
||||
* Redraw a CONTENT_WEBP.
|
||||
*/
|
||||
|
||||
bool webp_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 webp_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip)
|
||||
{
|
||||
bitmap_flags_t flags = BITMAPF_NONE;
|
||||
|
||||
if (repeat_x)
|
||||
if (data->repeat_x)
|
||||
flags |= BITMAPF_REPEAT_X;
|
||||
if (repeat_y)
|
||||
if (data->repeat_y)
|
||||
flags |= BITMAPF_REPEAT_Y;
|
||||
|
||||
return plot.bitmap(x, y, width, height,
|
||||
c->bitmap, background_colour, flags);
|
||||
return plot.bitmap(data->x, data->y, data->width, data->height,
|
||||
c->bitmap, data->background_colour, flags);
|
||||
}
|
||||
|
||||
|
||||
|
@ -103,10 +103,8 @@ bool html_fetch_object(html_content *c, const char *url, struct box *box,
|
||||
void html_set_status(html_content *c, const char *extra);
|
||||
|
||||
/* in render/html_redraw.c */
|
||||
bool html_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 html_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip);
|
||||
|
||||
/* in render/html_interaction.c */
|
||||
void html_mouse_track(struct content *c, struct browser_window *bw,
|
||||
|
@ -97,23 +97,16 @@ bool html_redraw_debug = false;
|
||||
/**
|
||||
* Draw a CONTENT_HTML using the current set of plotters (plot).
|
||||
*
|
||||
* \param c content of type CONTENT_HTML
|
||||
* \param x coordinate for top-left of redraw
|
||||
* \param y coordinate for top-left of redraw
|
||||
* \param width available width (not used for HTML redraw)
|
||||
* \param height available height (not used for HTML redraw)
|
||||
* \param clip clip rectangle
|
||||
* \param scale scale for redraw
|
||||
* \param background_colour the background colour
|
||||
* \param c content of type CONTENT_HTML
|
||||
* \param data redraw data for this content redraw
|
||||
* \param clip current clip region
|
||||
* \return true if successful, false otherwise
|
||||
*
|
||||
* x, y, clip_[xy][01] are in target coordinates.
|
||||
*/
|
||||
|
||||
bool html_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 html_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip)
|
||||
{
|
||||
html_content *html = (html_content *) c;
|
||||
struct box *box;
|
||||
@ -121,7 +114,7 @@ bool html_redraw(struct content *c, int x, int y,
|
||||
bool select, select_only;
|
||||
plot_style_t pstyle_fill_bg = {
|
||||
.fill_type = PLOT_OP_TYPE_SOLID,
|
||||
.fill_colour = background_colour,
|
||||
.fill_colour = data->background_colour,
|
||||
};
|
||||
|
||||
box = html->layout;
|
||||
@ -138,8 +131,8 @@ bool html_redraw(struct content *c, int x, int y,
|
||||
select = true;
|
||||
/* check if the redraw rectangle is completely inside of the
|
||||
select menu */
|
||||
select_only = form_clip_inside_select_menu(control, scale,
|
||||
clip);
|
||||
select_only = form_clip_inside_select_menu(control,
|
||||
data->scale, clip);
|
||||
}
|
||||
|
||||
if (!select_only) {
|
||||
@ -152,8 +145,8 @@ bool html_redraw(struct content *c, int x, int y,
|
||||
result &= plot.rectangle(clip->x0, clip->y0, clip->x1, clip->y1,
|
||||
&pstyle_fill_bg);
|
||||
|
||||
result &= html_redraw_box(html, box, x, y, clip,
|
||||
scale, pstyle_fill_bg.fill_colour);
|
||||
result &= html_redraw_box(html, box, data->x, data->y, clip,
|
||||
data->scale, pstyle_fill_bg.fill_colour);
|
||||
}
|
||||
|
||||
if (select) {
|
||||
@ -165,8 +158,8 @@ bool html_redraw(struct content *c, int x, int y,
|
||||
menu_y += box->height + box->border[BOTTOM].width +
|
||||
box->padding[BOTTOM] + box->padding[TOP];
|
||||
result &= form_redraw_select_menu(html->visible_select_menu,
|
||||
x + menu_x, y + menu_y,
|
||||
current_redraw_browser->scale, clip);
|
||||
data->x + menu_x, data->y + menu_y,
|
||||
data->scale, clip);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -650,14 +643,21 @@ bool html_redraw_box(html_content *html, struct box *box,
|
||||
return false;
|
||||
|
||||
if (box->object && width != 0 && height != 0) {
|
||||
struct content_redraw_data obj_data;
|
||||
|
||||
x_scrolled = x - scrollbar_get_offset(box->scroll_x) * scale;
|
||||
y_scrolled = y - scrollbar_get_offset(box->scroll_y) * scale;
|
||||
if (!content_redraw(box->object,
|
||||
x_scrolled + padding_left,
|
||||
y_scrolled + padding_top,
|
||||
width, height, &r, scale,
|
||||
current_background_color,
|
||||
false, false))
|
||||
|
||||
obj_data.x = x_scrolled + padding_left;
|
||||
obj_data.y = y_scrolled + padding_top;
|
||||
obj_data.width = width;
|
||||
obj_data.height = height;
|
||||
obj_data.background_colour = current_background_color;
|
||||
obj_data.scale = scale;
|
||||
obj_data.repeat_x = false;
|
||||
obj_data.repeat_y = false;
|
||||
|
||||
if (!content_redraw(box->object, &obj_data, &r))
|
||||
return false;
|
||||
|
||||
} else if (box->iframe) {
|
||||
@ -2182,14 +2182,22 @@ bool html_redraw_background(int x, int y, struct box *box, float scale,
|
||||
}
|
||||
/* valid clipping rectangles only */
|
||||
if ((r.x0 < r.x1) && (r.y0 < r.y1)) {
|
||||
struct content_redraw_data bg_data;
|
||||
|
||||
if (!plot.clip(&r))
|
||||
return false;
|
||||
if (!content_redraw(
|
||||
background->background, x, y,
|
||||
ceilf(width * scale),
|
||||
ceilf(height * scale), &r,
|
||||
scale, *background_colour,
|
||||
repeat_x, repeat_y))
|
||||
|
||||
bg_data.x = x;
|
||||
bg_data.y = y;
|
||||
bg_data.width = ceilf(width * scale);
|
||||
bg_data.height = ceilf(height * scale);
|
||||
bg_data.background_colour = *background_colour;
|
||||
bg_data.scale = scale;
|
||||
bg_data.repeat_x = repeat_x;
|
||||
bg_data.repeat_y = repeat_y;
|
||||
|
||||
if (!content_redraw(background->background,
|
||||
&bg_data, &r))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -2323,13 +2331,21 @@ bool html_redraw_inline_background(int x, int y, struct box *box, float scale,
|
||||
}
|
||||
/* valid clipping rectangles only */
|
||||
if ((r.x0 < r.x1) && (r.y0 < r.y1)) {
|
||||
struct content_redraw_data bg_data;
|
||||
|
||||
if (!plot.clip(&r))
|
||||
return false;
|
||||
if (!content_redraw(box->background, x, y,
|
||||
ceilf(width * scale),
|
||||
ceilf(height * scale), &r,
|
||||
scale, *background_colour,
|
||||
repeat_x, repeat_y))
|
||||
|
||||
bg_data.x = x;
|
||||
bg_data.y = y;
|
||||
bg_data.width = ceilf(width * scale);
|
||||
bg_data.height = ceilf(height * scale);
|
||||
bg_data.background_colour = *background_colour;
|
||||
bg_data.scale = scale;
|
||||
bg_data.repeat_x = repeat_x;
|
||||
bg_data.repeat_y = repeat_y;
|
||||
|
||||
if (!content_redraw(box->background, &bg_data, &r))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -102,10 +102,8 @@ static void textplain_mouse_action(struct content *c, struct browser_window *bw,
|
||||
browser_mouse_state mouse, int x, int y);
|
||||
static void textplain_reformat(struct content *c, int width, int height);
|
||||
static void textplain_destroy(struct content *c);
|
||||
static bool textplain_redraw(struct content *c, int x, int y,
|
||||
int width, int height, const struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool redraw_x, bool redraw_y);
|
||||
static bool textplain_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip);
|
||||
static nserror textplain_clone(const struct content *old,
|
||||
struct content **newc);
|
||||
static content_type textplain_content_type(lwc_string *mime_type);
|
||||
@ -668,33 +666,28 @@ void textplain_mouse_action(struct content *c, struct browser_window *bw,
|
||||
/**
|
||||
* Draw a CONTENT_TEXTPLAIN using the current set of plotters (plot).
|
||||
*
|
||||
* \param c content of type CONTENT_TEXTPLAIN
|
||||
* \param x coordinate for top-left of redraw
|
||||
* \param y coordinate for top-left of redraw
|
||||
* \param width available width
|
||||
* \param height available height
|
||||
* \param clip clip rectangle
|
||||
* \param scale scale for redraw
|
||||
* \param background_colour the background colour
|
||||
* \param c content of type CONTENT_TEXTPLAIN
|
||||
* \param data redraw data for this content redraw
|
||||
* \param clip current clip region
|
||||
* \return true if successful, false otherwise
|
||||
*
|
||||
* x, y, clip_[xy][01] are in target coordinates.
|
||||
*/
|
||||
|
||||
bool textplain_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 textplain_redraw(struct content *c, struct content_redraw_data *data,
|
||||
const struct rect *clip)
|
||||
{
|
||||
textplain_content *text = (textplain_content *) c;
|
||||
struct browser_window *bw = current_redraw_browser;
|
||||
char *utf8_data = text->utf8_data;
|
||||
long lineno;
|
||||
int x = data->x;
|
||||
int y = data->y;
|
||||
unsigned long line_count = text->physical_line_count;
|
||||
float line_height = textplain_line_height();
|
||||
float scaled_line_height = line_height * scale;
|
||||
long line0 = (clip->y0 - y * scale) / scaled_line_height - 1;
|
||||
long line1 = (clip->y1 - y * scale) / scaled_line_height + 1;
|
||||
float scaled_line_height = line_height * data->scale;
|
||||
long line0 = (clip->y0 - y * data->scale) / scaled_line_height - 1;
|
||||
long line1 = (clip->y1 - y * data->scale) / scaled_line_height + 1;
|
||||
struct textplain_line *line = text->physical_line;
|
||||
size_t length;
|
||||
plot_style_t *plot_style_highlight;
|
||||
@ -718,19 +711,19 @@ bool textplain_redraw(struct content *c, int x, int y,
|
||||
return true;
|
||||
|
||||
/* choose a suitable background colour for any highlighted text */
|
||||
if ((background_colour & 0x808080) == 0x808080)
|
||||
if ((data->background_colour & 0x808080) == 0x808080)
|
||||
plot_style_highlight = plot_style_fill_black;
|
||||
else
|
||||
plot_style_highlight = plot_style_fill_white;
|
||||
|
||||
/* Set up font plot style */
|
||||
textplain_style.background = background_colour;
|
||||
textplain_style.background = data->background_colour;
|
||||
|
||||
x = (x + MARGIN) * scale;
|
||||
y = (y + MARGIN) * scale;
|
||||
x = (x + MARGIN) * data->scale;
|
||||
y = (y + MARGIN) * data->scale;
|
||||
for (lineno = line0; lineno != line1; lineno++) {
|
||||
const char *text = utf8_data + line[lineno].start;
|
||||
int tab_width = textplain_tab_width * scale;
|
||||
int tab_width = textplain_tab_width * data->scale;
|
||||
size_t offset = 0;
|
||||
int tx = x;
|
||||
|
||||
@ -752,7 +745,7 @@ bool textplain_redraw(struct content *c, int x, int y,
|
||||
line[lineno].start + offset, 0,
|
||||
&textplain_style,
|
||||
tx, y + (lineno * scaled_line_height),
|
||||
clip, line_height, scale, false))
|
||||
clip, line_height, data->scale, false))
|
||||
return false;
|
||||
|
||||
if (next_offset >= length)
|
||||
@ -761,7 +754,7 @@ bool textplain_redraw(struct content *c, int x, int y,
|
||||
/* locate end of string and align to next tab position */
|
||||
if (nsfont.font_width(&textplain_style, &text[offset],
|
||||
next_offset - offset, &width))
|
||||
tx += (int)(width * scale);
|
||||
tx += (int)(width * data->scale);
|
||||
|
||||
ntx = x + ((1 + (tx - x) / tab_width) * tab_width);
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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",
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.";
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user