Code

Merge and cleanup of GSoC C++-ification project.
[inkscape.git] / src / helper / pixbuf-ops.cpp
index b5630edd399b4be89c06ca1ee3b272a340e62391..69becad5dd421f83ed7a8bcad092680acd801045 100644 (file)
@@ -1,10 +1,10 @@
-#define __SP_PIXBUF_OPS_C__
-
 /*
  * Helpers for SPItem -> gdk_pixbuf related stuff
  *
  * Authors:
  *   John Cliff <simarilius@yahoo.com>
+ *   Jon A. Cruz <jon@joncruz.org>
+ *   Abhishek Sharma
  *
  * Copyright (C) 2008 John Cliff
  *
 
 #include "pixbuf-ops.h"
 
+// TODO look for copy-n-past duplication of this function:
 /**
  * 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)
@@ -56,7 +56,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);
         }
     }
@@ -106,7 +106,7 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/,
      nr_arena_set_renderoffscreen(arena);
      unsigned dkey = SPItem::display_key_new(1);
 
-     doc->ensure_up_to_date ();
+     doc->ensureUpToDate();
 
      Geom::Rect screen=Geom::Rect(Geom::Point(x0,y0), Geom::Point(x1, y1));
 
@@ -122,7 +122,7 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/,
      Geom::Matrix affine = scale * Geom::Translate(-origin * scale);
 
      /* Create ArenaItems and set transform */
-     NRArenaItem *root = SP_ITEM(sp_document_root(doc))->invoke_show( arena, dkey, SP_ITEM_SHOW_DISPLAY);
+     NRArenaItem *root = SP_ITEM(doc->getRoot())->invoke_show( arena, dkey, SP_ITEM_SHOW_DISPLAY);
      nr_arena_item_set_transform(NR_ARENA_ITEM(root), affine);
 
      NRGC gc(NULL);
@@ -131,7 +131,7 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/,
      // 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);
      }
 
      NRRectL final_bbox;
@@ -186,7 +186,7 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/,
     {
         g_warning("sp_generate_internal_bitmap: not enough memory to create pixel buffer. Need %lld.", size);
     }
-     SP_ITEM(sp_document_root(doc))->invoke_hide (dkey);
+     SP_ITEM(doc->getRoot())->invoke_hide(dkey);
      nr_object_unref((NRObject *) arena);
 
 //    gdk_pixbuf_save (pixbuf, "C:\\temp\\internal.jpg", "jpeg", NULL, "quality","100", NULL);
@@ -203,4 +203,4 @@ sp_generate_internal_bitmap(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 :