summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3631c75)
raw | patch | inline | side by side (parent: 3631c75)
author | joncruz <joncruz@users.sourceforge.net> | |
Thu, 6 Apr 2006 16:30:05 +0000 (16:30 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Thu, 6 Apr 2006 16:30:05 +0000 (16:30 +0000) |
ChangeLog | patch | blob | history | |
src/color-profile.cpp | patch | blob | history | |
src/sp-image.cpp | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index a294cdd208574cd872153109ae883949a4fda05a..de6d422555559258e8f4047708660fd2c8ec8bf4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2006-04-06 Jon A. Cruz <jon@joncruz.org>
+
+ * src/color-profile.cpp, src/sp-image.cpp:
+
+ Simple debugging #ifdefs added.
+
2006-04-06 Jon A. Cruz <jon@joncruz.org>
* src/interface.cpp, src/dialogs/clonetiler.cpp,
diff --git a/src/color-profile.cpp b/src/color-profile.cpp
index 7b03c77736d7ea540c088e034a1c4d77ff836496..76137e3aba4969f3c291f8cf6f4dd452fb30bb53 100644 (file)
--- a/src/color-profile.cpp
+++ b/src/color-profile.cpp
#include "attributes.h"
#include "document.h"
+//#define DEBUG_LCMS
+
+#ifdef DEBUG_LCMS
+#include "prefs-utils.h"
+#include <gtk/gtkmessagedialog.h>
+#endif // DEBUG_LCMS
+
using Inkscape::ColorProfile;
using Inkscape::ColorProfileClass;
static Inkscape::XML::Node *colorprofile_write( SPObject *object, Inkscape::XML::Node *repr, guint flags );
}
+#ifdef DEBUG_LCMS
+extern guint update_in_progress;
+#define DEBUG_MESSAGE(key, ...) \
+{\
+ gint dump = prefs_get_int_attribute_limited("options.scislac", #key, 0, 0, 1);\
+ gint dumpD = prefs_get_int_attribute_limited("options.scislac", #key"D", 0, 0, 1);\
+ gint dumpD2 = prefs_get_int_attribute_limited("options.scislac", #key"D2", 0, 0, 1);\
+ dumpD &= ( (update_in_progress == 0) || dumpD2 );\
+ if ( dump )\
+ {\
+ g_message( __VA_ARGS__ );\
+\
+ }\
+ if ( dumpD )\
+ {\
+ GtkWidget *dialog = gtk_message_dialog_new(NULL,\
+ GTK_DIALOG_DESTROY_WITH_PARENT, \
+ GTK_MESSAGE_INFO, \
+ GTK_BUTTONS_OK, \
+ __VA_ARGS__ \
+ );\
+ g_signal_connect_swapped(dialog, "response",\
+ G_CALLBACK(gtk_widget_destroy), \
+ dialog); \
+ gtk_widget_show_all( dialog );\
+ }\
+}
+#endif // DEBUG_LCMS
+
static SPObject *cprof_parent_class;
/**
@@ -154,13 +190,18 @@ static void Inkscape::colorprofile_set( SPObject *object, unsigned key, gchar co
if ( !g_path_is_absolute(cprof->href) ) {
// Try to open relative
gchar* docbase = SP_DOCUMENT_BASE( SP_OBJECT_DOCUMENT(object) );
- gchar* fullname = g_build_filename( docbase ? docbase : ".", cprof->href, NULL );
+ gchar* fullname = g_build_filename( docbase ? docbase : ".", cprof->href, NULL );
cprof->profHandle = cmsOpenProfileFromFile( fullname, "r" );
-
- g_free (fullname);
+#ifdef DEBUG_LCMS
+ DEBUG_MESSAGE( lcmsOne, "cmsOpenProfileFromFile( '%s'...) = %p", fullname, (void*)cprof->profHandle );
+#endif // DEBUG_LCMS
+ g_free (fullname);
} else {
cprof->profHandle = cmsOpenProfileFromFile( cprof->href, "r" );
+#ifdef DEBUG_LCMS
+ DEBUG_MESSAGE( lcmsOne, "cmsOpenProfileFromFile( '%s'...) = %p", cprof->href, (void*)cprof->profHandle );
+#endif // DEBUG_LCMS
}
#endif // ENABLE_LCMS
@@ -184,6 +225,9 @@ static void Inkscape::colorprofile_set( SPObject *object, unsigned key, gchar co
cprof->name = 0;
}
cprof->name = g_strdup( value );
+#ifdef DEBUG_LCMS
+ DEBUG_MESSAGE( lcmsTwo, "<color-profile> name set to '%s'", cprof->name );
+#endif // DEBUG_LCMS
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
@@ -304,6 +348,10 @@ cmsHPROFILE Inkscape::colorprofile_get_handle( SPDocument* document, guint* inte
*intent = thing ? COLORPROFILE(thing)->rendering_intent : (guint)RENDERING_INTENT_UNKNOWN;
}
+#ifdef DEBUG_LCMS
+ DEBUG_MESSAGE( lcmsThree, "<color-profile> queried for profile of '%s'. Returning %p with intent of %d", name, prof, (intent? *intent:0) );
+#endif // DEBUG_LCMS
+
return prof;
}
#endif // ENABLE_LCMS
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index 83b623dbc80f4f7b1248f10bdeec569236cf9abc..5804089e687cf9efc1ef658cb01ab2274c574c73 100644 (file)
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
#if ENABLE_LCMS
#include "color-profile-fns.h"
#include "color-profile.h"
+//#define DEBUG_LCMS
+#ifdef DEBUG_LCMS
+#include "prefs-utils.h"
+#include <gtk/gtkmessagedialog.h>
+#endif // DEBUG_LCMS
#endif // ENABLE_LCMS
/*
* SPImage
}
+
+#ifdef DEBUG_LCMS
+extern guint update_in_progress;
+#define DEBUG_MESSAGE(key, ...) \
+{\
+ gint dump = prefs_get_int_attribute_limited("options.scislac", #key, 0, 0, 1);\
+ gint dumpD = prefs_get_int_attribute_limited("options.scislac", #key"D", 0, 0, 1);\
+ gint dumpD2 = prefs_get_int_attribute_limited("options.scislac", #key"D2", 0, 0, 1);\
+ dumpD &= ( (update_in_progress == 0) || dumpD2 );\
+ if ( dump )\
+ {\
+ g_message( __VA_ARGS__ );\
+\
+ }\
+ if ( dumpD )\
+ {\
+ GtkWidget *dialog = gtk_message_dialog_new(NULL,\
+ GTK_DIALOG_DESTROY_WITH_PARENT, \
+ GTK_MESSAGE_INFO, \
+ GTK_BUTTONS_OK, \
+ __VA_ARGS__ \
+ );\
+ g_signal_connect_swapped(dialog, "response",\
+ G_CALLBACK(gtk_widget_destroy), \
+ dialog); \
+ gtk_widget_show_all( dialog );\
+ }\
+}
+#endif // DEBUG_LCMS
+
namespace Inkscape {
namespace IO {
g_free (image->color_profile);
}
image->color_profile = (value) ? g_strdup (value) : NULL;
+#ifdef DEBUG_LCMS
+ if ( value ) {
+ DEBUG_MESSAGE( lcmsFour, "<image> color-profile set to '%s'", value );
+ } else {
+ DEBUG_MESSAGE( lcmsFour, "<image> color-profile cleared" );
+ }
+#endif // DEBUG_LCMS
// TODO check on this HREF_MODIFIED flag
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_IMAGE_HREF_MODIFIED_FLAG);
break;
guchar* px = gdk_pixbuf_get_pixels( pixbuf );
if ( px ) {
+#ifdef DEBUG_LCMS
+ DEBUG_MESSAGE( lcmsFive, "in <image>'s sp_image_update. About to call colorprofile_get_handle()" );
+#endif // DEBUG_LCMS
guint profIntent = Inkscape::RENDERING_INTENT_UNKNOWN;
cmsHPROFILE prof = Inkscape::colorprofile_get_handle( SP_OBJECT_DOCUMENT( object ),
&profIntent,
cmsDeleteTransform( transf );
}
+#ifdef DEBUG_LCMS
+ else
+ {
+ DEBUG_MESSAGE( lcmsSix, "in <image>'s sp_image_update. Unable to create LCMS transform." );
+ }
+#endif // DEBUG_LCMS
cmsCloseProfile( destProf );
}
+#ifdef DEBUG_LCMS
+ else
+ {
+ DEBUG_MESSAGE( lcmsSeven, "in <image>'s sp_image_update. Profile type is named color. Can't transform." );
+ }
+#endif // DEBUG_LCMS
+ }
+#ifdef DEBUG_LCMS
+ else
+ {
+ DEBUG_MESSAGE( lcmsEight, "in <image>'s sp_image_update. No profile found." );
}
+#endif // DEBUG_LCMS
}
}
#endif // ENABLE_LCMS