Code

Merge and cleanup of GSoC C++-ification project.
[inkscape.git] / src / extension / internal / cairo-renderer.cpp
index 3c5cfc7c18934e85d6ed9d3111f42876a3837ec4..67f9354d8cac97085e57fc87b6f18d90cbc29df8 100644 (file)
@@ -1,11 +1,11 @@
-#define __SP_CAIRO_RENDERER_C__
-
 /** \file
  * Rendering with Cairo.
  */
 /*
  * Author:
  *   Miklos Erdelyi <erdelyim@gmail.com>
+ *   Jon A. Cruz <jon@joncruz.org>
+ *   Abhishek Sharma
  *
  * Copyright (C) 2006 Miklos Erdelyi
  *
@@ -191,6 +191,7 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx)
     SPStyle* style = SP_OBJECT_STYLE (item);
 
     Geom::PathVector const & pathv = shape->curve->get_pathvector();
+    if (pathv.empty()) return;
 
     ctx->renderPathVector(pathv, style, &pbox);
 
@@ -602,8 +603,9 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page
 
     g_assert( ctx != NULL );
 
-    if (!base)
-        base = SP_ITEM(sp_document_root(doc));
+    if (!base) {
+        base = SP_ITEM(doc->getRoot());
+    }
 
     NRRect d;
     if (pageBoundingBox) {
@@ -671,7 +673,7 @@ CairoRenderer::applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp)
 
     TRACE(("BEGIN clip\n"));
     SPObject *co = SP_OBJECT(cp);
-    for (SPObject *child = co->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
+    for ( SPObject *child = co->firstChild() ; child; child = child->getNext() ) {
         if (SP_IS_ITEM(child)) {
             SPItem *item = SP_ITEM(child);
 
@@ -729,7 +731,7 @@ CairoRenderer::applyMask(CairoRenderContext *ctx, SPMask const *mask)
 
     TRACE(("BEGIN mask\n"));
     SPObject *co = SP_OBJECT(mask);
-    for (SPObject *child = co->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
+    for ( SPObject *child = co->firstChild() ; child; child = child->getNext() ) {
         if (SP_IS_ITEM(child)) {
             SPItem *item = SP_ITEM(child);
             renderItem(ctx, item);
@@ -812,4 +814,4 @@ calculatePreserveAspectRatio(unsigned int aspect_align, unsigned int aspect_clip
   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 :