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
608b2a94
Commit
608b2a94
authored
Feb 05, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Add a critical section for the palette global variables instead of…
winex11: Add a critical section for the palette global variables instead of relying on the GDI lock.
parent
8815e638
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
8 deletions
+36
-8
palette.c
dlls/winex11.drv/palette.c
+36
-8
No files found.
dlls/winex11.drv/palette.c
View file @
608b2a94
...
...
@@ -85,6 +85,15 @@ static unsigned char X11DRV_PALETTE_freeList[256];
static
XContext
palette_context
;
/* X context to associate a color mapping to a palette */
static
CRITICAL_SECTION
palette_cs
;
static
CRITICAL_SECTION_DEBUG
critsect_debug
=
{
0
,
0
,
&
palette_cs
,
{
&
critsect_debug
.
ProcessLocksList
,
&
critsect_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": palette_cs"
)
}
};
static
CRITICAL_SECTION
palette_cs
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
/**********************************************************************/
/* Map an EGA index (0..15) to a pixel value in the system color space. */
...
...
@@ -761,13 +770,19 @@ BOOL X11DRV_IsSolidColor( COLORREF color )
if
(
X11DRV_PALETTE_PaletteFlags
&
X11DRV_PALETTE_VIRTUAL
)
return
TRUE
;
/* no palette */
EnterCriticalSection
(
&
palette_cs
);
for
(
i
=
0
;
i
<
palette_size
;
i
++
,
pEntry
++
)
{
if
(
i
<
COLOR_gapStart
||
i
>
COLOR_gapEnd
)
if
((
GetRValue
(
color
)
==
pEntry
->
peRed
)
&&
(
GetGValue
(
color
)
==
pEntry
->
peGreen
)
&&
(
GetBValue
(
color
)
==
pEntry
->
peBlue
))
return
TRUE
;
(
GetBValue
(
color
)
==
pEntry
->
peBlue
))
{
LeaveCriticalSection
(
&
palette_cs
);
return
TRUE
;
}
}
LeaveCriticalSection
(
&
palette_cs
);
return
FALSE
;
}
...
...
@@ -810,8 +825,11 @@ COLORREF X11DRV_PALETTE_ToLogical(int pixel)
if
((
screen_depth
<=
8
)
&&
(
pixel
<
256
)
&&
!
(
X11DRV_PALETTE_PaletteFlags
&
(
X11DRV_PALETTE_VIRTUAL
|
X11DRV_PALETTE_FIXED
))
)
{
return
(
*
(
COLORREF
*
)(
COLOR_sysPal
+
((
X11DRV_PALETTE_XPixelToPalette
)
?
X11DRV_PALETTE_XPixelToPalette
[
pixel
]
:
pixel
))
)
&
0x00ffffff
;
COLORREF
ret
;
EnterCriticalSection
(
&
palette_cs
);
ret
=
*
(
COLORREF
*
)(
COLOR_sysPal
+
(
X11DRV_PALETTE_XPixelToPalette
?
X11DRV_PALETTE_XPixelToPalette
[
pixel
]
:
pixel
))
&
0x00ffffff
;
LeaveCriticalSection
(
&
palette_cs
);
return
ret
;
}
wine_tsx11_lock
();
...
...
@@ -972,8 +990,10 @@ int X11DRV_PALETTE_ToPhysical( X11DRV_PDEVICE *physDev, COLORREF color )
((
color
>>
8
)
&
0xff
)
+
(
color
&
0xff
)
>
255
*
3
/
2
)
?
white
:
1
-
white
;
}
EnterCriticalSection
(
&
palette_cs
);
index
=
X11DRV_SysPaletteLookupPixel
(
color
,
FALSE
);
if
(
X11DRV_PALETTE_PaletteToXPixel
)
index
=
X11DRV_PALETTE_PaletteToXPixel
[
index
];
LeaveCriticalSection
(
&
palette_cs
);
/* TRACE(palette,"RGB(%lx) -> pixel %i\n", color, index);
*/
...
...
@@ -1096,11 +1116,6 @@ UINT X11DRV_RealizePalette( X11DRV_PDEVICE *physDev, HPALETTE hpal, BOOL primary
if
(
!
GetObjectW
(
hpal
,
sizeof
(
num_entries
),
&
num_entries
))
return
0
;
/* reset dynamic system palette entries */
if
(
primary
&&
X11DRV_PALETTE_firstFree
!=
-
1
)
X11DRV_PALETTE_FormatSystemPalette
();
/* initialize palette mapping table */
prev_mapping
=
palette_get_mapping
(
hpal
);
if
(
prev_mapping
)
...
...
@@ -1121,6 +1136,12 @@ UINT X11DRV_RealizePalette( X11DRV_PDEVICE *physDev, HPALETTE hpal, BOOL primary
}
if
(
!
(
num_entries
=
GetPaletteEntries
(
hpal
,
0
,
num_entries
,
entries
)))
return
0
;
/* reset dynamic system palette entries */
EnterCriticalSection
(
&
palette_cs
);
if
(
primary
&&
X11DRV_PALETTE_firstFree
!=
-
1
)
X11DRV_PALETTE_FormatSystemPalette
();
for
(
i
=
0
;
i
<
num_entries
;
i
++
)
{
index
=
-
1
;
...
...
@@ -1193,6 +1214,7 @@ UINT X11DRV_RealizePalette( X11DRV_PDEVICE *physDev, HPALETTE hpal, BOOL primary
TRACE
(
"entry %i (%x) -> pixel %i
\n
"
,
i
,
*
(
COLORREF
*
)
&
entries
[
i
],
index
);
}
LeaveCriticalSection
(
&
palette_cs
);
return
iRemapped
;
}
...
...
@@ -1227,6 +1249,7 @@ UINT X11DRV_GetSystemPaletteEntries( X11DRV_PDEVICE *physDev, UINT start, UINT c
if
(
start
>=
palette_size
)
return
0
;
if
(
start
+
count
>=
palette_size
)
count
=
palette_size
-
start
;
EnterCriticalSection
(
&
palette_cs
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
entries
[
i
].
peRed
=
COLOR_sysPal
[
start
+
i
].
peRed
;
...
...
@@ -1235,6 +1258,7 @@ UINT X11DRV_GetSystemPaletteEntries( X11DRV_PDEVICE *physDev, UINT start, UINT c
entries
[
i
].
peFlags
=
0
;
TRACE
(
"
\t
idx(%02x) -> RGB(%08x)
\n
"
,
start
+
i
,
*
(
COLORREF
*
)(
entries
+
i
)
);
}
LeaveCriticalSection
(
&
palette_cs
);
return
count
;
}
...
...
@@ -1272,7 +1296,9 @@ COLORREF X11DRV_GetNearestColor( X11DRV_PDEVICE *physDev, COLORREF color )
color
=
RGB
(
entry
.
peRed
,
entry
.
peGreen
,
entry
.
peBlue
);
}
color
&=
0x00ffffff
;
EnterCriticalSection
(
&
palette_cs
);
nearest
=
(
0x00ffffff
&
*
(
COLORREF
*
)(
COLOR_sysPal
+
X11DRV_SysPaletteLookupPixel
(
color
,
FALSE
)));
LeaveCriticalSection
(
&
palette_cs
);
TRACE
(
"(%06x): returning %06x
\n
"
,
color
,
nearest
);
return
nearest
;
...
...
@@ -1293,6 +1319,7 @@ UINT X11DRV_RealizeDefaultPalette( X11DRV_PDEVICE *physDev )
PALETTEENTRY
entries
[
NB_RESERVED_COLORS
];
GetPaletteEntries
(
GetStockObject
(
DEFAULT_PALETTE
),
0
,
NB_RESERVED_COLORS
,
entries
);
EnterCriticalSection
(
&
palette_cs
);
for
(
i
=
0
;
i
<
NB_RESERVED_COLORS
;
i
++
)
{
index
=
X11DRV_PALETTE_LookupSystemXPixel
(
RGB
(
entries
[
i
].
peRed
,
...
...
@@ -1305,6 +1332,7 @@ UINT X11DRV_RealizeDefaultPalette( X11DRV_PDEVICE *physDev )
ret
++
;
}
}
LeaveCriticalSection
(
&
palette_cs
);
}
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