From 8867de5daf309e4cdd3fce177b408618490be4f3 Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Tue, 29 Jun 2010 23:35:42 +0530 Subject: This is the first c++ification commit from me. It handles sp-line, sp-polyline, sp-item and marks the onset of document c++ification as well. Users can check performace increase with [/usr/bin/time -v inkscape_binary_with_commandline_options]. (bzr r9546.1.1) --- src/widgets/icon.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/widgets/icon.cpp') diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index 5d91d3532..e90cc1c46 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -918,7 +918,7 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, SPObject *object = doc->getObjectById(name); if (object && SP_IS_ITEM(object)) { /* Find bbox in document */ - Geom::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object))); + Geom::Matrix const i2doc(SP_ITEM(object)->i2doc_affine()); Geom::OptRect dbox = SP_ITEM(object)->getBounds(i2doc); if ( SP_OBJECT_PARENT(object) == NULL ) @@ -1105,7 +1105,7 @@ static guchar *load_svg_pixels(gchar const *name, /* Try to load from document. */ if (!info && Inkscape::IO::file_test( doc_filename, G_FILE_TEST_IS_REGULAR ) && - (doc = sp_document_new( doc_filename, FALSE )) ) { + (doc = SPDocument::createDoc( doc_filename, FALSE )) ) { //g_message("Loaded icon file %s", doc_filename); // prep the document @@ -1113,7 +1113,7 @@ static guchar *load_svg_pixels(gchar const *name, /* Create new arena */ NRArena *arena = NRArena::create(); /* Create ArenaItem and set transform */ - unsigned visionkey = sp_item_display_key_new(1); + unsigned visionkey = SPItem::display_key_new(1); /* fixme: Memory manage root if needed (Lauris) */ // This needs to be fixed indeed; this leads to a memory leak of a few megabytes these days // because shapes are being rendered which are not being freed @@ -1135,8 +1135,7 @@ static guchar *load_svg_pixels(gchar const *name, ==7014== by 0x5E9DDE: nr_arena_group_render(_cairo*, NRArenaItem*, NRRectL*, NRPixBlock*, unsigned int) (nr-arena-group.cpp:228) ==7014== by 0x5E72FB: nr_arena_item_invoke_render(_cairo*, NRArenaItem*, NRRectL const*, NRPixBlock*, unsigned int) (nr-arena-item.cpp:578) */ - root = sp_item_invoke_show( SP_ITEM(SP_DOCUMENT_ROOT(doc)), - arena, visionkey, SP_ITEM_SHOW_DISPLAY ); + root = SP_ITEM(SP_DOCUMENT_ROOT(doc))->invoke_show(arena, visionkey, SP_ITEM_SHOW_DISPLAY ); // store into the cache info = new svg_doc_cache_t; -- cgit v1.2.3 From 121815791be2d24cb745663520b111ee914fbc09 Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Thu, 1 Jul 2010 15:36:56 +0530 Subject: C++fied SPDocument added (bzr r9546.1.2) --- src/widgets/icon.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/widgets/icon.cpp') diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index e90cc1c46..570502253 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -924,7 +924,7 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, if ( SP_OBJECT_PARENT(object) == NULL ) { dbox = Geom::Rect(Geom::Point(0, 0), - Geom::Point(sp_document_width(doc), sp_document_height(doc))); + Geom::Point(doc->getWidth(), doc->getHeight())); } /* This is in document coordinates, i.e. pixels */ @@ -1105,11 +1105,11 @@ static guchar *load_svg_pixels(gchar const *name, /* Try to load from document. */ if (!info && Inkscape::IO::file_test( doc_filename, G_FILE_TEST_IS_REGULAR ) && - (doc = SPDocument::createDoc( doc_filename, FALSE )) ) { + (doc = SPDocument::createNewDoc( doc_filename, FALSE )) ) { //g_message("Loaded icon file %s", doc_filename); // prep the document - sp_document_ensure_up_to_date(doc); + doc->ensure_up_to_date(); /* Create new arena */ NRArena *arena = NRArena::create(); /* Create ArenaItem and set transform */ -- cgit v1.2.3 From 75684fbe34e2f04c36f9e5ad7e7931286e755d38 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Mon, 6 Dec 2010 00:21:18 -0800 Subject: Stop background rendering once crash handler is triggered. (bzr r9940) --- src/widgets/icon.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/widgets/icon.cpp') diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index f9d01113e..c25e6aac2 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -219,7 +219,7 @@ void sp_icon_fetch_pixbuf( SPIcon *icon ) } } -static GdkPixbuf* renderup( gchar const* name, Inkscape::IconSize lsize, unsigned psize ) { +GdkPixbuf* renderup( gchar const* name, Inkscape::IconSize lsize, unsigned psize ) { GtkIconTheme *theme = gtk_icon_theme_get_default(); GdkPixbuf *pb = 0; @@ -1184,7 +1184,8 @@ void Inkscape::queueIconPrerender( Glib::ustring const &name, Inkscape::IconSize { GtkStockItem stock; gboolean stockFound = gtk_stock_lookup( name.c_str(), &stock ); - if (!stockFound && !gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), name.c_str()) ) { + gboolean themedFound = gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), name.c_str()); + if (!stockFound && !themedFound ) { gint trySize = CLAMP( static_cast(lsize), 0, static_cast(G_N_ELEMENTS(iconSizeLookup) - 1) ); if ( !sizeMapDone ) { injectCustomSize(); @@ -1349,7 +1350,9 @@ static void addPreRender( GtkIconSize lsize, gchar const *name ) } gboolean icon_prerender_task(gpointer /*data*/) { - if (!pendingRenders.empty()) { + if ( inkscapeIsCrashing() ) { + // stop + } else if (!pendingRenders.empty()) { bool workDone = false; do { preRenderItem single = pendingRenders.front(); @@ -1359,7 +1362,7 @@ gboolean icon_prerender_task(gpointer /*data*/) { } while (!pendingRenders.empty() && !workDone); } - if (!pendingRenders.empty()) { + if (!inkscapeIsCrashing() && !pendingRenders.empty()) { return TRUE; } else { callbackHooked = false; -- cgit v1.2.3