OLD | NEW |
1 /* vim: set ts=8 sw=8 noexpandtab: */ | 1 /* vim: set ts=8 sw=8 noexpandtab: */ |
2 // qcms | 2 // qcms |
3 // Copyright (C) 2009 Mozilla Foundation | 3 // Copyright (C) 2009 Mozilla Foundation |
4 // Copyright (C) 1998-2007 Marti Maria | 4 // Copyright (C) 1998-2007 Marti Maria |
5 // | 5 // |
6 // Permission is hereby granted, free of charge, to any person obtaining | 6 // Permission is hereby granted, free of charge, to any person obtaining |
7 // a copy of this software and associated documentation files (the "Software"), | 7 // a copy of this software and associated documentation files (the "Software"), |
8 // to deal in the Software without restriction, including without limitation | 8 // to deal in the Software without restriction, including without limitation |
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, |
10 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e | 10 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 290 |
291 if (negative) | 291 if (negative) |
292 return true; | 292 return true; |
293 | 293 |
294 | 294 |
295 // Sum the values; they should add up to something close to white | 295 // Sum the values; they should add up to something close to white |
296 sum[0] = rX + gX + bX; | 296 sum[0] = rX + gX + bX; |
297 sum[1] = rY + gY + bY; | 297 sum[1] = rY + gY + bY; |
298 sum[2] = rZ + gZ + bZ; | 298 sum[2] = rZ + gZ + bZ; |
299 | 299 |
| 300 #if defined (_MSC_VER) |
| 301 #pragma warning(push) |
| 302 /* Disable double to float truncation warning 4305 */ |
| 303 #pragma warning(disable:4305) |
| 304 #endif |
300 // Build our target vector (see mozilla bug 460629) | 305 // Build our target vector (see mozilla bug 460629) |
301 target[0] = 0.96420; | 306 target[0] = 0.96420; |
302 target[1] = 1.00000; | 307 target[1] = 1.00000; |
303 target[2] = 0.82491; | 308 target[2] = 0.82491; |
304 | 309 |
305 // Our tolerance vector - Recommended by Chris Murphy based on | 310 // Our tolerance vector - Recommended by Chris Murphy based on |
306 // conversion from the LAB space criterion of no more than 3 in any one | 311 // conversion from the LAB space criterion of no more than 3 in any one |
307 // channel. This is similar to, but slightly more tolerant than Adobe's | 312 // channel. This is similar to, but slightly more tolerant than Adobe's |
308 // criterion. | 313 // criterion. |
309 tolerance[0] = 0.02; | 314 tolerance[0] = 0.02; |
310 tolerance[1] = 0.02; | 315 tolerance[1] = 0.02; |
311 tolerance[2] = 0.04; | 316 tolerance[2] = 0.04; |
312 | 317 |
| 318 #if defined (_MSC_VER) |
| 319 /* Restore warnings */ |
| 320 #pragma warning(pop) |
| 321 #endif |
313 // Compare with our tolerance | 322 // Compare with our tolerance |
314 for (i = 0; i < 3; ++i) { | 323 for (i = 0; i < 3; ++i) { |
315 if (!(((sum[i] - tolerance[i]) <= target[i]) && | 324 if (!(((sum[i] - tolerance[i]) <= target[i]) && |
316 ((sum[i] + tolerance[i]) >= target[i]))) | 325 ((sum[i] + tolerance[i]) >= target[i]))) |
317 return true; | 326 return true; |
318 } | 327 } |
319 | 328 |
320 // All Good | 329 // All Good |
321 return false; | 330 return false; |
322 } | 331 } |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1195 { | 1204 { |
1196 qcms_profile *profile = NULL; | 1205 qcms_profile *profile = NULL; |
1197 FILE *file = _wfopen(path, L"rb"); | 1206 FILE *file = _wfopen(path, L"rb"); |
1198 if (file) { | 1207 if (file) { |
1199 profile = qcms_profile_from_file(file); | 1208 profile = qcms_profile_from_file(file); |
1200 fclose(file); | 1209 fclose(file); |
1201 } | 1210 } |
1202 return profile; | 1211 return profile; |
1203 } | 1212 } |
1204 #endif | 1213 #endif |
OLD | NEW |