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
3e30e298
Commit
3e30e298
authored
Mar 24, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Mar 25, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mscms: Rewrite handle management to be thread-safe. Allocate handles dynamically.
parent
46489aed
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
88 additions
and
45 deletions
+88
-45
handle.c
dlls/mscms/handle.c
+0
-0
mscms_main.c
dlls/mscms/mscms_main.c
+3
-0
mscms_priv.h
dlls/mscms/mscms_priv.h
+33
-15
profile.c
dlls/mscms/profile.c
+0
-0
transform.c
dlls/mscms/transform.c
+52
-30
No files found.
dlls/mscms/handle.c
View file @
3e30e298
This diff is collapsed.
Click to expand it.
dlls/mscms/mscms_main.c
View file @
3e30e298
...
...
@@ -32,6 +32,8 @@
#include "winuser.h"
#include "icm.h"
#include "mscms_priv.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
mscms
);
BOOL
WINAPI
DllMain
(
HINSTANCE
hinst
,
DWORD
reason
,
LPVOID
reserved
)
...
...
@@ -44,6 +46,7 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
DisableThreadLibraryCalls
(
hinst
);
break
;
case
DLL_PROCESS_DETACH
:
free_handle_tables
();
break
;
}
return
TRUE
;
...
...
dlls/mscms/mscms_priv.h
View file @
3e30e298
...
...
@@ -66,21 +66,39 @@
#define DWORD DWORD
#define LPDWORD LPDWORD
extern
DWORD
MSCMS_hprofile2access
(
HPROFILE
);
extern
HPROFILE
MSCMS_handle2hprofile
(
HANDLE
file
);
extern
HPROFILE
MSCMS_cmsprofile2hprofile
(
cmsHPROFILE
cmsprofile
);
extern
HPROFILE
MSCMS_iccprofile2hprofile
(
const
icProfile
*
iccprofile
);
extern
HANDLE
MSCMS_hprofile2handle
(
HPROFILE
profile
);
extern
cmsHPROFILE
MSCMS_hprofile2cmsprofile
(
HPROFILE
profile
);
extern
icProfile
*
MSCMS_hprofile2iccprofile
(
HPROFILE
profile
);
extern
HPROFILE
MSCMS_create_hprofile_handle
(
HANDLE
file
,
icProfile
*
iccprofile
,
cmsHPROFILE
cmsprofile
,
DWORD
access
);
extern
void
MSCMS_destroy_hprofile_handle
(
HPROFILE
profile
);
extern
cmsHTRANSFORM
MSCMS_htransform2cmstransform
(
HTRANSFORM
transform
);
extern
HTRANSFORM
MSCMS_create_htransform_handle
(
cmsHTRANSFORM
cmstransform
);
extern
void
MSCMS_destroy_htransform_handle
(
HTRANSFORM
transform
);
/* A simple structure to tie together a pointer to an icc profile, an lcms
* color profile handle and a Windows file handle. If the profile is memory
* based the file handle field is set to INVALID_HANDLE_VALUE. The 'access'
* field records the access parameter supplied to an OpenColorProfile()
* call, i.e. PROFILE_READ or PROFILE_READWRITE.
*/
struct
profile
{
HANDLE
file
;
DWORD
access
;
icProfile
*
iccprofile
;
cmsHPROFILE
cmsprofile
;
};
struct
transform
{
cmsHTRANSFORM
cmstransform
;
};
extern
HPROFILE
create_profile
(
struct
profile
*
);
extern
BOOL
close_profile
(
HPROFILE
);
extern
HTRANSFORM
create_transform
(
struct
transform
*
);
extern
BOOL
close_transform
(
HTRANSFORM
);
struct
profile
*
grab_profile
(
HPROFILE
);
struct
transform
*
grab_transform
(
HTRANSFORM
);
void
release_profile
(
struct
profile
*
);
void
release_transform
(
struct
transform
*
);
extern
void
free_handle_tables
(
void
);
extern
DWORD
MSCMS_get_tag_count
(
const
icProfile
*
iccprofile
);
extern
void
MSCMS_get_tag_by_index
(
icProfile
*
iccprofile
,
DWORD
index
,
icTag
*
tag
);
...
...
dlls/mscms/profile.c
View file @
3e30e298
This diff is collapsed.
Click to expand it.
dlls/mscms/transform.c
View file @
3e30e298
...
...
@@ -135,15 +135,21 @@ HTRANSFORM WINAPI CreateColorTransformW( LPLOGCOLORSPACEW space, HPROFILE dest,
{
HTRANSFORM
ret
=
NULL
;
#ifdef HAVE_LCMS
cmsHTRANSFORM
cmstransform
;
struct
transform
transform
;
struct
profile
*
dst
,
*
tgt
=
NULL
;
cmsHPROFILE
cmsinput
,
cmsoutput
,
cmstarget
=
NULL
;
DWORD
in_format
,
out_format
,
proofing
=
0
;
int
intent
;
TRACE
(
"( %p, %p, %p, 0x%08x )
\n
"
,
space
,
dest
,
target
,
flags
);
if
(
!
space
||
!
dest
)
return
FALSE
;
if
(
!
space
||
!
(
dst
=
grab_profile
(
dest
))
)
return
FALSE
;
if
(
target
&&
!
(
tgt
=
grab_profile
(
target
)))
{
release_profile
(
dst
);
return
FALSE
;
}
intent
=
space
->
lcsIntent
>
3
?
INTENT_PERCEPTUAL
:
space
->
lcsIntent
;
TRACE
(
"lcsIntent: %x
\n
"
,
space
->
lcsIntent
);
...
...
@@ -157,13 +163,16 @@ HTRANSFORM WINAPI CreateColorTransformW( LPLOGCOLORSPACEW space, HPROFILE dest,
if
(
target
)
{
proofing
=
cmsFLAGS_SOFTPROOFING
;
cmstarget
=
MSCMS_hprofile2cmsprofile
(
target
)
;
cmstarget
=
tgt
->
cmsprofile
;
}
cmsoutput
=
MSCMS_hprofile2cmsprofile
(
dest
)
;
cmstransform
=
cmsCreateProofingTransform
(
cmsinput
,
in_format
,
cmsoutput
,
out_format
,
cmstarget
,
intent
,
INTENT_ABSOLUTE_COLORIMETRIC
,
proofing
);
cmsoutput
=
dst
->
cmsprofile
;
transform
.
cmstransform
=
cmsCreateProofingTransform
(
cmsinput
,
in_format
,
cmsoutput
,
out_format
,
cmstarget
,
intent
,
INTENT_ABSOLUTE_COLORIMETRIC
,
proofing
);
ret
=
MSCMS_create_htransform_handle
(
cmstransform
);
ret
=
create_transform
(
&
transform
);
if
(
tgt
)
release_profile
(
tgt
);
release_profile
(
dst
);
#endif
/* HAVE_LCMS */
return
ret
;
...
...
@@ -191,7 +200,8 @@ HTRANSFORM WINAPI CreateMultiProfileTransform( PHPROFILE profiles, DWORD nprofil
HTRANSFORM
ret
=
NULL
;
#ifdef HAVE_LCMS
cmsHPROFILE
*
cmsprofiles
,
cmsconvert
=
NULL
;
cmsHTRANSFORM
cmstransform
;
struct
transform
transform
;
struct
profile
*
profile0
,
*
profile1
;
DWORD
in_format
,
out_format
;
TRACE
(
"( %p, 0x%08x, %p, 0x%08x, 0x%08x, 0x%08x )
\n
"
,
...
...
@@ -205,6 +215,14 @@ HTRANSFORM WINAPI CreateMultiProfileTransform( PHPROFILE profiles, DWORD nprofil
return
NULL
;
}
profile0
=
grab_profile
(
profiles
[
0
]
);
if
(
!
profile0
)
return
NULL
;
profile1
=
grab_profile
(
profiles
[
1
]
);
if
(
!
profile1
)
{
release_profile
(
profile0
);
return
NULL
;
}
in_format
=
from_profile
(
profiles
[
0
]
);
out_format
=
from_profile
(
profiles
[
nprofiles
-
1
]
);
...
...
@@ -218,23 +236,26 @@ HTRANSFORM WINAPI CreateMultiProfileTransform( PHPROFILE profiles, DWORD nprofil
cmsprofiles
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
nprofiles
+
1
)
*
sizeof
(
cmsHPROFILE
*
)
);
if
(
cmsprofiles
)
{
cmsprofiles
[
0
]
=
MSCMS_hprofile2cmsprofile
(
profiles
[
0
]
)
;
cmsprofiles
[
0
]
=
profile0
->
cmsprofile
;
if
(
cmsconvert
)
{
cmsprofiles
[
1
]
=
cmsconvert
;
cmsprofiles
[
2
]
=
MSCMS_hprofile2cmsprofile
(
profiles
[
1
]
)
;
cmsprofiles
[
2
]
=
profile1
->
cmsprofile
;
nprofiles
++
;
}
else
{
cmsprofiles
[
1
]
=
MSCMS_hprofile2cmsprofile
(
profiles
[
1
]
)
;
cmsprofiles
[
1
]
=
profile1
->
cmsprofile
;
}
cmstransform
=
cmsCreateMultiprofileTransform
(
cmsprofiles
,
nprofiles
,
in_format
,
out_format
,
*
intents
,
0
);
transform
.
cmstransform
=
cmsCreateMultiprofileTransform
(
cmsprofiles
,
nprofiles
,
in_format
,
out_format
,
*
intents
,
0
);
HeapFree
(
GetProcessHeap
(),
0
,
cmsprofiles
);
ret
=
MSCMS_create_htransform_handle
(
cms
transform
);
ret
=
create_transform
(
&
transform
);
}
release_profile
(
profile0
);
release_profile
(
profile1
);
#endif
/* HAVE_LCMS */
return
ret
;
}
...
...
@@ -251,19 +272,14 @@ HTRANSFORM WINAPI CreateMultiProfileTransform( PHPROFILE profiles, DWORD nprofil
* Success: TRUE
* Failure: FALSE
*/
BOOL
WINAPI
DeleteColorTransform
(
HTRANSFORM
transform
)
BOOL
WINAPI
DeleteColorTransform
(
HTRANSFORM
handle
)
{
BOOL
ret
=
FALSE
;
#ifdef HAVE_LCMS
cmsHTRANSFORM
cmstransform
;
TRACE
(
"( %p )
\n
"
,
transform
);
TRACE
(
"( %p )
\n
"
,
handle
);
cmstransform
=
MSCMS_htransform2cmstransform
(
transform
);
cmsDeleteTransform
(
cmstransform
);
MSCMS_destroy_htransform_handle
(
transform
);
ret
=
TRUE
;
ret
=
close_transform
(
handle
);
#endif
/* HAVE_LCMS */
return
ret
;
...
...
@@ -291,22 +307,23 @@ BOOL WINAPI DeleteColorTransform( HTRANSFORM transform )
* Success: TRUE
* Failure: FALSE
*/
BOOL
WINAPI
TranslateBitmapBits
(
HTRANSFORM
transform
,
PVOID
srcbits
,
BMFORMAT
input
,
BOOL
WINAPI
TranslateBitmapBits
(
HTRANSFORM
handle
,
PVOID
srcbits
,
BMFORMAT
input
,
DWORD
width
,
DWORD
height
,
DWORD
inputstride
,
PVOID
destbits
,
BMFORMAT
output
,
DWORD
outputstride
,
PBMCALLBACKFN
callback
,
ULONG
data
)
{
BOOL
ret
=
FALSE
;
#ifdef HAVE_LCMS
cmsHTRANSFORM
cmstransform
;
struct
transform
*
transform
=
grab_transform
(
handle
)
;
TRACE
(
"( %p, %p, 0x%08x, 0x%08x, 0x%08x, 0x%08x, %p, 0x%08x, 0x%08x, %p, 0x%08x )
\n
"
,
transform
,
srcbits
,
input
,
width
,
height
,
inputstride
,
destbits
,
output
,
handle
,
srcbits
,
input
,
width
,
height
,
inputstride
,
destbits
,
output
,
outputstride
,
callback
,
data
);
cmstransform
=
MSCMS_htransform2cmstransform
(
transform
)
;
cmsChangeBuffersFormat
(
cmstransform
,
from_bmformat
(
input
),
from_bmformat
(
output
)
);
if
(
!
transform
)
return
FALSE
;
cmsChangeBuffersFormat
(
transform
->
cmstransform
,
from_bmformat
(
input
),
from_bmformat
(
output
)
);
cmsDoTransform
(
cmstransform
,
srcbits
,
destbits
,
width
*
height
);
cmsDoTransform
(
transform
->
cmstransform
,
srcbits
,
destbits
,
width
*
height
);
release_transform
(
transform
);
ret
=
TRUE
;
#endif
/* HAVE_LCMS */
...
...
@@ -330,16 +347,20 @@ BOOL WINAPI TranslateBitmapBits( HTRANSFORM transform, PVOID srcbits, BMFORMAT i
* Success: TRUE
* Failure: FALSE
*/
BOOL
WINAPI
TranslateColors
(
HTRANSFORM
transform
,
PCOLOR
in
,
DWORD
count
,
BOOL
WINAPI
TranslateColors
(
HTRANSFORM
handle
,
PCOLOR
in
,
DWORD
count
,
COLORTYPE
input_type
,
PCOLOR
out
,
COLORTYPE
output_type
)
{
BOOL
ret
=
FALSE
;
#ifdef HAVE_LCMS
cmsHTRANSFORM
xfrm
=
MSCMS_htransform2cmstransform
(
transform
);
struct
transform
*
transform
=
grab_transform
(
handle
);
cmsHTRANSFORM
xfrm
;
unsigned
int
i
;
TRACE
(
"( %p, %p, %d, %d, %p, %d )
\n
"
,
transform
,
in
,
count
,
input_type
,
out
,
output_type
);
TRACE
(
"( %p, %p, %d, %d, %p, %d )
\n
"
,
handle
,
in
,
count
,
input_type
,
out
,
output_type
);
if
(
!
transform
)
return
FALSE
;
xfrm
=
transform
->
cmstransform
;
cmsChangeBuffersFormat
(
xfrm
,
from_type
(
input_type
),
from_type
(
output_type
)
);
switch
(
input_type
)
...
...
@@ -418,6 +439,7 @@ BOOL WINAPI TranslateColors( HTRANSFORM transform, PCOLOR in, DWORD count,
FIXME
(
"unhandled input/output pair: %d/%d
\n
"
,
input_type
,
output_type
);
break
;
}
release_transform
(
transform
);
#endif
/* HAVE_LCMS */
return
ret
;
...
...
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