Update of /cvsroot/ufraw/ufraw
In directory vz-cvs-3.sog:/tmp/cvs-serv11954

Modified Files:
        uf_gtk.cc 
Log Message:
Fix building UFRaw on MacOSX with Quartz.

Index: uf_gtk.cc
===================================================================
RCS file: /cvsroot/ufraw/ufraw/uf_gtk.cc,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- uf_gtk.cc   1 Jan 2012 15:30:20 -0000       1.29
+++ uf_gtk.cc   9 Jul 2012 00:45:12 -0000       1.30
@@ -136,48 +136,6 @@
         }
     }
 
-// Get the display ICC profile of the monitor associated with the widget.
-// For X display, uses the ICC profile specifications version 0.2 from
-// http://burtonini.com/blog/computers/xicc
-// Based on code from Gimp's modules/cdisplay_lcms.c
-#ifdef GDK_WINDOWING_QUARTZ
-    typedef struct {
-        guchar *data;
-        gsize   len;
-    } ProfileTransfer;
-
-    enum {
-        openReadSpool  = 1, /* start read data process         */
-        openWriteSpool = 2, /* start write data process        */
-        readSpool      = 3, /* read specified number of bytes  */
-        writeSpool     = 4, /* write specified number of bytes */
-        closeSpool     = 5  /* complete data transfer process  */
-    };
-
-    static OSErr _uf_lcms_flatten_profile(SInt32  command,
-                                          SInt32 *size, void *data, void 
*refCon)
-    {
-        ProfileTransfer *transfer = static_cast<ProfileTransfer*>(refCon);
-
-        switch (command) {
-            case openWriteSpool:
-                g_return_val_if_fail(transfer->data == NULL && transfer->len 
== 0, -1);
-                break;
-
-            case writeSpool:
-                transfer->data = static_cast<guchar*>(
-                                     g_realloc(transfer->data, transfer->len + 
*size));
-                memcpy(transfer->data + transfer->len, data, *size);
-                transfer->len += *size;
-                break;
-
-            default:
-                break;
-        }
-        return 0;
-    }
-#endif /* GDK_WINDOWING_QUARTZ */
-
 // On X11 the display profile can be embedded using the 'xicc' command.
     void uf_get_display_profile(GtkWidget *widget,
                                 guint8 **buffer, gint *buffer_size)
@@ -215,13 +173,17 @@
         if (prof == NULL)
             return;
 
-        ProfileTransfer transfer = { NULL, 0 };
-        Boolean foo;
-        CMFlattenProfile(prof, 0, _uf_lcms_flatten_profile, &transfer, &foo);
+        CFDataRef data;
+        data = CMProfileCopyICCData(NULL, prof);
         CMCloseProfile(prof);
 
-        *buffer = transfer.data;
-        *buffer_size = transfer.len;
+        UInt8 *tmp_buffer = (UInt8 *) g_malloc(CFDataGetLength(data));
+        CFDataGetBytes(data, CFRangeMake(0, CFDataGetLength(data)), 
tmp_buffer);
+
+        *buffer = (guint8 *) tmp_buffer;
+        *buffer_size = CFDataGetLength(data);
+
+        CFRelease(data);
 
 #elif defined G_OS_WIN32
         (void)widget;


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
ufraw-cvs mailing list
ufraw-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs

Reply via email to