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/helper/png-write.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/helper/png-write.cpp')
| -rw-r--r-- | src/helper/png-write.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index 7812969a0..24da697c1 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -23,9 +23,9 @@ #include <png.h> #include "png-write.h" #include "io/sys.h" +#include "display/drawing.h" #include "display/drawing-context.h" #include "display/drawing-item.h" -#include "display/nr-arena.h" #include "document.h" #include "sp-item.h" #include "sp-root.h" @@ -51,7 +51,7 @@ static unsigned int const MAX_STRIPE_SIZE = 1024*1024; struct SPEBP { unsigned long int width, height, sheight; guint32 background; - Inkscape::DrawingItem *root; // the root arena item to show; it is assumed that all unneeded items are hidden + Inkscape::Drawing *drawing; // it is assumed that all unneeded items are hidden guchar *px; unsigned (*status)(float, void *); void *data; @@ -326,8 +326,7 @@ sp_export_get_rows(guchar const **rows, void **to_free, int row, int num_rows, v Geom::IntRect bbox = Geom::IntRect::from_xywh(0, row, ebp->width, num_rows); /* Update to renderable state */ - Inkscape::UpdateContext ctx; - ebp->root->update(bbox, ctx, Inkscape::DrawingItem::STATE_ALL, 0); + ebp->drawing->update(bbox); int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, ebp->width); unsigned char *px = g_new(guchar, num_rows * stride); @@ -341,7 +340,7 @@ sp_export_get_rows(guchar const **rows, void **to_free, int row, int num_rows, v ct.setOperator(CAIRO_OPERATOR_OVER); /* Render */ - ebp->root->render(ct, bbox, 0); + ebp->drawing->render(ct, bbox); cairo_surface_destroy(s); *to_free = px; @@ -451,15 +450,15 @@ sp_export_png_file(SPDocument *doc, gchar const *filename, ebp.height = height; ebp.background = bgcolor; - /* Create new arena */ - NRArena *const arena = NRArena::create(); - // export with maximum blur rendering quality - nr_arena_set_renderoffscreen(arena); + /* Create new drawing */ + Inkscape::Drawing drawing; + drawing.setExact(true); // export with maximum blur rendering quality unsigned const dkey = SPItem::display_key_new(1); // Create ArenaItems and set transform - ebp.root = doc->getRoot()->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY); - ebp.root->setTransform(affine); + drawing.setRoot(doc->getRoot()->invoke_show(drawing, dkey, SP_ITEM_SHOW_DISPLAY)); + drawing.root()->setTransform(affine); + ebp.drawing = &drawing; // We show all and then hide all items we don't want, instead of showing only requested items, // because that would not work if the shown item references something in defs @@ -483,9 +482,6 @@ sp_export_png_file(SPDocument *doc, gchar const *filename, // Hide items, this releases arenaitem doc->getRoot()->invoke_hide(dkey); - /* Free arena */ - nr_object_unref((NRObject *) arena); - return write_status; } |
