index 11624af70a4dd1d2feec2a6d594acd98e928a7e3..ca3a995616d6cdba73480d79e0f16899569fc76b 100644 (file)
/* Authors:
* Joel Holdsworth
* The Inkscape Organization
+ * Abhishek Sharma
*
* Copyright (C) 2004-2008 The Inkscape Organization
*
int sanitizeWindowSizeParam( int size, int delta, int minimum, int fallback )
{
int result = size;
- if ( size < lower ) {
+ if ( size < minimum ) {
g_warning( "Window size %d is less than cutoff.", size );
result = fallback - delta;
}
gchar *utf8string = g_utf16_to_utf8((const gunichar2*)_path_string,
_MAX_PATH, NULL, NULL, NULL);
- SPDocument *svgDoc = sp_document_new (utf8string, true);
+ SPDocument *svgDoc = SPDocument::createNewDoc (utf8string, true);
g_free(utf8string);
// Check the document loaded properly
if(svgDoc == NULL) return false;
if(svgDoc->root == NULL)
{
- sp_document_unref(svgDoc);
+ svgDoc->doUnref();
return false;
}
// Get the size of the document
- const double svgWidth = sp_document_width(svgDoc);
- const double svgHeight = sp_document_height(svgDoc);
+ const double svgWidth = svgDoc->getWidth();
+ const double svgHeight = svgDoc->getHeight();
// Find the minimum scale to fit the image inside the preview area
const double scaleFactorX = PreviewSize / svgWidth;
// write object bbox to area
Geom::OptRect maybeArea(area);
- sp_document_ensure_up_to_date (svgDoc);
- sp_item_invoke_bbox((SPItem *) svgDoc->root, maybeArea,
- sp_item_i2d_affine((SPItem *)(svgDoc->root)), TRUE);
+ svgDoc->ensureUpToDate();
+ static_cast<SPItem *>(svgDoc->root)->invoke_bbox( maybeArea,
+ static_cast<SPItem *>(svgDoc->root)->i2d_affine(), TRUE);
NRArena *const arena = NRArena::create();
- unsigned const key = sp_item_display_key_new(1);
+ unsigned const key = SPItem::display_key_new(1);
- NRArenaItem *root = sp_item_invoke_show((SPItem*)(svgDoc->root),
+ NRArenaItem *root = static_cast<SPItem*>(svgDoc->root)->invoke_show(
arena, key, SP_ITEM_SHOW_DISPLAY);
NRGC gc(NULL);
// Fail if the pixblock failed to allocate
if(pixBlock.data.px == NULL)
{
- sp_document_unref(svgDoc);
+ svgDoc->doUnref();
return false;
}
nr_arena_item_invoke_render(NULL, root, &bbox, &pixBlock, /*0*/NR_ARENA_ITEM_RENDER_NO_CACHE);
// Tidy up
- sp_document_unref(svgDoc);
- sp_item_invoke_hide((SPItem*)(svgDoc->root), key);
+ svgDoc->doUnref();
+ static_cast<SPItem*>(svgDoc->root)->invoke_hide(key);
nr_object_unref((NRObject *) arena);
// Create the GDK pixbuf
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 :