[gnome-color-manager] Use the new cd_icc_get_response() provided in colord 0.1.34



commit 6a54cbef89b71f5aed62a60635c139c80b579b37
Author: Richard Hughes <richard hughsie com>
Date:   Tue Apr 30 15:21:09 2013 +0100

    Use the new cd_icc_get_response() provided in colord 0.1.34

 src/gcm-utils.c  |  108 ------------------------------------------------------
 src/gcm-utils.h  |    2 -
 src/gcm-viewer.c |    2 +-
 3 files changed, 1 insertions(+), 111 deletions(-)
---
diff --git a/src/gcm-utils.c b/src/gcm-utils.c
index dfbe98f..fa49309 100644
--- a/src/gcm-utils.c
+++ b/src/gcm-utils.c
@@ -369,114 +369,6 @@ cd_icc_has_colorspace_description (CdProfile *profile)
        return FALSE;
 }
 
-/**
- * cd_icc_generate_curve:
- * @icc: A valid #CdIcc
- * @size: the size of the curve to generate
- *
- * Generates a curve of a specified size.
- *
- * Return value: A #GPtrArray object, or %NULL. Free with g_object_unref()
- **/
-GPtrArray *
-cd_icc_generate_curve (CdIcc *icc, guint size)
-{
-       gdouble *values_in = NULL;
-       gdouble *values_out = NULL;
-       guint i;
-       CdColorRGB *data;
-       GPtrArray *array = NULL;
-       gfloat divamount;
-       gfloat divadd;
-       guint component_width;
-       cmsHPROFILE srgb_profile = NULL;
-       cmsHTRANSFORM transform = NULL;
-       guint type;
-       CdColorspace colorspace;
-       gdouble tmp;
-       cmsHPROFILE lcms_profile;
-
-       /* run through the icc */
-       colorspace = cd_icc_get_colorspace (icc);
-       if (colorspace == CD_COLORSPACE_RGB) {
-
-               /* RGB */
-               component_width = 3;
-               type = TYPE_RGB_DBL;
-
-               /* create input array */
-               values_in = g_new0 (gdouble, size * 3 * component_width);
-               divamount = 1.0f / (gfloat) (size - 1);
-               for (i = 0; i < size; i++) {
-                       divadd = divamount * (gfloat) i;
-
-                       /* red component */
-                       values_in[(i * 3 * component_width)+0] = divadd;
-                       values_in[(i * 3 * component_width)+1] = 0.0f;
-                       values_in[(i * 3 * component_width)+2] = 0.0f;
-
-                       /* green component */
-                       values_in[(i * 3 * component_width)+3] = 0.0f;
-                       values_in[(i * 3 * component_width)+4] = divadd;
-                       values_in[(i * 3 * component_width)+5] = 0.0f;
-
-                       /* blue component */
-                       values_in[(i * 3 * component_width)+6] = 0.0f;
-                       values_in[(i * 3 * component_width)+7] = 0.0f;
-                       values_in[(i * 3 * component_width)+8] = divadd;
-               }
-       }
-
-       /* do each transform */
-       if (values_in != NULL) {
-               /* create output array */
-               values_out = g_new0 (gdouble, size * 3 * component_width);
-
-               /* create a transform from icc to sRGB */
-               srgb_profile = cmsCreate_sRGBProfile ();
-               lcms_profile = cd_icc_get_handle (icc);
-               transform = cmsCreateTransform (lcms_profile, type, srgb_profile, TYPE_RGB_DBL, 
INTENT_PERCEPTUAL, 0);
-               if (transform == NULL)
-                       goto out;
-
-               /* do transform */
-               cmsDoTransform (transform, values_in, values_out, size * 3);
-
-               /* create output array */
-               array = g_ptr_array_new_with_free_func (g_free);
-
-               for (i = 0; i < size; i++) {
-                       data = g_new0 (CdColorRGB, 1);
-
-                       /* default values */
-                       data->R = 0.0f;
-                       data->G = 0.0f;
-                       data->B = 0.0f;
-
-                       /* only save curve data if it is positive */
-                       tmp = values_out[(i * 3 * component_width)+0];
-                       if (tmp > 0.0f)
-                               data->R = tmp;
-                       tmp = values_out[(i * 3 * component_width)+4];
-                       if (tmp > 0.0f)
-                               data->G = tmp;
-                       tmp = values_out[(i * 3 * component_width)+8];
-                       if (tmp > 0.0f)
-                               data->B = tmp;
-                       g_ptr_array_add (array, data);
-               }
-       }
-
-out:
-       g_free (values_in);
-       g_free (values_out);
-       if (transform != NULL)
-               cmsDeleteTransform (transform);
-       if (srgb_profile != NULL)
-               cmsCloseProfile (srgb_profile);
-       return array;
-}
-
 #define HYP(a,b)               (sqrt((a)*(a) + (b)*(b)))
 
 /**
diff --git a/src/gcm-utils.h b/src/gcm-utils.h
index 4f67491..cdf3897 100644
--- a/src/gcm-utils.h
+++ b/src/gcm-utils.h
@@ -50,8 +50,6 @@ gboolean       gcm_utils_install_package              (const gchar            *package_name,
 gchar          *gcm_utils_linkify                      (const gchar            *text);
 const gchar    *cd_colorspace_to_localised_string      (CdColorspace            colorspace);
 gboolean        cd_icc_has_colorspace_description      (CdProfile              *profile);
-GPtrArray      *cd_icc_generate_curve                  (CdIcc                  *icc,
-                                                        guint                   size);
 GcmHull                *cd_icc_generate_gamut_hull             (CdIcc                  *icc,
                                                         guint                   res);
 
diff --git a/src/gcm-viewer.c b/src/gcm-viewer.c
index e7af7b1..db661e1 100644
--- a/src/gcm-viewer.c
+++ b/src/gcm-viewer.c
@@ -1053,7 +1053,7 @@ gcm_viewer_set_profile (GcmViewerPrivate *viewer, CdProfile *profile)
 
        /* get curve data */
        widget = GTK_WIDGET (gtk_builder_get_object (viewer->builder, "vbox_trc"));
-       clut_trc = cd_icc_generate_curve (icc, 256);
+       clut_trc = cd_icc_get_response (icc, 256, NULL);
        if (clut_trc != NULL) {
                g_object_set (viewer->trc_widget,
                              "data", clut_trc,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]