diff options
| author | Josh Andler <scislac@gmail.com> | 2009-09-27 17:31:38 +0000 |
|---|---|---|
| committer | scislac <scislac@users.sourceforge.net> | 2009-09-27 17:31:38 +0000 |
| commit | b8bb0a85a88308222a457c3d017a62eaa57c0524 (patch) | |
| tree | 2082fb82082895f583b797eba28e0067e422c57b /src/extension/internal/cairo-render-context.cpp | |
| parent | Revert patch from 168384 until after 0.47 (diff) | |
| download | inkscape-b8bb0a85a88308222a457c3d017a62eaa57c0524.tar.gz inkscape-b8bb0a85a88308222a457c3d017a62eaa57c0524.zip | |
Patch from Adrian for 437550.
(bzr r8658)
Diffstat (limited to 'src/extension/internal/cairo-render-context.cpp')
| -rw-r--r-- | src/extension/internal/cairo-render-context.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 364dfcfa8..cae496543 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -755,6 +755,8 @@ CairoRenderContext::setupSurface(double width, double height) _height = height; cairo_surface_t *surface = NULL; + cairo_matrix_t ctm; + cairo_matrix_init_identity (&ctm); switch (_target) { case CAIRO_SURFACE_TYPE_IMAGE: surface = cairo_image_surface_create(_target_format, (int)ceil(width), (int)ceil(height)); @@ -766,11 +768,19 @@ CairoRenderContext::setupSurface(double width, double height) #endif #ifdef CAIRO_HAS_PS_SURFACE case CAIRO_SURFACE_TYPE_PS: - surface = cairo_ps_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, width, height); -#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 5, 2)) + if (!_eps && width > height) { + surface = cairo_ps_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, height, width); + cairo_matrix_init (&ctm, 0, -1, 1, 0, 0, 0); + cairo_matrix_translate (&ctm, -width, 0); + cairo_ps_surface_dsc_begin_page_setup (surface); + cairo_ps_surface_dsc_comment (surface, "%%PageOrientation: Landscape"); + } else { + surface = cairo_ps_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, width, height); + } if(CAIRO_STATUS_SUCCESS != cairo_surface_status(surface)) { return FALSE; } +#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 5, 2)) cairo_ps_surface_restrict_to_level (surface, (cairo_ps_level_t)_ps_level); cairo_ps_surface_set_eps (surface, (cairo_bool_t) _eps); #endif @@ -781,7 +791,7 @@ CairoRenderContext::setupSurface(double width, double height) break; } - return _finishSurfaceSetup (surface); + return _finishSurfaceSetup (surface, &ctm); } bool |
