summaryrefslogtreecommitdiff
path: root/image
diff options
context:
space:
mode:
Diffstat (limited to 'image')
-rw-r--r--image/bmp.c2
-rw-r--r--image/bmp.h2
-rw-r--r--image/gif.c2
-rw-r--r--image/gif.h2
-rw-r--r--image/ico.c2
-rw-r--r--image/ico.h2
-rw-r--r--image/jpeg.c2
-rw-r--r--image/jpeg.h2
-rw-r--r--image/mng.c2
-rw-r--r--image/mng.h2
-rw-r--r--image/nssprite.c2
-rw-r--r--image/nssprite.h2
-rw-r--r--image/png.c2
-rw-r--r--image/png.h2
-rw-r--r--image/rsvg.c2
-rw-r--r--image/rsvg.h2
-rw-r--r--image/svg.c39
-rw-r--r--image/svg.h4
18 files changed, 44 insertions, 31 deletions
diff --git a/image/bmp.c b/image/bmp.c
index 1774f945c..d4584f85d 100644
--- a/image/bmp.c
+++ b/image/bmp.c
@@ -64,7 +64,7 @@ bool nsbmp_create(struct content *c, const struct http_parameter *params)
}
-bool nsbmp_convert(struct content *c, int iwidth, int iheight)
+bool nsbmp_convert(struct content *c)
{
bmp_result res;
bmp_image *bmp;
diff --git a/image/bmp.h b/image/bmp.h
index 7d70a952d..0ef5ba602 100644
--- a/image/bmp.h
+++ b/image/bmp.h
@@ -42,7 +42,7 @@ struct content_bmp_data {
extern bmp_bitmap_callback_vt bmp_bitmap_callbacks; /** Only to be used by ICO code. */
bool nsbmp_create(struct content *c, const struct http_parameter *params);
-bool nsbmp_convert(struct content *c, int width, int height);
+bool nsbmp_convert(struct content *c);
void nsbmp_destroy(struct content *c);
bool nsbmp_redraw(struct content *c, int x, int y,
int width, int height,
diff --git a/image/gif.c b/image/gif.c
index 81da8bd5d..8c5025af6 100644
--- a/image/gif.c
+++ b/image/gif.c
@@ -79,7 +79,7 @@ bool nsgif_create(struct content *c, const struct http_parameter *params)
}
-bool nsgif_convert(struct content *c, int iwidth, int iheight)
+bool nsgif_convert(struct content *c)
{
int res;
struct gif_animation *gif;
diff --git a/image/gif.h b/image/gif.h
index 87f647eba..9a39ecf55 100644
--- a/image/gif.h
+++ b/image/gif.h
@@ -39,7 +39,7 @@ struct content_gif_data {
};
bool nsgif_create(struct content *c, const struct http_parameter *params);
-bool nsgif_convert(struct content *c, int width, int height);
+bool nsgif_convert(struct content *c);
void nsgif_destroy(struct content *c);
bool nsgif_redraw(struct content *c, int x, int y,
int width, int height,
diff --git a/image/ico.c b/image/ico.c
index df07d50ed..233018cea 100644
--- a/image/ico.c
+++ b/image/ico.c
@@ -52,7 +52,7 @@ bool nsico_create(struct content *c, const struct http_parameter *params)
}
-bool nsico_convert(struct content *c, int iwidth, int iheight)
+bool nsico_convert(struct content *c)
{
struct bmp_image *bmp;
bmp_result res;
diff --git a/image/ico.h b/image/ico.h
index e25da8361..75f79a92e 100644
--- a/image/ico.h
+++ b/image/ico.h
@@ -38,7 +38,7 @@ struct content_ico_data {
};
bool nsico_create(struct content *c, const struct http_parameter *params);
-bool nsico_convert(struct content *c, int width, int height);
+bool nsico_convert(struct content *c);
void nsico_destroy(struct content *c);
bool nsico_redraw(struct content *c, int x, int y,
int width, int height,
diff --git a/image/jpeg.c b/image/jpeg.c
index 1d66b05d3..dd86d6ac9 100644
--- a/image/jpeg.c
+++ b/image/jpeg.c
@@ -75,7 +75,7 @@ static void nsjpeg_term_source(j_decompress_ptr cinfo);
* Convert a CONTENT_JPEG for display.
*/
-bool nsjpeg_convert(struct content *c, int w, int h)
+bool nsjpeg_convert(struct content *c)
{
struct jpeg_decompress_struct cinfo;
struct nsjpeg_error_mgr jerr;
diff --git a/image/jpeg.h b/image/jpeg.h
index ec2a4ecc1..1c01929b8 100644
--- a/image/jpeg.h
+++ b/image/jpeg.h
@@ -35,7 +35,7 @@ struct content_jpeg_data {
int dummy; /* NOT USED but to satisfy Norcroft */
};
-bool nsjpeg_convert(struct content *c, int width, int height);
+bool nsjpeg_convert(struct content *c);
void nsjpeg_destroy(struct content *c);
bool nsjpeg_redraw(struct content *c, int x, int y,
int width, int height,
diff --git a/image/mng.c b/image/mng.c
index e76125b9b..2c9d6fd8a 100644
--- a/image/mng.c
+++ b/image/mng.c
@@ -299,7 +299,7 @@ bool nsmng_process_data(struct content *c, char *data, unsigned int size)
}
-bool nsmng_convert(struct content *c, int width, int height)
+bool nsmng_convert(struct content *c)
{
mng_retcode status;
diff --git a/image/mng.h b/image/mng.h
index 553fff36f..fb822cf78 100644
--- a/image/mng.h
+++ b/image/mng.h
@@ -43,7 +43,7 @@ struct content_mng_data {
bool nsmng_create(struct content *c, const struct http_parameter *params);
bool nsmng_process_data(struct content *c, char *data, unsigned int size);
-bool nsmng_convert(struct content *c, int width, int height);
+bool nsmng_convert(struct content *c);
void nsmng_destroy(struct content *c);
bool nsmng_redraw(struct content *c, int x, int y,
int width, int height,
diff --git a/image/nssprite.c b/image/nssprite.c
index 9f48ffccf..f24489114 100644
--- a/image/nssprite.c
+++ b/image/nssprite.c
@@ -56,7 +56,7 @@
* No conversion is necessary. We merely read the sprite dimensions.
*/
-bool nssprite_convert(struct content *c, int width, int height)
+bool nssprite_convert(struct content *c)
{
union content_msg_data msg_data;
diff --git a/image/nssprite.h b/image/nssprite.h
index 47d989aa7..cc366efc7 100644
--- a/image/nssprite.h
+++ b/image/nssprite.h
@@ -34,7 +34,7 @@ struct content_nssprite_data {
struct rosprite_area* sprite_area;
};
-bool nssprite_convert(struct content *c, int width, int height);
+bool nssprite_convert(struct content *c);
void nssprite_destroy(struct content *c);
bool nssprite_redraw(struct content *c, int x, int y,
int width, int height,
diff --git a/image/png.c b/image/png.c
index dfb427230..3e9b21a9e 100644
--- a/image/png.c
+++ b/image/png.c
@@ -261,7 +261,7 @@ void end_callback(png_structp png, png_infop info)
-bool nspng_convert(struct content *c, int width, int height)
+bool nspng_convert(struct content *c)
{
const char *data;
unsigned long size;
diff --git a/image/png.h b/image/png.h
index b940434e7..63056c8e4 100644
--- a/image/png.h
+++ b/image/png.h
@@ -44,7 +44,7 @@ struct content_png_data {
bool nspng_create(struct content *c, const struct http_parameter *params);
bool nspng_process_data(struct content *c, char *data, unsigned int size);
-bool nspng_convert(struct content *c, int width, int height);
+bool nspng_convert(struct content *c);
void nspng_destroy(struct content *c);
bool nspng_redraw(struct content *c, int x, int y,
int width, int height,
diff --git a/image/rsvg.c b/image/rsvg.c
index ea4b58b42..058759425 100644
--- a/image/rsvg.c
+++ b/image/rsvg.c
@@ -115,7 +115,7 @@ static inline void rsvg_argb_to_abgr(uint32_t pixels[], int width, int height,
}
}
-bool rsvg_convert(struct content *c, int iwidth, int iheight)
+bool rsvg_convert(struct content *c)
{
struct content_rsvg_data *d = &c->data.rsvg;
union content_msg_data msg_data;
diff --git a/image/rsvg.h b/image/rsvg.h
index ae28d3af1..80b837220 100644
--- a/image/rsvg.h
+++ b/image/rsvg.h
@@ -44,7 +44,7 @@ struct content_rsvg_data {
bool rsvg_create(struct content *c, const struct http_parameter *params);
bool rsvg_process_data(struct content *c, char *data, unsigned int size);
-bool rsvg_convert(struct content *c, int width, int height);
+bool rsvg_convert(struct content *c);
void rsvg_destroy(struct content *c);
bool rsvg_redraw(struct content *c, int x, int y,
int width, int height,
diff --git a/image/svg.c b/image/svg.c
index d347a0d35..a233739b7 100644
--- a/image/svg.c
+++ b/image/svg.c
@@ -48,6 +48,8 @@ bool svg_create(struct content *c, const struct http_parameter *params)
if (!c->data.svg.diagram)
goto no_memory;
+ c->data.svg.done_parse = false;
+
return true;
no_memory:
@@ -61,21 +63,8 @@ no_memory:
* Convert a CONTENT_SVG for display.
*/
-bool svg_convert(struct content *c, int w, int h)
+bool svg_convert(struct content *c)
{
- const char *source_data;
- unsigned long source_size;
-
- assert(c->data.svg.diagram);
-
- source_data = content__get_source_data(c, &source_size);
-
- svgtiny_parse(c->data.svg.diagram, source_data, source_size,
- content__get_url(c), w, h);
-
- c->width = c->data.svg.diagram->width;
- c->height = c->data.svg.diagram->height;
-
/*c->title = malloc(100);
if (c->title)
snprintf(c->title, 100, messages_get("svgTitle"),
@@ -88,6 +77,28 @@ bool svg_convert(struct content *c, int w, int h)
return true;
}
+/**
+ * Reformat a CONTENT_SVG.
+ */
+
+void svg_reformat(struct content *c, int width, int height)
+{
+ const char *source_data;
+ unsigned long source_size;
+
+ assert(c->data.svg.diagram);
+
+ if (c->data.svg.done_parse == false) {
+ source_data = content__get_source_data(c, &source_size);
+
+ svgtiny_parse(c->data.svg.diagram, source_data, source_size,
+ content__get_url(c), w, h);
+ }
+
+ c->width = c->data.svg.diagram->width;
+ c->height = c->data.svg.diagram->height;
+}
+
/**
* Redraw a CONTENT_SVG.
diff --git a/image/svg.h b/image/svg.h
index fe9bea3d2..e6cffea39 100644
--- a/image/svg.h
+++ b/image/svg.h
@@ -31,11 +31,13 @@ struct svgtiny_diagram;
struct content_svg_data {
struct svgtiny_diagram *diagram;
+ bool done_parse;
};
bool svg_create(struct content *c, const struct http_parameter *params);
-bool svg_convert(struct content *c, int width, int height);
+bool svg_convert(struct content *c);
void svg_destroy(struct content *c);
+void svg_reformat(struct content *c, int width, int height);
bool svg_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,