diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2012-11-29 09:15:34 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2012-11-29 09:15:34 +0000 |
| commit | 773355863afe9b5ddb1afad277fe795b0d5d70b6 (patch) | |
| tree | 90e28a7ccb04b930d168ea39674f5365dc8aacaf /src | |
| parent | Fix for 1073128 : Command line PNG export fails if FeFlood filter primitive i... (diff) | |
| download | inkscape-773355863afe9b5ddb1afad277fe795b0d5d70b6.tar.gz inkscape-773355863afe9b5ddb1afad277fe795b0d5d70b6.zip | |
Fix for #955141: Converting clipped object to pattern produces rasterised pattern.
(bzr r11914)
Diffstat (limited to 'src')
| -rw-r--r-- | src/display/drawing-context.h | 2 | ||||
| -rw-r--r-- | src/display/drawing-item.cpp | 29 |
2 files changed, 29 insertions, 2 deletions
diff --git a/src/display/drawing-context.h b/src/display/drawing-context.h index fb6662202..b8c4667c2 100644 --- a/src/display/drawing-context.h +++ b/src/display/drawing-context.h @@ -101,6 +101,8 @@ public: cairo_t *raw() { return _ct; } cairo_surface_t *rawTarget() { return cairo_get_group_target(_ct); } + DrawingSurface *surface() { return _surface; } // Needed to find scale in drawing-item.cpp + private: DrawingContext(cairo_t *ct, DrawingSurface *surface, bool destroy); diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 0fb1f0018..b443ad22a 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -20,6 +20,7 @@ #include "nr-filter.h" #include "preferences.h" #include "style.h" +#include "2geom/rect.h" namespace Inkscape { @@ -540,8 +541,17 @@ DrawingItem::render(DrawingContext &ct, Geom::IntRect const &area, unsigned flag iarea.intersectWith(_drawbox); } - DrawingSurface intermediate(*iarea); + // Must use same scale factor between "logical space" (coordinates in the + // rendering) and "physical space" (surface pixels). See drawing-surface.cpp. + // See bug 955141. + // There must be a better lib2geom way of finding sarea. + DrawingSurface* ds = ct.surface(); + Geom::Scale scale = ds->scale(); + Geom::Rect rarea( *iarea ); + Geom::Point sarea( rarea.dimensions() * scale ); + DrawingSurface intermediate( *iarea, sarea.ceil() ); DrawingContext ict(intermediate); + unsigned render_result = RENDER_OK; // 1. Render clipping path with alpha = opacity. @@ -614,9 +624,24 @@ DrawingItem::render(DrawingContext &ct, Geom::IntRect const &area, unsigned flag cachect.fill(); _cache->markClean(*carea); } - ct.rectangle(*carea); + + ct.rectangle(*carea); // Area to be filled + + // Account for difference between logical and physical spaces. + ct.scale( intermediate.scale().inverse() ); + + // Must shift origin to compensate for scaling. + Geom::Point factor( Geom::Point(1,1) - intermediate.scale().vector() ); + Geom::Point origin( intermediate.origin() ); + Geom::Point shift( origin[Geom::X] * factor[Geom::X], origin[Geom::Y] * factor[Geom::Y] ); + ct.translate( -shift ); + ct.setSource(&intermediate); ct.fill(); + + ct.translate( shift ); + ct.scale( intermediate.scale() ); + ct.setSource(0,0,0,0); // the call above is to clear a ref on the intermediate surface held by ct |
