diff options
author | Marti Maria <marti.maria@littlecms.com> | 2023-05-16 16:32:42 +0200 |
---|---|---|
committer | Marti Maria <marti.maria@littlecms.com> | 2023-05-16 16:32:42 +0200 |
commit | e55b6fa4d3c5b7e08d9e4bc8c803a79ca908b5a4 (patch) | |
tree | b36fdc835152ea9e9a6e25948fb1df88ae230b74 /plugins/fast_float | |
parent | f087232ced02e34c36b88e9d75d071aa46fec0ff (diff) | |
download | lcms2-master.tar.gz |
Thanks to ISOZAKI Nozomi to point out the issue.
Diffstat (limited to 'plugins/fast_float')
-rw-r--r-- | plugins/fast_float/src/fast_float_sup.c | 4 | ||||
-rw-r--r-- | plugins/fast_float/testbed/fast_float_testbed.c | 27 |
2 files changed, 29 insertions, 2 deletions
diff --git a/plugins/fast_float/src/fast_float_sup.c b/plugins/fast_float/src/fast_float_sup.c index a3362b4..2955525 100644 --- a/plugins/fast_float/src/fast_float_sup.c +++ b/plugins/fast_float/src/fast_float_sup.c @@ -22,7 +22,6 @@ #include "fast_float_internal.h" - // This is the main dispatcher static cmsBool Floating_Point_Transforms_Dispatcher(_cmsTransform2Fn* TransformFn, @@ -39,6 +38,9 @@ cmsBool Floating_Point_Transforms_Dispatcher(_cmsTransform2Fn* TransformFn, // Special flags for reversing are not supported if (T_FLAVOR(*InputFormat) || T_FLAVOR(*OutputFormat)) return FALSE; + // Check consistency for alpha channel copy + if (*dwFlags & cmsFLAGS_COPY_ALPHA && (T_EXTRA(*InputFormat) != T_EXTRA(*OutputFormat))) return FALSE; + // Try to optimize as a set of curves plus a matrix plus a set of curves if (OptimizeMatrixShaper15(TransformFn, UserData, FreeUserData, Lut, InputFormat, OutputFormat, dwFlags)) return TRUE; diff --git a/plugins/fast_float/testbed/fast_float_testbed.c b/plugins/fast_float/testbed/fast_float_testbed.c index f00b4cf..5e4fb4d 100644 --- a/plugins/fast_float/testbed/fast_float_testbed.c +++ b/plugins/fast_float/testbed/fast_float_testbed.c @@ -1142,10 +1142,33 @@ void CheckLab2Roundtrip(void) } +static +void CheckAlphaDetect(void) +{ + cmsHPROFILE hsRGB; + cmsHTRANSFORM xform; + + cmsSetLogErrorHandler(NULL); + + hsRGB = cmsCreate_sRGBProfile(); + + xform = cmsCreateTransform(hsRGB, TYPE_RGB_FLT, hsRGB, TYPE_RGBA_FLT, INTENT_PERCEPTUAL, cmsFLAGS_COPY_ALPHA); + cmsCloseProfile(hsRGB); + + if (xform != NULL) + Fail("Copy alpha with mismatched channels should not succeed"); + + cmsSetLogErrorHandler(FatalErrorQuit); +} + // Convert some known values static void CheckConversionFloat(void) { + trace("Check alpha detection."); + CheckAlphaDetect(); + trace("Ok\n"); + trace("Crash test."); TryAllValuesFloatAlpha(cmsOpenProfileFromFile(PROFILES_DIR "test5.icc", "r"), cmsOpenProfileFromFile(PROFILES_DIR "test0.icc", "r"), INTENT_PERCEPTUAL, FALSE); @@ -1186,6 +1209,8 @@ void CheckConversionFloat(void) TryAllValuesFloatVs16(cmsOpenProfileFromFile(PROFILES_DIR "test0.icc", "r"), cmsOpenProfileFromFile(PROFILES_DIR "test0.icc", "r"), INTENT_PERCEPTUAL); TryAllValuesFloat(cmsOpenProfileFromFile(PROFILES_DIR "test0.icc", "r"), cmsOpenProfileFromFile(PROFILES_DIR "test0.icc", "r"), INTENT_PERCEPTUAL); trace("Ok\n"); + + } @@ -2470,7 +2495,7 @@ int main() trace("Installing plug-in ... "); cmsPlugin(cmsFastFloatExtensions()); trace("done.\n\n"); - + CheckComputeIncrements(); // 15 bit functionality |