summaryrefslogtreecommitdiffstats
path: root/src/widgets/icon.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-12-15 16:19:28 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-12-15 16:19:28 +0000
commit70201e92aa1e700d49279871f2b84082750b8ed8 (patch)
tree1886fcdf8ad20d73b92bf4f4bfd3ab1406ba4c66 /src/widgets/icon.cpp
parentFix mask luminance calculation, so the coeffs add up to 1 (diff)
parentWin32 post-GSoC fixups. (diff)
downloadinkscape-70201e92aa1e700d49279871f2b84082750b8ed8.tar.gz
inkscape-70201e92aa1e700d49279871f2b84082750b8ed8.zip
Merge from trunk (again)
(bzr r9508.1.72)
Diffstat (limited to 'src/widgets/icon.cpp')
-rw-r--r--src/widgets/icon.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index d039dd2de..1b6878c32 100644
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
@@ -5,6 +5,7 @@
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
* Jon A. Cruz <jon@joncruz.org>
+ * Abhishek Sharma
*
* Copyright (C) 2002 Lauris Kaplinski
*
@@ -220,7 +221,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;
@@ -920,13 +921,13 @@ 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 )
{
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 */
@@ -1113,15 +1114,15 @@ static guchar *load_svg_pixels(gchar const *name, unsigned psize, unsigned &stri
/* 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::createNewDoc( doc_filename, FALSE )) ) {
//g_message("Loaded icon file %s", doc_filename);
// prep the document
- sp_document_ensure_up_to_date(doc);
+ doc->ensureUpToDate();
/* 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
@@ -1143,8 +1144,7 @@ static guchar *load_svg_pixels(gchar const *name, unsigned psize, unsigned &stri
==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(doc->getRoot())->invoke_show(arena, visionkey, SP_ITEM_SHOW_DISPLAY );
// store into the cache
info = new svg_doc_cache_t;
@@ -1192,7 +1192,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<gint>(lsize), 0, static_cast<gint>(G_N_ELEMENTS(iconSizeLookup) - 1) );
if ( !sizeMapDone ) {
injectCustomSize();
@@ -1359,7 +1360,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();
@@ -1369,7 +1372,7 @@ gboolean icon_prerender_task(gpointer /*data*/) {
} while (!pendingRenders.empty() && !workDone);
}
- if (!pendingRenders.empty()) {
+ if (!inkscapeIsCrashing() && !pendingRenders.empty()) {
return TRUE;
} else {
callbackHooked = false;