[gnome-color-manager] Use the new cd_icc_get_vcgt() in colord 0.1.34
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Use the new cd_icc_get_vcgt() in colord 0.1.34
- Date: Tue, 30 Apr 2013 14:26:23 +0000 (UTC)
commit 3fa8af918f97f6a34d86803de43165067445a987
Author: Richard Hughes <richard hughsie com>
Date: Tue Apr 30 14:41:35 2013 +0100
Use the new cd_icc_get_vcgt() in colord 0.1.34
src/gcm-self-test.c | 11 -----------
src/gcm-utils.c | 48 ------------------------------------------------
src/gcm-utils.h | 2 --
src/gcm-viewer.c | 22 ++++++++++++++++++++++
4 files changed, 22 insertions(+), 61 deletions(-)
---
diff --git a/src/gcm-self-test.c b/src/gcm-self-test.c
index 10474be..51740bd 100644
--- a/src/gcm-self-test.c
+++ b/src/gcm-self-test.c
@@ -116,13 +116,6 @@ gcm_test_profile_func (void)
g_assert_no_error (error);
g_assert (ret);
g_object_unref (file);
-
- /* get CLUT */
- clut = cd_icc_generate_vcgt (profile, 256);
- g_assert (clut != NULL);
- g_assert_cmpint (gcm_clut_get_size (clut), ==, 256);
-
- g_object_unref (clut);
g_object_unref (profile);
/* get gamut hull */
@@ -514,10 +507,6 @@ gcm_test_trc_widget_func (void)
profile = cd_icc_new ();
file = g_file_new_for_path (TESTDATADIR "/AdobeGammaTest.icm");
cd_icc_load_file (profile, file, CD_ICC_LOAD_FLAGS_NONE, NULL, NULL);
- clut = cd_icc_generate_vcgt (profile, 256);
- g_object_set (widget,
- "clut", clut,
- NULL);
g_object_unref (file);
/* show in a dialog as an example */
diff --git a/src/gcm-utils.c b/src/gcm-utils.c
index f8790d8..07933a7 100644
--- a/src/gcm-utils.c
+++ b/src/gcm-utils.c
@@ -370,54 +370,6 @@ cd_icc_has_colorspace_description (CdProfile *profile)
}
/**
- * cd_icc_generate_vcgt:
- * @icc: A valid #CdIcc
- * @size: the size of the table to generate
- *
- * Generates a VCGT table of a specified size.
- *
- * Return value: A #GcmClut object, or %NULL. Free with g_object_unref()
- **/
-GcmClut *
-cd_icc_generate_vcgt (CdIcc *icc, guint size)
-{
- cmsFloat32Number in;
- cmsHPROFILE lcms_profile;
- const cmsToneCurve **vcgt;
- GcmClut *clut = NULL;
- GcmClutData *tmp;
- GPtrArray *array = NULL;
- guint i;
-
- /* get tone curves from icc */
- lcms_profile = cd_icc_get_handle (icc);
- vcgt = cmsReadTag (lcms_profile, cmsSigVcgtType);
- if (vcgt == NULL || vcgt[0] == NULL) {
- g_debug ("icc does not have any VCGT data");
- goto out;
- }
-
- /* create array */
- array = g_ptr_array_new_with_free_func (g_free);
- for (i = 0; i < size; i++) {
- in = (gdouble) i / (gdouble) (size - 1);
- tmp = g_new0 (GcmClutData, 1);
- tmp->red = cmsEvalToneCurveFloat(vcgt[0], in) * (gdouble) 0xffff;
- tmp->green = cmsEvalToneCurveFloat(vcgt[1], in) * (gdouble) 0xffff;
- tmp->blue = cmsEvalToneCurveFloat(vcgt[2], in) * (gdouble) 0xffff;
- g_ptr_array_add (array, tmp);
- }
-
- /* create new scaled CLUT */
- clut = gcm_clut_new ();
- gcm_clut_set_source_array (clut, array);
-out:
- if (array != NULL)
- g_ptr_array_unref (array);
- return clut;
-}
-
-/**
* cd_icc_generate_curve:
* @icc: A valid #CdIcc
* @size: the size of the curve to generate
diff --git a/src/gcm-utils.h b/src/gcm-utils.h
index 12a3ff9..d0e6a84 100644
--- a/src/gcm-utils.h
+++ b/src/gcm-utils.h
@@ -51,8 +51,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);
-GcmClut *cd_icc_generate_vcgt (CdIcc *profile,
- guint size);
GcmClut *cd_icc_generate_curve (CdIcc *icc,
guint size);
GcmHull *cd_icc_generate_gamut_hull (CdIcc *icc,
diff --git a/src/gcm-viewer.c b/src/gcm-viewer.c
index 3567c6e..da27a0f 100644
--- a/src/gcm-viewer.c
+++ b/src/gcm-viewer.c
@@ -975,6 +975,28 @@ cd_icc_warning_to_string (CdProfileWarning kind_enum)
}
/**
+ * cd_icc_generate_vcgt:
+ **/
+static GcmClut *
+cd_icc_generate_vcgt (CdIcc *icc, guint size)
+{
+ GcmClut *clut = NULL;
+ GPtrArray *array = NULL;
+
+ array = cd_icc_get_vcgt (icc, size, NULL);
+ if (array == NULL) {
+ g_debug ("icc does not have any VCGT data");
+ goto out;
+ }
+ clut = gcm_clut_new ();
+ gcm_clut_set_source_array (clut, array);
+out:
+ if (array != NULL)
+ g_ptr_array_unref (array);
+ return clut;
+}
+
+/**
* gcm_viewer_set_profile:
**/
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]