diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2012-12-04 09:51:15 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2012-12-04 09:51:15 +0000 |
| commit | 2c6e21d9fd3945a73b3ed5d04a87fb16a90f7a8e (patch) | |
| tree | 52a0994d8a30aaa8f867073d1cd9ce575f490de8 /src/display/drawing-item.cpp | |
| parent | changes_2012-11_28.patch (diff) | |
| parent | wix installer: create msi filename from version sing in src/inkscape.rc, add ... (diff) | |
| download | inkscape-2c6e21d9fd3945a73b3ed5d04a87fb16a90f7a8e.tar.gz inkscape-2c6e21d9fd3945a73b3ed5d04a87fb16a90f7a8e.zip | |
merge from trunk (r11929)
[win32] Please update to latest devlibs for Windows (r41)
(bzr r11668.1.44)
Diffstat (limited to 'src/display/drawing-item.cpp')
| -rw-r--r-- | src/display/drawing-item.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
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 |
