Skip to content

Commit

Permalink
Modify scale and image size for the PDF/SVG driver
Browse files Browse the repository at this point in the history
  • Loading branch information
szekerest committed Jun 10, 2016
1 parent 19f87ff commit bbd1fc2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mapcairo.c
Expand Up @@ -670,14 +670,14 @@ imageObj* createImageCairo(int width, int height, outputFormatObj *format,colorO
r->surface = cairo_pdf_surface_create_for_stream(
_stream_write_fn,
r->outputStream,
width,height);
0.72*width,0.72*height);
} else if(!strcasecmp(format->driver,"cairo/svg")) {
r->outputStream = (bufferObj*)malloc(sizeof(bufferObj));
msBufferInit(r->outputStream);
r->surface = cairo_svg_surface_create_for_stream(
_stream_write_fn,
r->outputStream,
width,height);
0.72*width,0.72*height);
} else if(!strcasecmp(format->driver,"cairo/winGDI") && format->device) {
#if CAIRO_HAS_WIN32_SURFACE
r->outputStream = NULL;
Expand All @@ -699,6 +699,10 @@ imageObj* createImageCairo(int width, int height, outputFormatObj *format,colorO
r->surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
}
r->cr = cairo_create(r->surface);

if(!strcasecmp(format->driver,"cairo/pdf") || !strcasecmp(format->driver,"cairo/svg")) {
cairo_scale (r->cr, 0.72, 0.72);
}
if(format->transparent || !bg || !MS_VALID_COLOR(*bg)) {
r->use_alpha = 1;
cairo_set_source_rgba (r->cr, 0,0,0,0);
Expand Down

0 comments on commit bbd1fc2

Please sign in to comment.