Code

Merge and cleanup of GSoC C++-ification project.
[inkscape.git] / src / helper / png-write.cpp
index 5ccb6c7fac2533d68fd1754840ea5c5a9df93a0e..d3fe2771ff8d07970153b3b1427879a0d08a0977 100644 (file)
@@ -1,11 +1,11 @@
-#define __SP_PNG_WRITE_C__
-
 /*
  * PNG file format utilities
  *
  * Authors:
  *   Lauris Kaplinski <lauris@kaplinski.com>
  *   Whoever wrote this example in libpng documentation
+ *   Jon A. Cruz <jon@joncruz.org>
+ *   Abhishek Sharma
  *
  * Copyright (C) 1999-2002 authors
  *
@@ -362,8 +362,7 @@ sp_export_get_rows(guchar const **rows, int row, int num_rows, void *data)
 /**
  * Hide all items that are not listed in list, 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, GSList *list, unsigned dkey)
 {
     if ( SP_IS_ITEM(o)
          && !SP_IS_DEFS(o)
@@ -376,7 +375,7 @@ hide_other_items_recursively(SPObject *o, GSList *list, unsigned dkey)
 
     // recurse
     if (!g_slist_find(list, o)) {
-        for (SPObject *child = o->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
+        for ( SPObject *child = o->firstChild() ; child; child = child->getNext() ) {
             hide_other_items_recursively(child, list, dkey);
         }
     }
@@ -422,7 +421,7 @@ sp_export_png_file(SPDocument *doc, gchar const *filename,
         return true;
     }
 
-    doc->ensure_up_to_date();
+    doc->ensureUpToDate();
 
     /* Calculate translation by transforming to document coordinates (flipping Y)*/
     Geom::Point translation = Geom::Point(-area[Geom::X][0], area[Geom::Y][1] - doc->getHeight());
@@ -464,13 +463,13 @@ sp_export_png_file(SPDocument *doc, gchar const *filename,
     unsigned const dkey = SPItem::display_key_new(1);
 
     /* Create ArenaItems and set transform */
-    ebp.root = SP_ITEM(sp_document_root(doc))->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY);
+    ebp.root = SP_ITEM(doc->getRoot())->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY);
     nr_arena_item_set_transform(NR_ARENA_ITEM(ebp.root), affine);
 
     // 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(sp_document_root(doc), items_only, dkey);
+        hide_other_items_recursively(doc->getRoot(), items_only, dkey);
     }
 
     ebp.status = status;
@@ -490,7 +489,7 @@ sp_export_png_file(SPDocument *doc, gchar const *filename,
     }
 
     // Hide items, this releases arenaitem
-    SP_ITEM(sp_document_root(doc))->invoke_hide(dkey);
+    SP_ITEM(doc->getRoot())->invoke_hide(dkey);
 
     /* Free arena */
     nr_object_unref((NRObject *) arena);
@@ -508,4 +507,4 @@ sp_export_png_file(SPDocument *doc, gchar const *filename,
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :