| 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 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 return floor(a*256.f + .5f); | 1155 return floor(a*256.f + .5f); |
| 1156 } | 1156 } |
| 1157 | 1157 |
| 1158 static struct curveType *curve_from_gamma(float gamma) | 1158 static struct curveType *curve_from_gamma(float gamma) |
| 1159 { | 1159 { |
| 1160 struct curveType *curve; | 1160 struct curveType *curve; |
| 1161 int num_entries = 1; | 1161 int num_entries = 1; |
| 1162 curve = malloc(sizeof(struct curveType) + sizeof(uInt16Number)*num_entri
es); | 1162 curve = malloc(sizeof(struct curveType) + sizeof(uInt16Number)*num_entri
es); |
| 1163 if (!curve) | 1163 if (!curve) |
| 1164 return NULL; | 1164 return NULL; |
| 1165 curve->type = CURVE_TYPE; |
| 1165 curve->count = num_entries; | 1166 curve->count = num_entries; |
| 1166 curve->data[0] = float_to_u8Fixed8Number(gamma); | 1167 curve->data[0] = float_to_u8Fixed8Number(gamma); |
| 1167 return curve; | 1168 return curve; |
| 1168 } | 1169 } |
| 1169 | 1170 |
| 1170 | 1171 |
| 1171 //XXX: it would be nice if we had a way of ensuring | 1172 //XXX: it would be nice if we had a way of ensuring |
| 1172 // everything in a profile was initialized regardless of how it was created | 1173 // everything in a profile was initialized regardless of how it was created |
| 1173 | 1174 |
| 1174 //XXX: should this also be taking a black_point? | 1175 //XXX: should this also be taking a black_point? |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 { | 1637 { |
| 1637 qcms_profile *profile = NULL; | 1638 qcms_profile *profile = NULL; |
| 1638 FILE *file = _wfopen(path, L"rb"); | 1639 FILE *file = _wfopen(path, L"rb"); |
| 1639 if (file) { | 1640 if (file) { |
| 1640 profile = qcms_profile_from_file(file); | 1641 profile = qcms_profile_from_file(file); |
| 1641 fclose(file); | 1642 fclose(file); |
| 1642 } | 1643 } |
| 1643 return profile; | 1644 return profile; |
| 1644 } | 1645 } |
| 1645 #endif | 1646 #endif |
| OLD | NEW |