Implement and test GetColorProfileElementTag,
GetCountColorProfileElements and IsColorProfileTagPresent. Stub GetStandardColorSpaceProfile{A,W}.
This commit is contained in:
parent
c590a66f89
commit
9db71b35d8
|
@ -27,11 +27,13 @@
|
||||||
#ifdef HAVE_LCMS_H
|
#ifdef HAVE_LCMS_H
|
||||||
|
|
||||||
LCMS_API_FUNCTION(cmsCloseProfile)
|
LCMS_API_FUNCTION(cmsCloseProfile)
|
||||||
|
LCMS_API_FUNCTION(cmsIsTag)
|
||||||
LCMS_API_FUNCTION(cmsOpenProfileFromFile)
|
LCMS_API_FUNCTION(cmsOpenProfileFromFile)
|
||||||
LCMS_API_FUNCTION(cmsOpenProfileFromMem)
|
LCMS_API_FUNCTION(cmsOpenProfileFromMem)
|
||||||
|
|
||||||
#ifndef LCMS_API_NO_REDEFINE
|
#ifndef LCMS_API_NO_REDEFINE
|
||||||
#define cmsCloseProfile pcmsCloseProfile
|
#define cmsCloseProfile pcmsCloseProfile
|
||||||
|
#define cmsIsTag pcmsIsTag
|
||||||
#define cmsOpenProfileFromFile pcmsOpenProfileFromFile
|
#define cmsOpenProfileFromFile pcmsOpenProfileFromFile
|
||||||
#define cmsOpenProfileFromMem pcmsOpenProfileFromMem
|
#define cmsOpenProfileFromMem pcmsOpenProfileFromMem
|
||||||
#endif /* LCMS_API_NO_REDEFINE */
|
#endif /* LCMS_API_NO_REDEFINE */
|
||||||
|
|
|
@ -21,16 +21,16 @@
|
||||||
@ stdcall GetColorDirectoryA(ptr ptr long)
|
@ stdcall GetColorDirectoryA(ptr ptr long)
|
||||||
@ stdcall GetColorDirectoryW(ptr ptr long)
|
@ stdcall GetColorDirectoryW(ptr ptr long)
|
||||||
@ stub GetColorProfileElement
|
@ stub GetColorProfileElement
|
||||||
@ stub GetColorProfileElementTag
|
@ stdcall GetColorProfileElementTag(ptr long ptr)
|
||||||
@ stub GetColorProfileFromHandle
|
@ stub GetColorProfileFromHandle
|
||||||
@ stub GetColorProfileHeader
|
@ stub GetColorProfileHeader
|
||||||
@ stub GetCountColorProfileElements
|
@ stdcall GetCountColorProfileElements(ptr long)
|
||||||
@ stub GetNamedProfileInfo
|
@ stub GetNamedProfileInfo
|
||||||
@ stub GetPS2ColorRenderingDictionary
|
@ stub GetPS2ColorRenderingDictionary
|
||||||
@ stub GetPS2ColorRenderingIntent
|
@ stub GetPS2ColorRenderingIntent
|
||||||
@ stub GetPS2ColorSpaceArray
|
@ stub GetPS2ColorSpaceArray
|
||||||
@ stub GetStandardColorSpaceProfileA
|
@ stdcall GetStandardColorSpaceProfileA(ptr long ptr ptr)
|
||||||
@ stub GetStandardColorSpaceProfileW
|
@ stdcall GetStandardColorSpaceProfileW(ptr long ptr ptr)
|
||||||
@ stdcall InstallColorProfileA(ptr ptr)
|
@ stdcall InstallColorProfileA(ptr ptr)
|
||||||
@ stdcall InstallColorProfileW(ptr ptr)
|
@ stdcall InstallColorProfileW(ptr ptr)
|
||||||
@ stub InternalGetDeviceConfig
|
@ stub InternalGetDeviceConfig
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
@ stub InternalGetPS2ColorSpaceArray
|
@ stub InternalGetPS2ColorSpaceArray
|
||||||
@ stub InternalGetPS2PreviewCRD
|
@ stub InternalGetPS2PreviewCRD
|
||||||
@ stub InternalSetDeviceConfig
|
@ stub InternalSetDeviceConfig
|
||||||
@ stub IsColorProfileTagPresent
|
@ stdcall IsColorProfileTagPresent(ptr long ptr)
|
||||||
@ stdcall IsColorProfileValid(ptr long)
|
@ stdcall IsColorProfileValid(ptr long)
|
||||||
@ stdcall OpenColorProfileA(ptr long long long)
|
@ stdcall OpenColorProfileA(ptr long long long)
|
||||||
@ stdcall OpenColorProfileW(ptr long long long)
|
@ stdcall OpenColorProfileW(ptr long long long)
|
||||||
|
|
|
@ -73,6 +73,7 @@ static BOOL MSCMS_init_lcms()
|
||||||
goto sym_not_found;
|
goto sym_not_found;
|
||||||
|
|
||||||
LOAD_FUNCPTR(cmsCloseProfile);
|
LOAD_FUNCPTR(cmsCloseProfile);
|
||||||
|
LOAD_FUNCPTR(cmsIsTag);
|
||||||
LOAD_FUNCPTR(cmsOpenProfileFromFile);
|
LOAD_FUNCPTR(cmsOpenProfileFromFile);
|
||||||
LOAD_FUNCPTR(cmsOpenProfileFromMem);
|
LOAD_FUNCPTR(cmsOpenProfileFromMem);
|
||||||
#undef LOAD_FUNCPTR
|
#undef LOAD_FUNCPTR
|
||||||
|
|
|
@ -67,7 +67,7 @@ BOOL WINAPI GetColorDirectoryA( PCSTR machine, PSTR buffer, PDWORD size )
|
||||||
if (bufferW)
|
if (bufferW)
|
||||||
{
|
{
|
||||||
ret = GetColorDirectoryW( NULL, bufferW, &sizeW );
|
ret = GetColorDirectoryW( NULL, bufferW, &sizeW );
|
||||||
*size = sizeW / sizeof(WCHAR);
|
*size = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL );
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
|
@ -117,6 +117,110 @@ BOOL WINAPI GetColorDirectoryW( PCWSTR machine, PWSTR buffer, PDWORD size )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* GetColorProfileElementTag [MSCMS.@]
|
||||||
|
*
|
||||||
|
* Get a tag name from a color profile by index.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* profile [I] Handle to a color profile.
|
||||||
|
* index [I] Index into the tag table of the color profile.
|
||||||
|
* tag [O] Pointer to a TAGTYPE variable.
|
||||||
|
*
|
||||||
|
* RETURNS
|
||||||
|
* Success: TRUE
|
||||||
|
* Failure: FALSE
|
||||||
|
*
|
||||||
|
* NOTES
|
||||||
|
* The tag table index starts at 1.
|
||||||
|
* Use GetCountColorProfileElements to retrieve a count of tagged elements.
|
||||||
|
*/
|
||||||
|
BOOL WINAPI GetColorProfileElementTag( HPROFILE profile, DWORD index, PTAGTYPE tag )
|
||||||
|
{
|
||||||
|
BOOL ret = FALSE;
|
||||||
|
#ifdef HAVE_LCMS_H
|
||||||
|
LCMSICCPROFILE *cmsprofile = (LCMSICCPROFILE *)MSCMS_hprofile2cmsprofile( profile );
|
||||||
|
|
||||||
|
TRACE( "( %p, %ld, %p )\n", profile, index, tag );
|
||||||
|
|
||||||
|
if (cmsprofile)
|
||||||
|
{
|
||||||
|
*tag = cmsprofile->TagNames[index - 1];
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* HAVE_LCMS_H */
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* GetCountColorProfileElements [MSCMS.@]
|
||||||
|
*
|
||||||
|
* Retrieve the number of elements in a color profile.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* profile [I] Handle to a color profile.
|
||||||
|
* count [O] Pointer to a variable which is set to the number of elements
|
||||||
|
* in the color profile.
|
||||||
|
*
|
||||||
|
* RETURNS
|
||||||
|
* Success: TRUE
|
||||||
|
* Failure: FALSE
|
||||||
|
*/
|
||||||
|
BOOL WINAPI GetCountColorProfileElements( HPROFILE profile, PDWORD count )
|
||||||
|
{
|
||||||
|
BOOL ret = FALSE;
|
||||||
|
#ifdef HAVE_LCMS_H
|
||||||
|
LCMSICCPROFILE *cmsprofile = (LCMSICCPROFILE *)MSCMS_hprofile2cmsprofile( profile );
|
||||||
|
|
||||||
|
TRACE( "( %p, %p )\n", profile, count );
|
||||||
|
|
||||||
|
if (cmsprofile)
|
||||||
|
{
|
||||||
|
*count = cmsprofile->TagCount;
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* HAVE_LCMS_H */
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL WINAPI GetStandardColorSpaceProfileA( PCSTR machine, DWORD id, PSTR profile, PDWORD size )
|
||||||
|
{
|
||||||
|
INT len;
|
||||||
|
LPWSTR profileW;
|
||||||
|
BOOL ret = FALSE;
|
||||||
|
DWORD sizeW = *size * sizeof(WCHAR);
|
||||||
|
|
||||||
|
TRACE( "( 0x%08lx, %p, %ld )\n", id, profile, *size );
|
||||||
|
|
||||||
|
if (machine || !profile) return FALSE;
|
||||||
|
|
||||||
|
profileW = HeapAlloc( GetProcessHeap(), 0, sizeW );
|
||||||
|
|
||||||
|
if (profileW)
|
||||||
|
{
|
||||||
|
ret = GetStandardColorSpaceProfileW( NULL, id, profileW, &sizeW );
|
||||||
|
*size = WideCharToMultiByte( CP_ACP, 0, profileW, -1, NULL, 0, NULL, NULL );
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
len = WideCharToMultiByte( CP_ACP, 0, profileW, *size, profile, *size, NULL, NULL );
|
||||||
|
if (!len) ret = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
HeapFree( GetProcessHeap(), 0, profileW );
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL WINAPI GetStandardColorSpaceProfileW( PCWSTR machine, DWORD id, PWSTR profile, PDWORD size )
|
||||||
|
{
|
||||||
|
FIXME( "( %lx, %p, %ld ) stub\n", id, profile, *size );
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* InstallColorProfileA [MSCMS.@]
|
* InstallColorProfileA [MSCMS.@]
|
||||||
*
|
*
|
||||||
|
@ -182,6 +286,34 @@ BOOL WINAPI InstallColorProfileW( PCWSTR machine, PCWSTR profile )
|
||||||
return CopyFileW( profile, dest, TRUE );
|
return CopyFileW( profile, dest, TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* IsColorProfileTagPresent [MSCMS.@]
|
||||||
|
*
|
||||||
|
* Determine if a given ICC tag is present in a color profile.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* profile [I] Color profile handle.
|
||||||
|
* tag [I] ICC tag.
|
||||||
|
* present [O] Pointer to a BOOL variable. Set to TRUE if tag is present,
|
||||||
|
* FALSE otherwise.
|
||||||
|
*
|
||||||
|
* RETURNS
|
||||||
|
* Success: TRUE
|
||||||
|
* Failure: FALSE
|
||||||
|
*/
|
||||||
|
BOOL WINAPI IsColorProfileTagPresent( HPROFILE profile, TAGTYPE tag, PBOOL present )
|
||||||
|
{
|
||||||
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
|
TRACE( "( %p, 0x%08lx, %p )\n", profile, tag, present );
|
||||||
|
|
||||||
|
#ifdef HAVE_LCMS_H
|
||||||
|
ret = cmsIsTag( MSCMS_hprofile2cmsprofile( profile ), tag );
|
||||||
|
|
||||||
|
#endif /* HAVE_LCMS_H */
|
||||||
|
return *present = ret;
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* IsColorProfileValid [MSCMS.@]
|
* IsColorProfileValid [MSCMS.@]
|
||||||
*
|
*
|
||||||
|
@ -268,7 +400,7 @@ HPROFILE WINAPI OpenColorProfileA( PPROFILE profile, DWORD access, DWORD sharing
|
||||||
{
|
{
|
||||||
HPROFILE handle = NULL;
|
HPROFILE handle = NULL;
|
||||||
|
|
||||||
TRACE( "( %p, %lx, %lx, %lx )\n", profile, access, sharing, creation );
|
TRACE( "( %p, 0x%08lx, 0x%08lx, 0x%08lx )\n", profile, access, sharing, creation );
|
||||||
|
|
||||||
if (!profile || !profile->pProfileData) return NULL;
|
if (!profile || !profile->pProfileData) return NULL;
|
||||||
|
|
||||||
|
@ -325,7 +457,7 @@ HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing
|
||||||
cmsHPROFILE cmsprofile = NULL;
|
cmsHPROFILE cmsprofile = NULL;
|
||||||
HANDLE handle = NULL;
|
HANDLE handle = NULL;
|
||||||
|
|
||||||
TRACE( "( %p, %lx, %lx, %lx )\n", profile, access, sharing, creation );
|
TRACE( "( %p, 0x%08lx, 0x%08lx, 0x%08lx )\n", profile, access, sharing, creation );
|
||||||
|
|
||||||
if (!profile || !profile->pProfileData) return NULL;
|
if (!profile || !profile->pProfileData) return NULL;
|
||||||
|
|
||||||
|
|
|
@ -144,6 +144,53 @@ static void test_GetColorDirectoryW()
|
||||||
ok( ret, "GetColorDirectoryW() failed (%ld)\n", GetLastError() );
|
ok( ret, "GetColorDirectoryW() failed (%ld)\n", GetLastError() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_GetColorProfileElementTag()
|
||||||
|
{
|
||||||
|
if (standardprofile)
|
||||||
|
{
|
||||||
|
PROFILE profile;
|
||||||
|
HPROFILE handle;
|
||||||
|
BOOL ret;
|
||||||
|
DWORD index = 1;
|
||||||
|
TAGTYPE tag, expect = 0x63707274; /* 'cprt' */
|
||||||
|
|
||||||
|
profile.dwType = PROFILE_FILENAME;
|
||||||
|
profile.pProfileData = standardprofile;
|
||||||
|
profile.cbDataSize = strlen(standardprofile);
|
||||||
|
|
||||||
|
handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
|
||||||
|
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
||||||
|
|
||||||
|
ret = GetColorProfileElementTag( handle, index, &tag );
|
||||||
|
ok( ret && tag == expect, "GetColorProfileElementTag() failed (%ld)\n", GetLastError() );
|
||||||
|
|
||||||
|
CloseColorProfile( handle );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_GetCountColorProfileElements()
|
||||||
|
{
|
||||||
|
if (standardprofile)
|
||||||
|
{
|
||||||
|
PROFILE profile;
|
||||||
|
HPROFILE handle;
|
||||||
|
BOOL ret;
|
||||||
|
DWORD count, expect = 17;
|
||||||
|
|
||||||
|
profile.dwType = PROFILE_FILENAME;
|
||||||
|
profile.pProfileData = standardprofile;
|
||||||
|
profile.cbDataSize = strlen(standardprofile);
|
||||||
|
|
||||||
|
handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
|
||||||
|
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
||||||
|
|
||||||
|
ret = GetCountColorProfileElements( handle, &count );
|
||||||
|
ok( ret && count == expect, "GetCountColorProfileElements() failed (%ld)\n", GetLastError() );
|
||||||
|
|
||||||
|
CloseColorProfile( handle );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void test_InstallColorProfileA()
|
static void test_InstallColorProfileA()
|
||||||
{
|
{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
@ -246,6 +293,36 @@ static void test_InstallColorProfileW()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_IsColorProfileTagPresent()
|
||||||
|
{
|
||||||
|
if (standardprofile)
|
||||||
|
{
|
||||||
|
PROFILE profile;
|
||||||
|
HPROFILE handle;
|
||||||
|
BOOL ret, present;
|
||||||
|
TAGTYPE tag;
|
||||||
|
|
||||||
|
profile.dwType = PROFILE_FILENAME;
|
||||||
|
profile.pProfileData = standardprofile;
|
||||||
|
profile.cbDataSize = strlen(standardprofile);
|
||||||
|
|
||||||
|
handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
|
||||||
|
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
||||||
|
|
||||||
|
tag = 0;
|
||||||
|
|
||||||
|
ret = IsColorProfileTagPresent( handle, tag, &present );
|
||||||
|
ok( !(ret && present), "IsColorProfileTagPresent() succeeded (%ld)\n", GetLastError() );
|
||||||
|
|
||||||
|
tag = 0x63707274; /* 'cprt' */
|
||||||
|
|
||||||
|
ret = IsColorProfileTagPresent( handle, tag, &present );
|
||||||
|
ok( ret && present, "IsColorProfileTagPresent() failed (%ld)\n", GetLastError() );
|
||||||
|
|
||||||
|
CloseColorProfile( handle );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void test_OpenColorProfileA()
|
static void test_OpenColorProfileA()
|
||||||
{
|
{
|
||||||
PROFILE profile;
|
PROFILE profile;
|
||||||
|
@ -459,7 +536,6 @@ START_TEST(profile)
|
||||||
{
|
{
|
||||||
if (CopyFileA( standardprofile, file, FALSE ))
|
if (CopyFileA( standardprofile, file, FALSE ))
|
||||||
{
|
{
|
||||||
|
|
||||||
testprofile = (LPSTR)&file;
|
testprofile = (LPSTR)&file;
|
||||||
|
|
||||||
len = MultiByteToWideChar( CP_ACP, 0, testprofile, -1, NULL, 0 );
|
len = MultiByteToWideChar( CP_ACP, 0, testprofile, -1, NULL, 0 );
|
||||||
|
@ -473,9 +549,14 @@ START_TEST(profile)
|
||||||
test_GetColorDirectoryA();
|
test_GetColorDirectoryA();
|
||||||
test_GetColorDirectoryW();
|
test_GetColorDirectoryW();
|
||||||
|
|
||||||
|
test_GetColorProfileElementTag();
|
||||||
|
test_GetCountColorProfileElements();
|
||||||
|
|
||||||
test_InstallColorProfileA();
|
test_InstallColorProfileA();
|
||||||
test_InstallColorProfileW();
|
test_InstallColorProfileW();
|
||||||
|
|
||||||
|
test_IsColorProfileTagPresent();
|
||||||
|
|
||||||
test_OpenColorProfileA();
|
test_OpenColorProfileA();
|
||||||
test_OpenColorProfileW();
|
test_OpenColorProfileW();
|
||||||
|
|
||||||
|
|
|
@ -158,9 +158,16 @@ BOOL WINAPI CloseColorProfile(HPROFILE);
|
||||||
BOOL WINAPI GetColorDirectoryA(PCSTR,PSTR,PDWORD);
|
BOOL WINAPI GetColorDirectoryA(PCSTR,PSTR,PDWORD);
|
||||||
BOOL WINAPI GetColorDirectoryW(PCWSTR,PWSTR,PDWORD);
|
BOOL WINAPI GetColorDirectoryW(PCWSTR,PWSTR,PDWORD);
|
||||||
#define GetColorDirectory WINELIB_NAME_AW(GetColorDirectory)
|
#define GetColorDirectory WINELIB_NAME_AW(GetColorDirectory)
|
||||||
|
BOOL WINAPI GetColorProfileElement(HPROFILE,TAGTYPE,DWORD,PDWORD,PVOID,PBOOL);
|
||||||
|
BOOL WINAPI GetColorProfileElementTag(HPROFILE,DWORD,PTAGTYPE);
|
||||||
|
BOOL WINAPI GetCountColorProfileElements(HPROFILE,PDWORD);
|
||||||
|
BOOL WINAPI GetStandardColorSpaceProfileA(PCSTR,DWORD,PSTR,PDWORD);
|
||||||
|
BOOL WINAPI GetStandardColorSpaceProfileW(PCWSTR,DWORD,PWSTR,PDWORD);
|
||||||
|
#define GetStandardColorSpaceProfile WINELIB_NAME_AW(GetStandardColorSpaceProfile)
|
||||||
BOOL WINAPI InstallColorProfileA(PCSTR,PCSTR);
|
BOOL WINAPI InstallColorProfileA(PCSTR,PCSTR);
|
||||||
BOOL WINAPI InstallColorProfileW(PCWSTR,PCWSTR);
|
BOOL WINAPI InstallColorProfileW(PCWSTR,PCWSTR);
|
||||||
#define InstallColorProfile WINELIB_NAME_AW(InstallColorProfile)
|
#define InstallColorProfile WINELIB_NAME_AW(InstallColorProfile)
|
||||||
|
BOOL WINAPI IsColorProfileTagPresent(HPROFILE,TAGTYPE,PBOOL);
|
||||||
BOOL WINAPI IsColorProfileValid(HPROFILE,PBOOL);
|
BOOL WINAPI IsColorProfileValid(HPROFILE,PBOOL);
|
||||||
HPROFILE WINAPI OpenColorProfileA(PPROFILE,DWORD,DWORD,DWORD);
|
HPROFILE WINAPI OpenColorProfileA(PPROFILE,DWORD,DWORD,DWORD);
|
||||||
HPROFILE WINAPI OpenColorProfileW(PPROFILE,DWORD,DWORD,DWORD);
|
HPROFILE WINAPI OpenColorProfileW(PPROFILE,DWORD,DWORD,DWORD);
|
||||||
|
|
Loading…
Reference in New Issue