summaryrefslogtreecommitdiff
path: root/boilerplate/cairo-boilerplate-svg.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-09-26 15:26:40 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2008-09-26 17:11:51 +0100
commit0c030d3b768718eac5d429d0c819934f32896b25 (patch)
tree9b60f3dda1341ba4f37d4a77125411682456d2ea /boilerplate/cairo-boilerplate-svg.c
parent86e57671dd21078215505202ef8aa2141d10fb9c (diff)
[boilerplate] Add svg-1.2 target.
SVG 1.2 is sufficiently different from 1.1 that it has separate code paths within cairo-svg-surface and so justifies its own boilerplate target.
Diffstat (limited to 'boilerplate/cairo-boilerplate-svg.c')
-rw-r--r--boilerplate/cairo-boilerplate-svg.c48
1 files changed, 44 insertions, 4 deletions
diff --git a/boilerplate/cairo-boilerplate-svg.c b/boilerplate/cairo-boilerplate-svg.c
index c3ad8d2f..227088cc 100644
--- a/boilerplate/cairo-boilerplate-svg.c
+++ b/boilerplate/cairo-boilerplate-svg.c
@@ -39,16 +39,16 @@
cairo_user_data_key_t svg_closure_key;
-typedef struct _svg_target_closure
-{
+typedef struct _svg_target_closure {
char *filename;
int width, height;
cairo_surface_t *target;
} svg_target_closure_t;
-cairo_surface_t *
+static cairo_surface_t *
_cairo_boilerplate_svg_create_surface (const char *name,
cairo_content_t content,
+ cairo_svg_version_t version,
int width,
int height,
int max_width,
@@ -73,6 +73,7 @@ _cairo_boilerplate_svg_create_surface (const char *name,
if (cairo_surface_status (surface))
goto CLEANUP_FILENAME;
+ cairo_svg_surface_restrict_to_version (surface, version);
cairo_surface_set_fallback_resolution (surface, 72., 72.);
if (content == CAIRO_CONTENT_COLOR) {
@@ -101,6 +102,45 @@ _cairo_boilerplate_svg_create_surface (const char *name,
return surface;
}
+cairo_surface_t *
+_cairo_boilerplate_svg11_create_surface (const char *name,
+ cairo_content_t content,
+ int width,
+ int height,
+ int max_width,
+ int max_height,
+ cairo_boilerplate_mode_t mode,
+ int id,
+ void **closure)
+{
+ /* current default, but be explicit in case the default changes */
+ return _cairo_boilerplate_svg_create_surface (name, content,
+ CAIRO_SVG_VERSION_1_1,
+ width, height,
+ max_width, max_height,
+ mode, id,
+ closure);
+}
+
+cairo_surface_t *
+_cairo_boilerplate_svg12_create_surface (const char *name,
+ cairo_content_t content,
+ int width,
+ int height,
+ int max_width,
+ int max_height,
+ cairo_boilerplate_mode_t mode,
+ int id,
+ void **closure)
+{
+ return _cairo_boilerplate_svg_create_surface (name, content,
+ CAIRO_SVG_VERSION_1_2,
+ width, height,
+ max_width, max_height,
+ mode, id,
+ closure);
+}
+
cairo_status_t
_cairo_boilerplate_svg_finish_surface (cairo_surface_t *surface)
{
@@ -207,7 +247,7 @@ cairo_boilerplate_svg_surface_force_fallbacks (cairo_surface_t *abstract_surface
cairo_paginated_surface_t *paginated = (cairo_paginated_surface_t*) abstract_surface;
cairo_svg_surface_t *surface;
- if (cairo_surface_get_type (abstract_surface) != CAIRO_SURFACE_TYPE_PDF)
+ if (cairo_surface_get_type (abstract_surface) != CAIRO_SURFACE_TYPE_SVG)
return CAIRO_STATUS_SURFACE_TYPE_MISMATCH;
surface = (cairo_svg_surface_t*) paginated->target;