summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0faeab6)
raw | patch | inline | side by side (parent: 0faeab6)
author | joncruz <joncruz@users.sourceforge.net> | |
Mon, 3 Apr 2006 03:17:36 +0000 (03:17 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Mon, 3 Apr 2006 03:17:36 +0000 (03:17 +0000) |
src/sp-image.cpp | patch | blob | history |
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index d06db6231bccfb50990272f127257e7835b5ffcd..f9915031bb0cfdf37766efaf791a1bc9d0b6497e 100644 (file)
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
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;
}