Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
d2c9e556
Commit
d2c9e556
authored
Aug 06, 2015
by
Hans Leidekker
Committed by
Alexandre Julliard
Aug 06, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mscms: Let liblcms2 determine input and output format for transform profiles.
parent
ee849808
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
68 deletions
+71
-68
profile.c
dlls/mscms/tests/profile.c
+37
-0
transform.c
dlls/mscms/transform.c
+34
-68
No files found.
dlls/mscms/tests/profile.c
View file @
d2c9e556
...
...
@@ -35,6 +35,8 @@ static HMODULE huser32;
static
BOOL
(
WINAPI
*
pAssociateColorProfileWithDeviceA
)(
PCSTR
,
PCSTR
,
PCSTR
);
static
BOOL
(
WINAPI
*
pCloseColorProfile
)(
HPROFILE
);
static
HTRANSFORM
(
WINAPI
*
pCreateMultiProfileTransform
)(
PHPROFILE
,
DWORD
,
PDWORD
,
DWORD
,
DWORD
,
DWORD
);
static
BOOL
(
WINAPI
*
pDeleteColorTransform
)(
HTRANSFORM
);
static
BOOL
(
WINAPI
*
pDisassociateColorProfileFromDeviceA
)(
PCSTR
,
PCSTR
,
PCSTR
);
static
BOOL
(
WINAPI
*
pGetColorDirectoryA
)(
PCHAR
,
PCHAR
,
PDWORD
);
static
BOOL
(
WINAPI
*
pGetColorDirectoryW
)(
PWCHAR
,
PWCHAR
,
PDWORD
);
...
...
@@ -68,6 +70,8 @@ static BOOL init_function_ptrs( void )
{
GETFUNCPTR
(
AssociateColorProfileWithDeviceA
)
GETFUNCPTR
(
CloseColorProfile
)
GETFUNCPTR
(
CreateMultiProfileTransform
)
GETFUNCPTR
(
DeleteColorTransform
)
GETFUNCPTR
(
DisassociateColorProfileFromDeviceA
)
GETFUNCPTR
(
GetColorDirectoryA
)
GETFUNCPTR
(
GetColorDirectoryW
)
...
...
@@ -1334,6 +1338,38 @@ static BOOL have_profile(void)
return
TRUE
;
}
static
void
test_CreateMultiProfileTransform
(
char
*
standardprofile
,
char
*
testprofile
)
{
PROFILE
profile
;
HPROFILE
handle
[
2
];
HTRANSFORM
transform
;
DWORD
intents
[
2
]
=
{
INTENT_PERCEPTUAL
,
INTENT_PERCEPTUAL
};
if
(
testprofile
)
{
profile
.
dwType
=
PROFILE_FILENAME
;
profile
.
pProfileData
=
standardprofile
;
profile
.
cbDataSize
=
strlen
(
standardprofile
);
handle
[
0
]
=
pOpenColorProfileA
(
&
profile
,
PROFILE_READ
,
0
,
OPEN_EXISTING
);
ok
(
handle
[
0
]
!=
NULL
,
"got %u
\n
"
,
GetLastError
()
);
profile
.
dwType
=
PROFILE_FILENAME
;
profile
.
pProfileData
=
testprofile
;
profile
.
cbDataSize
=
strlen
(
testprofile
);
handle
[
1
]
=
pOpenColorProfileA
(
&
profile
,
PROFILE_READ
,
0
,
OPEN_EXISTING
);
ok
(
handle
[
1
]
!=
NULL
,
"got %u
\n
"
,
GetLastError
()
);
transform
=
pCreateMultiProfileTransform
(
handle
,
2
,
intents
,
2
,
0
,
0
);
ok
(
transform
!=
NULL
,
"got %u
\n
"
,
GetLastError
()
);
pDeleteColorTransform
(
transform
);
pCloseColorProfile
(
handle
[
0
]
);
pCloseColorProfile
(
handle
[
1
]
);
}
}
START_TEST
(
profile
)
{
UINT
len
;
...
...
@@ -1443,6 +1479,7 @@ START_TEST(profile)
test_UninstallColorProfileW
(
testprofileW
);
test_AssociateColorProfileWithDeviceA
(
testprofile
);
test_CreateMultiProfileTransform
(
standardprofile
,
testprofile
);
if
(
testprofile
)
DeleteFileA
(
testprofile
);
FreeLibrary
(
huser32
);
...
...
dlls/mscms/transform.c
View file @
d2c9e556
...
...
@@ -36,64 +36,51 @@ WINE_DEFAULT_DEBUG_CHANNEL(mscms);
#ifdef HAVE_LCMS2
static
DWORD
from_profile
(
HPROFILE
profile
)
{
PROFILEHEADER
header
;
GetColorProfileHeader
(
profile
,
&
header
);
TRACE
(
"color space: 0x%08x %s
\n
"
,
header
.
phDataColorSpace
,
dbgstr_tag
(
header
.
phDataColorSpace
)
);
switch
(
header
.
phDataColorSpace
)
{
case
0x434d594b
:
return
TYPE_CMYK_16
;
/* 'CMYK' */
case
0x47524159
:
return
TYPE_GRAY_16
;
/* 'GRAY' */
case
0x4c616220
:
return
TYPE_Lab_16
;
/* 'Lab ' */
case
0x52474220
:
return
TYPE_RGB_16
;
/* 'RGB ' */
case
0x58595a20
:
return
TYPE_XYZ_16
;
/* 'XYZ ' */
default:
WARN
(
"unhandled format
\n
"
);
return
TYPE_RGB_16
;
}
}
static
DWORD
from_bmformat
(
BMFORMAT
format
)
{
static
BOOL
quietfixme
=
FALSE
;
TRACE
(
"bitmap format: 0x%08x
\n
"
,
format
)
;
DWORD
ret
;
switch
(
format
)
{
case
BM_RGBTRIPLETS
:
ret
urn
TYPE_RGB_8
;
case
BM_BGRTRIPLETS
:
ret
urn
TYPE_BGR_8
;
case
BM_GRAY
:
ret
urn
TYPE_GRAY_8
;
case
BM_xRGBQUADS
:
ret
urn
TYPE_ARGB_8
;
case
BM_xBGRQUADS
:
ret
urn
TYPE_ABGR_8
;
case
BM_RGBTRIPLETS
:
ret
=
TYPE_RGB_8
;
break
;
case
BM_BGRTRIPLETS
:
ret
=
TYPE_BGR_8
;
break
;
case
BM_GRAY
:
ret
=
TYPE_GRAY_8
;
break
;
case
BM_xRGBQUADS
:
ret
=
TYPE_ARGB_8
;
break
;
case
BM_xBGRQUADS
:
ret
=
TYPE_ABGR_8
;
break
;
default:
if
(
!
quietfixme
)
{
FIXME
(
"unhandled bitmap format 0x%x
\n
"
,
format
);
FIXME
(
"unhandled bitmap format %08x
\n
"
,
format
);
quietfixme
=
TRUE
;
}
return
TYPE_RGB_8
;
ret
=
TYPE_RGB_8
;
break
;
}
TRACE
(
"color space: %08x -> %08x
\n
"
,
format
,
ret
);
return
ret
;
}
static
DWORD
from_type
(
COLORTYPE
type
)
{
TRACE
(
"color type: 0x%08x
\n
"
,
type
)
;
DWORD
ret
;
switch
(
type
)
{
case
COLOR_GRAY
:
return
TYPE_GRAY_16
;
case
COLOR_RGB
:
return
TYPE_RGB_16
;
case
COLOR_XYZ
:
return
TYPE_XYZ_16
;
case
COLOR_Yxy
:
return
TYPE_Yxy_16
;
case
COLOR_Lab
:
return
TYPE_Lab_16
;
case
COLOR_CMYK
:
return
TYPE_CMYK_16
;
case
COLOR_GRAY
:
ret
=
TYPE_GRAY_16
;
break
;
case
COLOR_RGB
:
ret
=
TYPE_RGB_16
;
break
;
case
COLOR_XYZ
:
ret
=
TYPE_XYZ_16
;
break
;
case
COLOR_Yxy
:
ret
=
TYPE_Yxy_16
;
break
;
case
COLOR_Lab
:
ret
=
TYPE_Lab_16
;
break
;
case
COLOR_CMYK
:
ret
=
TYPE_CMYK_16
;
break
;
default:
FIXME
(
"unhandled color type
\n
"
);
return
TYPE_RGB_16
;
FIXME
(
"unhandled color type %08x
\n
"
,
type
);
ret
=
TYPE_RGB_16
;
break
;
}
TRACE
(
"color type: %08x -> %08x
\n
"
,
type
,
ret
);
return
ret
;
}
#endif
/* HAVE_LCMS2 */
...
...
@@ -145,7 +132,7 @@ HTRANSFORM WINAPI CreateColorTransformW( LPLOGCOLORSPACEW space, HPROFILE dest,
struct
transform
transform
;
struct
profile
*
dst
,
*
tgt
=
NULL
;
cmsHPROFILE
cmsinput
,
cmsoutput
,
cmstarget
=
NULL
;
DWORD
in_format
,
out_format
,
proofing
=
0
;
DWORD
proofing
=
0
;
int
intent
;
TRACE
(
"( %p, %p, %p, 0x%08x )
\n
"
,
space
,
dest
,
target
,
flags
);
...
...
@@ -163,9 +150,6 @@ HTRANSFORM WINAPI CreateColorTransformW( LPLOGCOLORSPACEW space, HPROFILE dest,
TRACE
(
"lcsCSType: %s
\n
"
,
dbgstr_tag
(
space
->
lcsCSType
)
);
TRACE
(
"lcsFilename: %s
\n
"
,
debugstr_w
(
space
->
lcsFilename
)
);
in_format
=
TYPE_RGB_16
;
out_format
=
from_profile
(
dest
);
cmsinput
=
cmsCreate_sRGBProfile
();
/* FIXME: create from supplied color space */
if
(
target
)
{
...
...
@@ -173,8 +157,9 @@ HTRANSFORM WINAPI CreateColorTransformW( LPLOGCOLORSPACEW space, HPROFILE dest,
cmstarget
=
tgt
->
cmsprofile
;
}
cmsoutput
=
dst
->
cmsprofile
;
transform
.
cmstransform
=
cmsCreateProofingTransform
(
cmsinput
,
in_format
,
cmsoutput
,
out_format
,
cmstarget
,
intent
,
INTENT_ABSOLUTE_COLORIMETRIC
,
proofing
);
transform
.
cmstransform
=
cmsCreateProofingTransform
(
cmsinput
,
0
,
cmsoutput
,
0
,
cmstarget
,
intent
,
INTENT_ABSOLUTE_COLORIMETRIC
,
proofing
);
if
(
!
transform
.
cmstransform
)
{
if
(
tgt
)
release_profile
(
tgt
);
...
...
@@ -212,10 +197,9 @@ HTRANSFORM WINAPI CreateMultiProfileTransform( PHPROFILE profiles, DWORD nprofil
{
HTRANSFORM
ret
=
NULL
;
#ifdef HAVE_LCMS2
cmsHPROFILE
*
cmsprofiles
,
cmsconvert
=
NULL
;
cmsHPROFILE
*
cmsprofiles
;
struct
transform
transform
;
struct
profile
*
profile0
,
*
profile1
;
DWORD
in_format
,
out_format
;
TRACE
(
"( %p, 0x%08x, %p, 0x%08x, 0x%08x, 0x%08x )
\n
"
,
profiles
,
nprofiles
,
intents
,
nintents
,
flags
,
cmm
);
...
...
@@ -236,32 +220,14 @@ HTRANSFORM WINAPI CreateMultiProfileTransform( PHPROFILE profiles, DWORD nprofil
release_profile
(
profile0
);
return
NULL
;
}
in_format
=
from_profile
(
profiles
[
0
]
);
out_format
=
from_profile
(
profiles
[
nprofiles
-
1
]
);
if
(
in_format
!=
out_format
)
{
/* insert a conversion profile for pairings that lcms doesn't handle */
if
(
out_format
==
TYPE_RGB_16
)
cmsconvert
=
cmsCreate_sRGBProfile
();
if
(
out_format
==
TYPE_Lab_16
)
cmsconvert
=
cmsCreateLab2Profile
(
NULL
);
}
cmsprofiles
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
nprofiles
+
1
)
*
sizeof
(
cmsHPROFILE
)
);
if
(
cmsprofiles
)
if
((
cmsprofiles
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
nprofiles
+
1
)
*
sizeof
(
cmsHPROFILE
)
)))
{
cmsprofiles
[
0
]
=
profile0
->
cmsprofile
;
if
(
cmsconvert
)
{
cmsprofiles
[
1
]
=
cmsconvert
;
cmsprofiles
[
2
]
=
profile1
->
cmsprofile
;
nprofiles
++
;
}
else
{
cmsprofiles
[
1
]
=
profile1
->
cmsprofile
;
}
transform
.
cmstransform
=
cmsCreateMultiprofileTransform
(
cmsprofiles
,
nprofiles
,
in_format
,
out_format
,
*
intents
,
0
);
cmsprofiles
[
1
]
=
profile1
->
cmsprofile
;
transform
.
cmstransform
=
cmsCreateMultiprofileTransform
(
cmsprofiles
,
nprofiles
,
0
,
0
,
*
intents
,
0
);
HeapFree
(
GetProcessHeap
(),
0
,
cmsprofiles
);
if
(
!
transform
.
cmstransform
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment