summaryrefslogtreecommitdiffstats
path: root/src/sp-image.cpp
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2006-04-03 03:17:36 +0000
committerjoncruz <joncruz@users.sourceforge.net>2006-04-03 03:17:36 +0000
commit4bc384aaa5805e680f7277f6faff99b8e46d9b9e (patch)
tree3e562f805f35bf6f6a1ed6413378ce04977621fd /src/sp-image.cpp
parentFixed to handle relative file paths (diff)
downloadinkscape-4bc384aaa5805e680f7277f6faff99b8e46d9b9e.tar.gz
inkscape-4bc384aaa5805e680f7277f6faff99b8e46d9b9e.zip
Will not try to do image transform with named color profile
(bzr r404)
Diffstat (limited to 'src/sp-image.cpp')
-rw-r--r--src/sp-image.cpp62
1 files changed, 33 insertions, 29 deletions
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index d06db6231..f9915031b 100644
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
@@ -657,35 +657,39 @@ sp_image_update (SPObject *object, SPCtx *ctx, unsigned int flags)
pixbuf = sp_image_pixbuf_force_rgba (pixbuf);
// BLIP
#if ENABLE_LCMS
- if ( image->color_profile )
- {
- int imagewidth = gdk_pixbuf_get_width( pixbuf );
- int imageheight = gdk_pixbuf_get_height( pixbuf );
- int rowstride = gdk_pixbuf_get_rowstride( pixbuf );
- guchar* px = gdk_pixbuf_get_pixels( pixbuf );
-
- if ( px ) {
- cmsHPROFILE prof = Inkscape::colorprofile_get_handle( SP_OBJECT_DOCUMENT( object ), image->color_profile );
- if ( prof ) {
- cmsHPROFILE destProf = cmsCreate_sRGBProfile();
- cmsHTRANSFORM transf = cmsCreateTransform( prof,
- TYPE_RGBA_8,
- destProf,
- TYPE_RGBA_8,
- INTENT_PERCEPTUAL, 0 );
- guchar* currLine = px;
- for ( int y = 0; y < imageheight; y++ ) {
- // Since the types are the same size, we can do the transformation in-place
- cmsDoTransform( transf, currLine, currLine, imagewidth );
- currLine += rowstride;
- }
-
- if ( transf ) {
- cmsDeleteTransform( transf );
- }
- }
- }
- }
+ if ( image->color_profile )
+ {
+ int imagewidth = gdk_pixbuf_get_width( pixbuf );
+ int imageheight = gdk_pixbuf_get_height( pixbuf );
+ int rowstride = gdk_pixbuf_get_rowstride( pixbuf );
+ guchar* px = gdk_pixbuf_get_pixels( pixbuf );
+
+ if ( px ) {
+ cmsHPROFILE prof = Inkscape::colorprofile_get_handle( SP_OBJECT_DOCUMENT( object ), image->color_profile );
+ if ( prof ) {
+ icProfileClassSignature profileClass = cmsGetDeviceClass( prof );
+ if ( profileClass != icSigNamedColorClass ) {
+ cmsHPROFILE destProf = cmsCreate_sRGBProfile();
+ cmsHTRANSFORM transf = cmsCreateTransform( prof,
+ TYPE_RGBA_8,
+ destProf,
+ TYPE_RGBA_8,
+ INTENT_PERCEPTUAL, 0 );
+ if ( transf ) {
+ guchar* currLine = px;
+ for ( int y = 0; y < imageheight; y++ ) {
+ // Since the types are the same size, we can do the transformation in-place
+ cmsDoTransform( transf, currLine, currLine, imagewidth );
+ currLine += rowstride;
+ }
+
+ cmsDeleteTransform( transf );
+ }
+ cmsCloseProfile( destProf );
+ }
+ }
+ }
+ }
#endif // ENABLE_LCMS
image->pixbuf = pixbuf;
}