Author: post
Date: 2009-12-31 17:06:06 +0100 (Thu, 31 Dec 2009)
New Revision: 2958

Modified:
   branches/rawstudio-ng-color/plugins/dcp/dcp.c
Log:
Fix default tone curve.

Modified: branches/rawstudio-ng-color/plugins/dcp/dcp.c
===================================================================
--- branches/rawstudio-ng-color/plugins/dcp/dcp.c       2009-12-31 15:52:04 UTC 
(rev 2957)
+++ branches/rawstudio-ng-color/plugins/dcp/dcp.c       2009-12-31 16:06:06 UTC 
(rev 2958)
@@ -1066,11 +1066,21 @@
        /* ProfileToneCurve */
        dcp->tone_curve = rs_dcp_file_get_tonecurve(dcp_file);
        if (!dcp->tone_curve)
-               dcp->tone_curve = rs_spline_new(adobe_default_table, 
adobe_default_table_size / 2, NATURAL);
-       if (dcp->tone_curve)
-               dcp->tone_curve_lut = rs_spline_sample(dcp->tone_curve, NULL, 
65536);
-       /* FIXME: Free these at some point! */
+       {
+               gint i;
+               gint num_knots = adobe_default_table_size;
+               gfloat *knots = g_new0(gfloat, adobe_default_table_size * 2);
 
+               for(i = 0; i < adobe_default_table_size; i++)
+               {
+                       knots[i*2] = (gfloat)i / 
(gfloat)adobe_default_table_size;
+                       knots[i*2+1] = adobe_default_table[i];
+               }
+               dcp->tone_curve = rs_spline_new(knots, num_knots, NATURAL);
+               g_free(knots);
+       }
+       dcp->tone_curve_lut = rs_spline_sample(dcp->tone_curve, NULL, 65536);
+
        /* ForwardMatrix */
        dcp->has_forward_matrix1 = rs_dcp_file_get_forward_matrix1(dcp_file, 
&dcp->forward_matrix1);
        dcp->has_forward_matrix2 = rs_dcp_file_get_forward_matrix2(dcp_file, 
&dcp->forward_matrix2);


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to