[PATCH 3/3] mscms: Allow any COLORTYPE translation equally.
Lauri Kenttä
lauri.kentta at gmail.com
Fri Mar 19 17:25:27 CDT 2021
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>
---
dlls/mscms/liblcms.c | 23 +----------------------
1 file changed, 1 insertion(+), 22 deletions(-)
diff --git a/dlls/mscms/liblcms.c b/dlls/mscms/liblcms.c
index 0a702a4b043..b1eabddc247 100644
--- a/dlls/mscms/liblcms.c
+++ b/dlls/mscms/liblcms.c
@@ -123,35 +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);
- }
- 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 );
+ cmsDoTransform( transform, &in[i], &out[i], 1 );
return TRUE;
}
--
2.31.0
More information about the wine-devel
mailing list