Code

apply printing w32 patch https://bugs.launchpad.net/inkscape/+bug/179988/comments/174
authortheadib <theadib@users.sourceforge.net>
Fri, 24 Apr 2009 10:37:51 +0000 (10:37 +0000)
committertheadib <theadib@users.sourceforge.net>
Fri, 24 Apr 2009 10:37:51 +0000 (10:37 +0000)
src/extension/internal/cairo-render-context.cpp
src/extension/internal/cairo-render-context.h
src/ui/dialog/print.cpp

index 656cd4a08956b40d5e4498060e2f6a2cdad5c126..e10b637f369d172b80e1021b5c375a05e55f7366 100644 (file)
@@ -780,20 +780,20 @@ CairoRenderContext::setupSurface(double width, double height)
 }
 
 bool
-CairoRenderContext::setSurfaceTarget(cairo_surface_t *surface, bool is_vector)
+CairoRenderContext::setSurfaceTarget(cairo_surface_t *surface, bool is_vector, cairo_matrix_t *ctm)
 {
     if (_is_valid || !surface)
         return false;
 
     _vector_based_target = is_vector;
-    bool ret = _finishSurfaceSetup (surface);
+    bool ret = _finishSurfaceSetup (surface, ctm);
     if (ret)
         cairo_surface_reference (surface);
     return ret;
 }
 
 bool
-CairoRenderContext::_finishSurfaceSetup(cairo_surface_t *surface)
+CairoRenderContext::_finishSurfaceSetup(cairo_surface_t *surface, cairo_matrix_t *ctm)
 {
     if(surface == NULL) {
         return FALSE;
@@ -803,6 +803,8 @@ CairoRenderContext::_finishSurfaceSetup(cairo_surface_t *surface)
     }
 
     _cr = cairo_create(surface);
+    if (ctm)
+        cairo_set_matrix(_cr, ctm);
     _surface = surface;
 
     if (_vector_based_target) {
index 23845598e18ffd53289111ce7cec0320ef0dbf27..930668e03b348b1749c08f1d302ee7f4b17dae22 100644 (file)
@@ -85,7 +85,7 @@ public:
     bool setPdfTarget(gchar const *utf8_fn);
     bool setPsTarget(gchar const *utf8_fn);
     /** Set the cairo_surface_t from an external source */
-    bool setSurfaceTarget(cairo_surface_t *surface, bool is_vector);
+    bool setSurfaceTarget(cairo_surface_t *surface, bool is_vector, cairo_matrix_t *ctm=NULL);
 
     void setPSLevel(unsigned int level);
     void setEPS(bool eps);
@@ -187,7 +187,7 @@ protected:
 
     unsigned int _showGlyphs(cairo_t *cr, PangoFont *font, std::vector<CairoGlyphInfo> const &glyphtext, bool is_stroke);
 
-    bool _finishSurfaceSetup(cairo_surface_t *surface);
+    bool _finishSurfaceSetup(cairo_surface_t *surface, cairo_matrix_t *ctm = NULL);
     void _setFillStyle(SPStyle const *style, NRRect const *pbox);
     void _setStrokeStyle(SPStyle const *style, NRRect const *pbox);
 
index bb2b5d68dd886e8cd9cafd31765a859709d1368d..890e0061c7f68c5b8b7bb4b81c5b537c441fcd28 100644 (file)
@@ -167,7 +167,10 @@ draw_page (GtkPrintOperation */*operation*/,
         }
 #endif
 
-        bool ret = ctx->setSurfaceTarget (surface, true);        if (ret) {
+        cairo_matrix_t ctm;
+        cairo_get_matrix(cr, &ctm);
+        bool ret = ctx->setSurfaceTarget (surface, true, &ctm);
+        if (ret) {
             ret = renderer.setupDocument (ctx, junk->_doc, TRUE, NULL);
             if (ret) {
                 renderer.renderItem(ctx, junk->_base);