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 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 return NULL; | 1398 return NULL; |
1399 } | 1399 } |
1400 return transform; | 1400 return transform; |
1401 } | 1401 } |
1402 | 1402 |
1403 /* __force_align_arg_pointer__ is an x86-only attribute, and gcc/clang warns on
unused | 1403 /* __force_align_arg_pointer__ is an x86-only attribute, and gcc/clang warns on
unused |
1404 * attributes. Don't use this on ARM or AMD64. __has_attribute can detect the pr
esence | 1404 * attributes. Don't use this on ARM or AMD64. __has_attribute can detect the pr
esence |
1405 * of the attribute but is currently only supported by clang */ | 1405 * of the attribute but is currently only supported by clang */ |
1406 #if defined(__has_attribute) | 1406 #if defined(__has_attribute) |
1407 #define HAS_FORCE_ALIGN_ARG_POINTER __has_attribute(__force_align_arg_pointer__) | 1407 #define HAS_FORCE_ALIGN_ARG_POINTER __has_attribute(__force_align_arg_pointer__) |
1408 #elif defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__) && !defin
ed(__arm__) && !defined(__mips__) | 1408 #elif defined(__GNUC__) && defined(__i386__) |
1409 #define HAS_FORCE_ALIGN_ARG_POINTER 1 | 1409 #define HAS_FORCE_ALIGN_ARG_POINTER 1 |
1410 #else | 1410 #else |
1411 #define HAS_FORCE_ALIGN_ARG_POINTER 0 | 1411 #define HAS_FORCE_ALIGN_ARG_POINTER 0 |
1412 #endif | 1412 #endif |
1413 | 1413 |
1414 #if HAS_FORCE_ALIGN_ARG_POINTER | 1414 #if HAS_FORCE_ALIGN_ARG_POINTER |
1415 /* we need this to avoid crashes when gcc assumes the stack is 128bit aligned */ | 1415 /* we need this to avoid crashes when gcc assumes the stack is 128bit aligned */ |
1416 __attribute__((__force_align_arg_pointer__)) | 1416 __attribute__((__force_align_arg_pointer__)) |
1417 #endif | 1417 #endif |
1418 void qcms_transform_data(qcms_transform *transform, void *src, void *dest, size_
t length) | 1418 void qcms_transform_data(qcms_transform *transform, void *src, void *dest, size_
t length) |
1419 { | 1419 { |
1420 static const struct _qcms_format_type output_rgbx = { 0, 2 }; | 1420 static const struct _qcms_format_type output_rgbx = { 0, 2 }; |
1421 | 1421 |
1422 transform->transform_fn(transform, src, dest, length, output_rgbx); | 1422 transform->transform_fn(transform, src, dest, length, output_rgbx); |
1423 } | 1423 } |
1424 | 1424 |
1425 void qcms_transform_data_type(qcms_transform *transform, void *src, void *dest,
size_t length, qcms_output_type type) | 1425 void qcms_transform_data_type(qcms_transform *transform, void *src, void *dest,
size_t length, qcms_output_type type) |
1426 { | 1426 { |
1427 static const struct _qcms_format_type output_rgbx = { 0, 2 }; | 1427 static const struct _qcms_format_type output_rgbx = { 0, 2 }; |
1428 static const struct _qcms_format_type output_bgrx = { 2, 0 }; | 1428 static const struct _qcms_format_type output_bgrx = { 2, 0 }; |
1429 | 1429 |
1430 transform->transform_fn(transform, src, dest, length, type == QCMS_OUTPU
T_BGRX ? output_bgrx : output_rgbx); | 1430 transform->transform_fn(transform, src, dest, length, type == QCMS_OUTPU
T_BGRX ? output_bgrx : output_rgbx); |
1431 } | 1431 } |
1432 | 1432 |
1433 qcms_bool qcms_supports_iccv4; | 1433 qcms_bool qcms_supports_iccv4; |
1434 void qcms_enable_iccv4() | 1434 void qcms_enable_iccv4() |
1435 { | 1435 { |
1436 qcms_supports_iccv4 = true; | 1436 qcms_supports_iccv4 = true; |
1437 } | 1437 } |
OLD | NEW |