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
8255df56
Commit
8255df56
authored
Mar 19, 2010
by
Vincent Povirk
Committed by
Alexandre Julliard
Mar 22, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Make the IWICPalette implementation thread-safe.
parent
79662e2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
palette.c
dlls/windowscodecs/palette.c
+21
-0
No files found.
dlls/windowscodecs/palette.c
View file @
8255df56
...
...
@@ -40,6 +40,7 @@ typedef struct {
UINT
count
;
WICColor
*
colors
;
WICBitmapPaletteType
type
;
CRITICAL_SECTION
lock
;
/* must be held when count, colors, or type is accessed */
}
PaletteImpl
;
static
HRESULT
WINAPI
PaletteImpl_QueryInterface
(
IWICPalette
*
iface
,
REFIID
iid
,
...
...
@@ -83,6 +84,8 @@ static ULONG WINAPI PaletteImpl_Release(IWICPalette *iface)
if
(
ref
==
0
)
{
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
colors
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -117,10 +120,12 @@ static HRESULT WINAPI PaletteImpl_InitializeCustom(IWICPalette *iface,
memcpy
(
new_colors
,
pColors
,
sizeof
(
WICColor
)
*
colorCount
);
}
EnterCriticalSection
(
&
This
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
colors
);
This
->
colors
=
new_colors
;
This
->
count
=
colorCount
;
This
->
type
=
WICBitmapPaletteTypeCustom
;
LeaveCriticalSection
(
&
This
->
lock
);
return
S_OK
;
}
...
...
@@ -148,7 +153,9 @@ static HRESULT WINAPI PaletteImpl_GetType(IWICPalette *iface,
if
(
!
pePaletteType
)
return
E_INVALIDARG
;
EnterCriticalSection
(
&
This
->
lock
);
*
pePaletteType
=
This
->
type
;
LeaveCriticalSection
(
&
This
->
lock
);
return
S_OK
;
}
...
...
@@ -161,7 +168,9 @@ static HRESULT WINAPI PaletteImpl_GetColorCount(IWICPalette *iface, UINT *pcCoun
if
(
!
pcCount
)
return
E_INVALIDARG
;
EnterCriticalSection
(
&
This
->
lock
);
*
pcCount
=
This
->
count
;
LeaveCriticalSection
(
&
This
->
lock
);
return
S_OK
;
}
...
...
@@ -175,12 +184,16 @@ static HRESULT WINAPI PaletteImpl_GetColors(IWICPalette *iface, UINT colorCount,
if
(
!
pColors
||
!
pcActualColors
)
return
E_INVALIDARG
;
EnterCriticalSection
(
&
This
->
lock
);
if
(
This
->
count
<
colorCount
)
colorCount
=
This
->
count
;
memcpy
(
pColors
,
This
->
colors
,
sizeof
(
WICColor
)
*
colorCount
);
*
pcActualColors
=
colorCount
;
LeaveCriticalSection
(
&
This
->
lock
);
return
S_OK
;
}
...
...
@@ -192,10 +205,12 @@ static HRESULT WINAPI PaletteImpl_IsBlackWhite(IWICPalette *iface, BOOL *pfIsBla
if
(
!
pfIsBlackWhite
)
return
E_INVALIDARG
;
EnterCriticalSection
(
&
This
->
lock
);
if
(
This
->
type
==
WICBitmapPaletteTypeFixedBW
)
*
pfIsBlackWhite
=
TRUE
;
else
*
pfIsBlackWhite
=
FALSE
;
LeaveCriticalSection
(
&
This
->
lock
);
return
S_OK
;
}
...
...
@@ -208,6 +223,7 @@ static HRESULT WINAPI PaletteImpl_IsGrayscale(IWICPalette *iface, BOOL *pfIsGray
if
(
!
pfIsGrayscale
)
return
E_INVALIDARG
;
EnterCriticalSection
(
&
This
->
lock
);
switch
(
This
->
type
)
{
case
WICBitmapPaletteTypeFixedBW
:
...
...
@@ -219,6 +235,7 @@ static HRESULT WINAPI PaletteImpl_IsGrayscale(IWICPalette *iface, BOOL *pfIsGray
default:
*
pfIsGrayscale
=
FALSE
;
}
LeaveCriticalSection
(
&
This
->
lock
);
return
S_OK
;
}
...
...
@@ -234,12 +251,14 @@ static HRESULT WINAPI PaletteImpl_HasAlpha(IWICPalette *iface, BOOL *pfHasAlpha)
*
pfHasAlpha
=
FALSE
;
EnterCriticalSection
(
&
This
->
lock
);
for
(
i
=
0
;
i
<
This
->
count
;
i
++
)
if
((
This
->
colors
[
i
]
&
0xff000000
)
!=
0xff000000
)
{
*
pfHasAlpha
=
TRUE
;
break
;
}
LeaveCriticalSection
(
&
This
->
lock
);
return
S_OK
;
}
...
...
@@ -272,6 +291,8 @@ HRESULT PaletteImpl_Create(IWICPalette **palette)
This
->
count
=
0
;
This
->
colors
=
NULL
;
This
->
type
=
WICBitmapPaletteTypeCustom
;
InitializeCriticalSection
(
&
This
->
lock
);
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": PaletteImpl.lock"
);
*
palette
=
(
IWICPalette
*
)
This
;
...
...
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