[PATCH v2 3/3] mscms: Allow any COLORTYPE translation equally.
Hans Leidekker
hans at codeweavers.com
Mon Mar 22 03:51:24 CDT 2021
From: Lauri Kenttä <lauri.kentta at gmail.com>
If we assume that trying a color translation is at least as good as
just returning FALSE, then there's no point in cheching COLORTYPE.
COLOR is union, so offsetof will be 0 anyway and can be omitted too.
Signed-off-by: Lauri Kenttä <lauri.kentta at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
dlls/mscms/liblcms.c | 26 ++------------------------
1 file changed, 2 insertions(+), 24 deletions(-)
diff --git a/dlls/mscms/liblcms.c b/dlls/mscms/liblcms.c
index 5dbfc463522..5710fc49b75 100644
--- a/dlls/mscms/liblcms.c
+++ b/dlls/mscms/liblcms.c
@@ -123,36 +123,14 @@ static BOOL CDECL lcms_translate_bits( void *transform, void *srcbits, BMFORMAT
return TRUE;
}
-static int lcms_offsetof_type( COLORTYPE type )
-{
- switch (type)
- {
- case COLOR_GRAY: return offsetof(COLOR, gray);
- case COLOR_RGB: return offsetof(COLOR, rgb);
- case COLOR_CMYK: return offsetof(COLOR, cmyk);
- case COLOR_XYZ: return offsetof(COLOR, XYZ);
- case COLOR_3_CHANNEL: return offsetof(COLOR, gen3ch);
- case COLOR_Lab: return offsetof(COLOR, Lab);
- default: break;
- }
- return -1;
-}
-
static BOOL CDECL lcms_translate_colors( void *transform, COLOR *in, DWORD count, COLORTYPE input_type,
COLOR *out, COLORTYPE output_type )
{
unsigned int i;
- int input_field_offset = lcms_offsetof_type( input_type );
- int output_field_offset = lcms_offsetof_type( output_type );
if (!cmsChangeBuffersFormat( transform, from_type(input_type), from_type(output_type) )) return FALSE;
- if (input_field_offset == -1 || output_field_offset == -1)
- {
- FIXME("unhandled input/output pair: %d/%d\n", input_type, output_type);
- return FALSE;
- }
- for (i = 0; i < count; i++)
- cmsDoTransform( transform, (char*)&in[i] + input_field_offset, (char*)&out[i] + output_field_offset, 1 );
+
+ for (i = 0; i < count; i++) cmsDoTransform( transform, &in[i], &out[i], 1 );
return TRUE;
}
--
2.30.2
More information about the wine-devel
mailing list