summaryrefslogtreecommitdiff
path: root/image/svg.c
diff options
context:
space:
mode:
Diffstat (limited to 'image/svg.c')
-rw-r--r--image/svg.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/image/svg.c b/image/svg.c
index a447eaf54..d53013033 100644
--- a/image/svg.c
+++ b/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;
}
}