diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2011-08-07 10:53:12 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2011-08-07 10:53:12 +0000 |
| commit | 75976ea07dba9b97186667524d0a76603de416af (patch) | |
| tree | 4cb68dabb3cb7d5219e6ed6b660f0ded13fc25d3 /src/sp-pattern.cpp | |
| parent | Fix compilation (oops). (diff) | |
| download | inkscape-75976ea07dba9b97186667524d0a76603de416af.tar.gz inkscape-75976ea07dba9b97186667524d0a76603de416af.zip | |
Rewrite NRArena -> Inkscape::Drawing. Call render and update
methods on the Drawing rather than on the root DrawingItem.
(bzr r10347.1.25)
Diffstat (limited to 'src/sp-pattern.cpp')
| -rw-r--r-- | src/sp-pattern.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index 805a93267..9aefdf6ff 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -24,7 +24,7 @@ #include "display/cairo-utils.h" #include "display/drawing-context.h" #include "display/drawing-surface.h" -#include "display/nr-arena.h" +#include "display/drawing.h" #include "display/drawing-group.h" #include "attributes.h" #include "document-private.h" @@ -630,17 +630,18 @@ sp_pattern_create_pattern(SPPaintServer *ps, return cairo_pattern_create_rgba(0,0,0,0); } - /* Create arena */ - NRArena *arena = NRArena::create(); + /* Create drawing for rendering */ + Inkscape::Drawing drawing; unsigned int dkey = SPItem::display_key_new (1); - Inkscape::DrawingGroup *root = new Inkscape::DrawingGroup(arena); + Inkscape::DrawingGroup *root = new Inkscape::DrawingGroup(drawing); + drawing.setRoot(root); for (SPObject *child = shown->firstChild(); child != NULL; child = child->getNext() ) { if (SP_IS_ITEM (child)) { - // for each item in pattern, show it on our arena, add to the group, + // for each item in pattern, show it on our drawing, add to the group, // and connect to the release signal in case the item gets deleted Inkscape::DrawingItem *cai; - cai = SP_ITEM(child)->invoke_show (arena, dkey, SP_ITEM_SHOW_DISPLAY); + cai = SP_ITEM(child)->invoke_show (drawing, dkey, SP_ITEM_SHOW_DISPLAY); root->appendChild(cai); } } @@ -676,7 +677,10 @@ sp_pattern_create_pattern(SPPaintServer *ps, // oversample the pattern slightly // TODO: find optimum value - Geom::Point c(pattern_tile.dimensions()*ps2user.descrim()*full.descrim()*1.1); + // TODO: this is lame. instead of using descrim(), we should extract + // the scaling component from the complete matrix and use it + // to find the optimum tile size for rendering + Geom::Point c(pattern_tile.dimensions()*vb2ps.descrim()*ps2user.descrim()*full.descrim()*1.1); c[Geom::X] = ceil(c[Geom::X]); c[Geom::Y] = ceil(c[Geom::Y]); @@ -692,15 +696,13 @@ sp_pattern_create_pattern(SPPaintServer *ps, // TODO: make sure there are no leaks. Inkscape::UpdateContext ctx; ctx.ctm = vb2ps; - root->update(Geom::IntRect::infinite(), ctx, Inkscape::DrawingItem::STATE_ALL, 0); - root->render(ct, one_tile, 0); + drawing.update(Geom::IntRect::infinite(), ctx); + drawing.render(ct, one_tile); for (SPObject *child = shown->firstChild() ; child != NULL; child = child->getNext() ) { if (SP_IS_ITEM (child)) { SP_ITEM(child)->invoke_hide(dkey); } } - nr_object_unref(arena); - delete root; if (needs_opacity) { ct.popGroupToSource(); // pop raw pattern |
