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 Corporation | 3 // Copyright (C) 2009 Mozilla Corporation |
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 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 return NULL; | 1321 return NULL; |
1322 } | 1322 } |
1323 return transform; | 1323 return transform; |
1324 } | 1324 } |
1325 | 1325 |
1326 /* __force_align_arg_pointer__ is an x86-only attribute, and gcc/clang warns on
unused | 1326 /* __force_align_arg_pointer__ is an x86-only attribute, and gcc/clang warns on
unused |
1327 * attributes. Don't use this on ARM or AMD64. __has_attribute can detect the pr
esence | 1327 * attributes. Don't use this on ARM or AMD64. __has_attribute can detect the pr
esence |
1328 * of the attribute but is currently only supported by clang */ | 1328 * of the attribute but is currently only supported by clang */ |
1329 #if defined(__has_attribute) | 1329 #if defined(__has_attribute) |
1330 #define HAS_FORCE_ALIGN_ARG_POINTER __has_attribute(__force_align_arg_pointer__) | 1330 #define HAS_FORCE_ALIGN_ARG_POINTER __has_attribute(__force_align_arg_pointer__) |
1331 #elif defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__) && !defin
ed(__arm__) | 1331 #elif defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__) && !defin
ed(__arm__) && !defined(__mips__) |
1332 #define HAS_FORCE_ALIGN_ARG_POINTER 1 | 1332 #define HAS_FORCE_ALIGN_ARG_POINTER 1 |
1333 #else | 1333 #else |
1334 #define HAS_FORCE_ALIGN_ARG_POINTER 0 | 1334 #define HAS_FORCE_ALIGN_ARG_POINTER 0 |
1335 #endif | 1335 #endif |
1336 | 1336 |
1337 #if HAS_FORCE_ALIGN_ARG_POINTER | 1337 #if HAS_FORCE_ALIGN_ARG_POINTER |
1338 /* we need this to avoid crashes when gcc assumes the stack is 128bit aligned */ | 1338 /* we need this to avoid crashes when gcc assumes the stack is 128bit aligned */ |
1339 __attribute__((__force_align_arg_pointer__)) | 1339 __attribute__((__force_align_arg_pointer__)) |
1340 #endif | 1340 #endif |
1341 void qcms_transform_data(qcms_transform *transform, void *src, void *dest, size_
t length) | 1341 void qcms_transform_data(qcms_transform *transform, void *src, void *dest, size_
t length) |
1342 { | 1342 { |
1343 static const struct _qcms_format_type output_rgbx = { 0, 2 }; | 1343 static const struct _qcms_format_type output_rgbx = { 0, 2 }; |
1344 | 1344 |
1345 transform->transform_fn(transform, src, dest, length, output_rgbx); | 1345 transform->transform_fn(transform, src, dest, length, output_rgbx); |
1346 } | 1346 } |
1347 | 1347 |
1348 void qcms_transform_data_type(qcms_transform *transform, void *src, void *dest,
size_t length, qcms_output_type type) | 1348 void qcms_transform_data_type(qcms_transform *transform, void *src, void *dest,
size_t length, qcms_output_type type) |
1349 { | 1349 { |
1350 static const struct _qcms_format_type output_rgbx = { 0, 2 }; | 1350 static const struct _qcms_format_type output_rgbx = { 0, 2 }; |
1351 static const struct _qcms_format_type output_bgrx = { 2, 0 }; | 1351 static const struct _qcms_format_type output_bgrx = { 2, 0 }; |
1352 | 1352 |
1353 transform->transform_fn(transform, src, dest, length, type == QCMS_OUTPU
T_BGRX ? output_bgrx : output_rgbx); | 1353 transform->transform_fn(transform, src, dest, length, type == QCMS_OUTPU
T_BGRX ? output_bgrx : output_rgbx); |
1354 } | 1354 } |
1355 | 1355 |
1356 qcms_bool qcms_supports_iccv4; | 1356 qcms_bool qcms_supports_iccv4; |
1357 void qcms_enable_iccv4() | 1357 void qcms_enable_iccv4() |
1358 { | 1358 { |
1359 qcms_supports_iccv4 = true; | 1359 qcms_supports_iccv4 = true; |
1360 } | 1360 } |
OLD | NEW |