annotate src/color-man.c @ 309:99139bf9f380

Use path_from_utf8() on the passed filename. Add const attribute.
author zas_
date Fri, 11 Apr 2008 14:27:55 +0000
parents 9995c5fb202a
children c4080362d619
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
1 /*
196
f6e307c7bad6 rename GQview -> Geeqie over the code
nadvornik
parents: 115
diff changeset
2 * Geeqie
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
3 * (C) 2006 John Ellis
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
4 *
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
5 * Author: John Ellis
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
6 *
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
7 * This software is released under the GNU General Public License (GNU GPL).
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
8 * Please read the included file COPYING for more information.
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
9 * This software comes with no warranty of any kind, use at your own risk!
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
10 */
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
11
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
12
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 196
diff changeset
13 #include "main.h"
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
14 #include "color-man.h"
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
15
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
16 #include "image.h"
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
17 #include "ui_fileops.h"
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
18
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
19
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
20 #ifdef HAVE_LCMS
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
21 /*** color support enabled ***/
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
22
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
23 #ifdef HAVE_LCMS_LCMS_H
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
24 #include <lcms/lcms.h>
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
25 #else
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
26 #include <lcms.h>
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
27 #endif
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
28
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
29
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
30 typedef struct _ColorManCache ColorManCache;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
31 struct _ColorManCache {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
32 cmsHPROFILE profile_in;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
33 cmsHPROFILE profile_out;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
34 cmsHTRANSFORM transform;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
35
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
36 ColorManProfileType profile_in_type;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
37 gchar *profile_in_file;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
38
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
39 ColorManProfileType profile_out_type;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
40 gchar *profile_out_file;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
41
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
42 gint has_alpha;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
43
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
44 gint refcount;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
45 };
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
46
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
47 /* pixels to transform per idle call */
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
48 #define COLOR_MAN_CHUNK_SIZE 81900
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
49
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
50
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
51 static void color_man_lib_init(void)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
52 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
53 static gint init_done = FALSE;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
54
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
55 if (init_done) return;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
56 init_done = TRUE;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
57
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
58 cmsErrorAction(LCMS_ERROR_IGNORE);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
59 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
60
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
61
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
62 /*
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
63 *-------------------------------------------------------------------
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
64 * color transform cache
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
65 *-------------------------------------------------------------------
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
66 */
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
67
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
68 static GList *cm_cache_list = NULL;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
69
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
70
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
71 static void color_man_cache_ref(ColorManCache *cc)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
72 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
73 if (!cc) return;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
74
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
75 cc->refcount++;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
76 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
77
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
78 static void color_man_cache_unref(ColorManCache *cc)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
79 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
80 if (!cc) return;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
81
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
82 cc->refcount--;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
83 if (cc->refcount < 1)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
84 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
85 if (cc->transform) cmsDeleteTransform(cc->transform);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
86 if (cc->profile_in) cmsCloseProfile(cc->profile_in);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
87 if (cc->profile_out) cmsCloseProfile(cc->profile_out);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
88
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
89 g_free(cc->profile_in_file);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
90 g_free(cc->profile_out_file);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
91
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
92 g_free(cc);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
93 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
94 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
95
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
96 static cmsHPROFILE color_man_cache_load_profile(ColorManProfileType type, const gchar *file,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
97 unsigned char *data, guint data_len)
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
98 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
99 cmsHPROFILE profile = NULL;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
100
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
101 switch (type)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
102 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
103 case COLOR_PROFILE_FILE:
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
104 if (file)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
105 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
106 gchar *pathl;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
107
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
108 pathl = path_from_utf8(file);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
109 profile = cmsOpenProfileFromFile(pathl, "r");
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
110 g_free(pathl);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
111 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
112 break;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
113 case COLOR_PROFILE_SRGB:
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
114 profile = cmsCreate_sRGBProfile();
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
115 break;
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
116 case COLOR_PROFILE_MEM:
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
117 if (data)
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
118 {
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
119 profile = cmsOpenProfileFromMem(data, data_len);
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
120 }
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
121 break;
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
122 case COLOR_PROFILE_NONE:
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
123 default:
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
124 break;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
125 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
126
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
127 return profile;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
128 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
129
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
130 static ColorManCache *color_man_cache_new(ColorManProfileType in_type, const gchar *in_file,
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
131 unsigned char *in_data, guint in_data_len,
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
132 ColorManProfileType out_type, const gchar *out_file,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
133 gint has_alpha)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
134 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
135 ColorManCache *cc;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
136
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
137 color_man_lib_init();
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
138
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
139 cc = g_new0(ColorManCache, 1);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
140 cc->refcount = 1;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
141
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
142 cc->profile_in_type = in_type;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
143 cc->profile_in_file = g_strdup(in_file);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
144
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
145 cc->profile_out_type = out_type;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
146 cc->profile_out_file = g_strdup(out_file);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
147
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
148 cc->has_alpha = has_alpha;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
149
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
150 cc->profile_in = color_man_cache_load_profile(cc->profile_in_type, cc->profile_in_file,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
151 in_data, in_data_len);
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
152 cc->profile_out = color_man_cache_load_profile(cc->profile_out_type, cc->profile_out_file,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
153 NULL, 0);
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
154
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
155 if (!cc->profile_in || !cc->profile_out)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
156 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
157 if (debug) printf("failed to load color profile for %s: %d %s\n",
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
158 (!cc->profile_in) ? "input" : "screen",
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
159 (!cc->profile_in) ? cc->profile_in_type : cc->profile_out_type,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
160 (!cc->profile_in) ? cc->profile_in_file : cc->profile_out_file);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
161
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
162 color_man_cache_unref(cc);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
163 return NULL;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
164 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
165
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
166 cc->transform = cmsCreateTransform(cc->profile_in,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
167 (has_alpha) ? TYPE_RGBA_8 : TYPE_RGB_8,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
168 cc->profile_out,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
169 (has_alpha) ? TYPE_RGBA_8 : TYPE_RGB_8,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
170 INTENT_PERCEPTUAL, 0);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
171
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
172 if (!cc->transform)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
173 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
174 if (debug) printf("failed to create color profile transform\n");
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
175
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
176 color_man_cache_unref(cc);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
177 return NULL;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
178 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
179
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
180 if (cc->profile_in_type != COLOR_PROFILE_MEM)
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
181 {
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
182 cm_cache_list = g_list_append(cm_cache_list, cc);
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
183 color_man_cache_ref(cc);
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
184 }
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
185
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
186 return cc;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
187 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
188
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
189 static void color_man_cache_free(ColorManCache *cc)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
190 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
191 if (!cc) return;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
192
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
193 cm_cache_list = g_list_remove(cm_cache_list, cc);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
194 color_man_cache_unref(cc);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
195 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
196
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
197 static void color_man_cache_reset(void)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
198 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
199 while (cm_cache_list)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
200 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
201 ColorManCache *cc;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
202
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
203 cc = cm_cache_list->data;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
204 color_man_cache_free(cc);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
205 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
206 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
207
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
208 static ColorManCache *color_man_cache_find(ColorManProfileType in_type, const gchar *in_file,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
209 ColorManProfileType out_type, const gchar *out_file,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
210 gint has_alpha)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
211 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
212 GList *work;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
213
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
214 work = cm_cache_list;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
215 while (work)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
216 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
217 ColorManCache *cc;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
218 gint match = FALSE;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
219
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
220 cc = work->data;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
221 work = work->next;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
222
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
223 if (cc->profile_in_type == in_type &&
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
224 cc->profile_out_type == out_type &&
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
225 cc->has_alpha == has_alpha)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
226 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
227 match = TRUE;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
228 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
229
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
230 if (match && cc->profile_in_type == COLOR_PROFILE_FILE)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
231 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
232 match = (cc->profile_in_file && in_file &&
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
233 strcmp(cc->profile_in_file, in_file) == 0);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
234 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
235 if (match && cc->profile_out_type == COLOR_PROFILE_FILE)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
236 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
237 match = (cc->profile_out_file && out_file &&
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
238 strcmp(cc->profile_out_file, out_file) == 0);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
239 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
240
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
241 if (match) return cc;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
242 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
243
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
244 return NULL;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
245 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
246
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
247 static ColorManCache *color_man_cache_get(ColorManProfileType in_type, const gchar *in_file,
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
248 unsigned char *in_data, guint in_data_len,
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
249 ColorManProfileType out_type, const gchar *out_file,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
250 gint has_alpha)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
251 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
252 ColorManCache *cc;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
253
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
254 cc = color_man_cache_find(in_type, in_file, out_type, out_file, has_alpha);
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
255 if (cc)
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
256 {
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
257 color_man_cache_ref(cc);
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
258 return cc;
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
259 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
260
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
261 return color_man_cache_new(in_type, in_file, in_data, in_data_len,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
262 out_type, out_file, has_alpha);
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
263 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
264
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
265
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
266 /*
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
267 *-------------------------------------------------------------------
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
268 * color manager
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
269 *-------------------------------------------------------------------
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
270 */
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
271
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
272 static void color_man_done(ColorMan *cm, ColorManReturnType type)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
273 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
274 if (cm->func_done)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
275 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
276 cm->func_done(cm, type, cm->func_done_data);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
277 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
278 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
279
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
280 static void color_man_correct_region(ColorMan *cm, gint x, gint y, gint w, gint h,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
281 gint pixbuf_width, gint pixbuf_height)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
282 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
283 ColorManCache *cc;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
284 guchar *pix;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
285 gint rs;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
286 gint i;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
287
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
288 cc = cm->profile;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
289
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
290 pix = gdk_pixbuf_get_pixels(cm->pixbuf);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
291 rs = gdk_pixbuf_get_rowstride(cm->pixbuf);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
292
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
293 w = MIN(w, pixbuf_width - x);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
294 h = MIN(h, pixbuf_height - y);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
295
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
296 pix += x * ((cc->has_alpha) ? 4 : 3);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
297 for (i = 0; i < h; i++)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
298 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
299 guchar *pbuf;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
300
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
301 pbuf = pix + ((y + i) * rs);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
302 cmsDoTransform(cc->transform, pbuf, pbuf, w);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
303 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
304
115
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
305 if (cm->incremental_sync && cm->imd) image_area_changed(cm->imd, x, y, w, h);
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
306 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
307
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
308 static gint color_man_idle_cb(gpointer data)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
309 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
310 ColorMan *cm = data;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
311 gint width, height;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
312 gint rh;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
313
115
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
314 if (cm->imd &&
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
315 cm->pixbuf != image_get_pixbuf(cm->imd))
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
316 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
317 cm->idle_id = -1;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
318 color_man_done(cm, COLOR_RETURN_IMAGE_CHANGED);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
319 return FALSE;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
320 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
321
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
322 width = gdk_pixbuf_get_width(cm->pixbuf);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
323 height = gdk_pixbuf_get_height(cm->pixbuf);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
324
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
325 if (cm->row > height)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
326 {
115
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
327 if (!cm->incremental_sync && cm->imd)
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
328 {
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
329 image_area_changed(cm->imd, 0, 0, width, height);
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
330 }
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
331
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
332 cm->idle_id = -1;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
333 color_man_done(cm, COLOR_RETURN_SUCCESS);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
334 return FALSE;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
335 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
336
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
337 rh = COLOR_MAN_CHUNK_SIZE / width + 1;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
338 color_man_correct_region(cm, 0, cm->row, width, rh, width, height);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
339 cm->row += rh;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
340
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
341 return TRUE;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
342 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
343
115
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
344 static ColorMan *color_man_new_real(ImageWindow *imd, GdkPixbuf *pixbuf,
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
345 ColorManProfileType input_type, const gchar *input_file,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
346 unsigned char *input_data, guint input_data_len,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
347 ColorManProfileType screen_type, const gchar *screen_file,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
348 ColorManDoneFunc done_func, gpointer done_data)
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
349 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
350 ColorMan *cm;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
351 gint has_alpha;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
352
115
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
353 if (imd) pixbuf = image_get_pixbuf(imd);
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
354 if (!pixbuf) return NULL;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
355
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
356 cm = g_new0(ColorMan, 1);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
357 cm->imd = imd;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
358 cm->pixbuf = pixbuf;
115
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
359 g_object_ref(cm->pixbuf);
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
360
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
361 cm->incremental_sync = FALSE;
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
362 cm->row = 0;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
363 cm->idle_id = -1;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
364
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
365 cm->func_done = done_func;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
366 cm->func_done_data = done_data;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
367
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
368 has_alpha = gdk_pixbuf_get_has_alpha(pixbuf);
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
369 cm->profile = color_man_cache_get(input_type, input_file, input_data, input_data_len,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
370 screen_type, screen_file, has_alpha);
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
371 if (!cm->profile)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
372 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
373 color_man_free(cm);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
374 return NULL;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
375 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
376
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
377 cm->idle_id = g_idle_add(color_man_idle_cb, cm);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
378
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
379 return cm;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
380 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
381
115
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
382 ColorMan *color_man_new(ImageWindow *imd, GdkPixbuf *pixbuf,
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
383 ColorManProfileType input_type, const gchar *input_file,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
384 ColorManProfileType screen_type, const gchar *screen_file,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
385 ColorManDoneFunc done_func, gpointer done_data)
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
386 {
115
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
387 return color_man_new_real(imd, pixbuf,
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
388 input_type, input_file, NULL, 0,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
389 screen_type, screen_file,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
390 done_func, done_data);
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
391 }
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
392
115
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
393 ColorMan *color_man_new_embedded(ImageWindow *imd, GdkPixbuf *pixbuf,
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
394 unsigned char *input_data, guint input_data_len,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
395 ColorManProfileType screen_type, const gchar *screen_file,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
396 ColorManDoneFunc done_func, gpointer done_data)
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
397 {
115
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
398 return color_man_new_real(imd, pixbuf,
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
399 COLOR_PROFILE_MEM, NULL, input_data, input_data_len,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
400 screen_type, screen_file,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
401 done_func, done_data);
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
402 }
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
403
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
404 void color_man_free(ColorMan *cm)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
405 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
406 if (!cm) return;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
407
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
408 if (cm->idle_id != -1) g_source_remove(cm->idle_id);
115
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
409 if (cm->pixbuf) g_object_unref(cm->pixbuf);
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
410
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
411 color_man_cache_unref(cm->profile);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
412
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
413 g_free(cm);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
414 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
415
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
416 void color_man_update(void)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
417 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
418 color_man_cache_reset();
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
419 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
420
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
421 #else
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
422 /*** color support not enabled ***/
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
423
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
424
115
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
425 ColorMan *color_man_new(ImageWindow *imd, GdkPixbuf *pixbuf,
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
426 ColorManProfileType input_type, const gchar *input_file,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
427 ColorManProfileType screen_type, const gchar *screen_file,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
428 ColorManDoneFunc don_func, gpointer done_data)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
429 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
430 /* no op */
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
431 return NULL;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
432 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
433
115
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
434 ColorMan *color_man_new_embedded(ImageWindow *imd, GdkPixbuf *pixbuf,
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
435 unsigned char *input_data, guint input_data_len,
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
436 ColorManProfileType screen_type, const gchar *screen_file,
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
437 ColorManDoneFunc done_func, gpointer done_data)
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
438 {
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
439 /* no op */
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
440 return NULL;
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
441 }
53b2bfdcff69 Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents: 114
diff changeset
442
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
443 void color_man_free(ColorMan *cm)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
444 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
445 /* no op */
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
446 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
447
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
448 void color_man_update(void)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
449 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
450 /* no op */
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
451 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
452
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
453
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
454 #endif
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
455
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
456