diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2012-12-13 04:17:37 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2012-12-13 04:17:37 +0000 |
| commit | 991279702f188995eaf339994394ba0ea4d9e7a6 (patch) | |
| tree | 4cda11330822097aae2cb256602343fe2a918f12 /src/display/drawing-item.cpp | |
| parent | preliminary release of the EMF import text reassembly feature. (diff) | |
| parent | Migrate document metadata from NotbookPage to Gtk::Grid and drop dead code (diff) | |
| download | inkscape-991279702f188995eaf339994394ba0ea4d9e7a6.tar.gz inkscape-991279702f188995eaf339994394ba0ea4d9e7a6.zip | |
merge from trunk (r11952)
(bzr r11668.1.46)
Diffstat (limited to 'src/display/drawing-item.cpp')
| -rw-r--r-- | src/display/drawing-item.cpp | 56 |
1 files changed, 13 insertions, 43 deletions
diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index b443ad22a..1e6e44d6f 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -20,7 +20,6 @@ #include "nr-filter.h" #include "preferences.h" #include "style.h" -#include "2geom/rect.h" namespace Inkscape { @@ -541,17 +540,8 @@ DrawingItem::render(DrawingContext &ct, Geom::IntRect const &area, unsigned flag iarea.intersectWith(_drawbox); } - // 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() ); + DrawingSurface intermediate(*iarea); DrawingContext ict(intermediate); - unsigned render_result = RENDER_OK; // 1. Render clipping path with alpha = opacity. @@ -624,24 +614,9 @@ DrawingItem::render(DrawingContext &ct, Geom::IntRect const &area, unsigned flag cachect.fill(); _cache->markClean(*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.rectangle(*carea); 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 @@ -692,29 +667,24 @@ DrawingItem::clip(Inkscape::DrawingContext &ct, Geom::IntRect const &area) if (!_visible) return; if (!area.intersects(_bbox)) return; - // The item used as the clipping path itself has a clipping path. - // Render this item's clipping path onto a temporary surface, then composite it - // with the item using the IN operator - if (_clip) { - ct.pushAlphaGroup(); - { Inkscape::DrawingContext::Save save(ct); - ct.setSource(0,0,0,1); - _clip->clip(ct, area); - } - ct.pushAlphaGroup(); - } - + ct.setSource(0,0,0,1); + ct.pushGroup(); // rasterize the clipping path _clipItem(ct, area); - if (_clip) { + // The item used as the clipping path itself has a clipping path. + // Render this item's clipping path onto a temporary surface, then composite it + // with the item using the IN operator + ct.pushGroup(); + _clip->clip(ct, area); ct.popGroupToSource(); ct.setOperator(CAIRO_OPERATOR_IN); ct.paint(); - ct.popGroupToSource(); - ct.setOperator(CAIRO_OPERATOR_SOURCE); - ct.paint(); } + ct.popGroupToSource(); + ct.setOperator(CAIRO_OPERATOR_OVER); + ct.paint(); + ct.setSource(0,0,0,0); } /** |
