dmusic: Print 64bit integers with wine_dbgstr_longlong.
[wine.git] / dlls / mscms / icc.c
blob70f819097f8f2fa3fb5187c4151bd2ea924ddffd
1 /*
2 * MSCMS - Color Management System for Wine
4 * Copyright 2004, 2005 Hans Leidekker
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
22 #include "wine/debug.h"
24 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winnls.h"
29 #include "wingdi.h"
30 #include "winuser.h"
31 #include "winreg.h"
32 #include "winternl.h"
33 #include "icm.h"
35 #include "mscms_priv.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(mscms);
39 #ifdef HAVE_LCMS
41 static inline void MSCMS_adjust_endianess32( ULONG *ptr )
43 #ifndef WORDS_BIGENDIAN
44 *ptr = RtlUlongByteSwap(*ptr);
45 #endif
48 void MSCMS_get_profile_header( icProfile *iccprofile, PROFILEHEADER *header )
50 unsigned int i;
52 memcpy( header, iccprofile, sizeof(PROFILEHEADER) );
54 /* ICC format is big-endian, swap bytes if necessary */
55 for (i = 0; i < sizeof(PROFILEHEADER) / sizeof(ULONG); i++)
56 MSCMS_adjust_endianess32( (ULONG *)header + i );
59 void MSCMS_set_profile_header( icProfile *iccprofile, PROFILEHEADER *header )
61 unsigned int i;
62 icHeader *iccheader = (icHeader *)iccprofile;
64 memcpy( iccheader, header, sizeof(icHeader) );
66 /* ICC format is big-endian, swap bytes if necessary */
67 for (i = 0; i < sizeof(icHeader) / sizeof(ULONG); i++)
68 MSCMS_adjust_endianess32( (ULONG *)iccheader + i );
71 DWORD MSCMS_get_tag_count( icProfile *iccprofile )
73 ULONG count = iccprofile->count;
75 MSCMS_adjust_endianess32( &count );
76 return count;
79 void MSCMS_get_tag_by_index( icProfile *iccprofile, DWORD index, icTag *tag )
81 icTag *tmp = (icTag *)((char *)&iccprofile->data + index * sizeof(icTag));
83 tag->sig = tmp->sig;
84 tag->offset = tmp->offset;
85 tag->size = tmp->size;
87 MSCMS_adjust_endianess32( (ULONG *)&tag->sig );
88 MSCMS_adjust_endianess32( (ULONG *)&tag->offset );
89 MSCMS_adjust_endianess32( (ULONG *)&tag->size );
92 void MSCMS_get_tag_data( icProfile *iccprofile, icTag *tag, DWORD offset, void *buffer )
94 memcpy( buffer, (char *)iccprofile + tag->offset + offset, tag->size - offset );
97 void MSCMS_set_tag_data( icProfile *iccprofile, icTag *tag, DWORD offset, void *buffer )
99 memcpy( (char *)iccprofile + tag->offset + offset, buffer, tag->size - offset );
102 DWORD MSCMS_get_profile_size( icProfile *iccprofile )
104 DWORD size = ((icHeader *)iccprofile)->size;
106 MSCMS_adjust_endianess32( (ULONG *)&size );
107 return size;
110 #endif /* HAVE_LCMS */