diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-11-03 00:10:02 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-11-03 00:10:02 +0000 |
| commit | d2df0412f728dd5bb54537dfdfe7c35b34d40e0e (patch) | |
| tree | e2703384779e83312c456399999997fcc289c5cf /src/helper/pixbuf-ops.cpp | |
| parent | Merge branch 'master' into powerpencil (diff) | |
| parent | change assignment to equality (diff) | |
| download | inkscape-d2df0412f728dd5bb54537dfdfe7c35b34d40e0e.tar.gz inkscape-d2df0412f728dd5bb54537dfdfe7c35b34d40e0e.zip | |
Merge branch 'master' into powerpencil
Diffstat (limited to 'src/helper/pixbuf-ops.cpp')
| -rw-r--r-- | src/helper/pixbuf-ops.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index bb33f7b15..8d7202111 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -15,7 +15,6 @@ #include <config.h> #endif -#include <boost/scoped_ptr.hpp> #include <2geom/transforms.h> #include "ui/interface.h" @@ -34,9 +33,9 @@ // TODO look for copy-n-paste duplication of this function: /** - * Hide all items that are not listed in list, recursively, skipping groups and defs. + * Hide all items except @item, recursively, skipping groups and defs. */ -static void hide_other_items_recursively(SPObject *o, GSList *list, unsigned dkey) +static void hide_other_items_recursively(SPObject *o, SPItem *i, unsigned dkey) { SPItem *item = dynamic_cast<SPItem *>(o); if ( item @@ -44,15 +43,15 @@ static void hide_other_items_recursively(SPObject *o, GSList *list, unsigned dke && !dynamic_cast<SPRoot *>(item) && !dynamic_cast<SPGroup *>(item) && !dynamic_cast<SPUse *>(item) - && !g_slist_find(list, o) ) + && (i != o) ) { item->invoke_hide(dkey); } // recurse - if (!g_slist_find(list, o)) { + if (i != o) { for (auto& child: o->children) { - hide_other_items_recursively(&child, list, dkey); + hide_other_items_recursively(&child, i, dkey); } } } @@ -65,11 +64,11 @@ static void hide_other_items_recursively(SPObject *o, GSList *list, unsigned dke bool sp_export_jpg_file(SPDocument *doc, gchar const *filename, double x0, double y0, double x1, double y1, unsigned width, unsigned height, double xdpi, double ydpi, - unsigned long bgcolor, double quality,GSList *items) + unsigned long bgcolor, double quality, SPItem* item) { - boost::scoped_ptr<Inkscape::Pixbuf> pixbuf( + std::unique_ptr<Inkscape::Pixbuf> pixbuf( sp_generate_internal_bitmap(doc, filename, x0, y0, x1, y1, - width, height, xdpi, ydpi, bgcolor, items)); + width, height, xdpi, ydpi, bgcolor, item)); gchar c[32]; g_snprintf(c, 32, "%f", quality); @@ -78,6 +77,7 @@ bool sp_export_jpg_file(SPDocument *doc, gchar const *filename, return saved; } + /** generates a bitmap from given items the bitmap is stored in RAM and not written to file @@ -95,7 +95,7 @@ Inkscape::Pixbuf *sp_generate_internal_bitmap(SPDocument *doc, gchar const */*fi double x0, double y0, double x1, double y1, unsigned width, unsigned height, double xdpi, double ydpi, unsigned long /*bgcolor*/, - GSList *items_only) + SPItem *item_only) { if (width == 0 || height == 0) return NULL; @@ -128,8 +128,8 @@ Inkscape::Pixbuf *sp_generate_internal_bitmap(SPDocument *doc, gchar const */*fi // 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 - if (items_only) { - hide_other_items_recursively(doc->getRoot(), items_only, dkey); + if (item_only) { + hide_other_items_recursively(doc->getRoot(), item_only, dkey); } Geom::IntRect final_bbox = Geom::IntRect::from_xywh(0, 0, width, height); |
