Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
d7d5fb0a
Commit
d7d5fb0a
authored
Nov 07, 2010
by
Vladimir Panteleev
Committed by
Alexandre Julliard
Nov 08, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Add X11DRV_PALETTE_GetColor function to resolve any COLORREF to an RGB.
parent
5e95d703
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
6 deletions
+45
-6
palette.c
dlls/winex11.drv/palette.c
+44
-6
x11drv.h
dlls/winex11.drv/x11drv.h
+1
-0
No files found.
dlls/winex11.drv/palette.c
View file @
d7d5fb0a
...
...
@@ -874,6 +874,49 @@ static inline BOOL colour_is_brighter(RGBQUAD c1, RGBQUAD c2)
}
/***********************************************************************
* X11DRV_PALETTE_GetColor
*
* Resolve PALETTEINDEX/PALETTERGB/DIBINDEX COLORREFs to an RGB COLORREF.
*/
COLORREF
X11DRV_PALETTE_GetColor
(
X11DRV_PDEVICE
*
physDev
,
COLORREF
color
)
{
HPALETTE
hPal
=
GetCurrentObject
(
physDev
->
hdc
,
OBJ_PAL
);
unsigned
char
spec_type
=
color
>>
24
;
unsigned
idx
=
color
&
0xffff
;
PALETTEENTRY
entry
;
RGBQUAD
quad
;
switch
(
spec_type
)
{
case
2
:
/* PALETTERGB */
idx
=
GetNearestPaletteIndex
(
hPal
,
color
);
/* fall through to PALETTEINDEX */
case
1
:
/* PALETTEINDEX */
if
(
!
GetPaletteEntries
(
hPal
,
idx
,
1
,
&
entry
))
{
WARN
(
"PALETTEINDEX(%x) : idx %d is out of bounds, assuming black
\n
"
,
color
,
idx
);
return
0
;
}
return
RGB
(
entry
.
peRed
,
entry
.
peGreen
,
entry
.
peBlue
);
case
0x10
:
/* DIBINDEX */
if
(
GetDIBColorTable
(
physDev
->
hdc
,
idx
,
1
,
&
quad
)
!=
1
)
{
WARN
(
"DIBINDEX(%x) : idx %d is out of bounds, assuming black
\n
"
,
color
,
idx
);
return
0
;
}
return
RGB
(
quad
.
rgbRed
,
quad
.
rgbGreen
,
quad
.
rgbBlue
);
default:
color
&=
0xffffff
;
/* fall through to RGB */
case
0
:
/* RGB */
return
color
;
}
}
/***********************************************************************
* X11DRV_PALETTE_ToPhysical
*
* Return the physical color closest to 'color'.
...
...
@@ -898,16 +941,11 @@ int X11DRV_PALETTE_ToPhysical( X11DRV_PDEVICE *physDev, COLORREF color )
unsigned
long
red
,
green
,
blue
;
unsigned
idx
=
color
&
0xffff
;
RGBQUAD
quad
;
switch
(
spec_type
)
{
case
0x10
:
/* DIBINDEX */
if
(
GetDIBColorTable
(
physDev
->
hdc
,
idx
,
1
,
&
quad
)
!=
1
)
{
WARN
(
"DIBINDEX(%x) : idx %d is out of bounds, assuming black
\n
"
,
color
,
idx
);
return
0
;
}
color
=
RGB
(
quad
.
rgbRed
,
quad
.
rgbGreen
,
quad
.
rgbBlue
);
color
=
X11DRV_PALETTE_GetColor
(
physDev
,
color
);
break
;
case
1
:
/* PALETTEINDEX */
...
...
dlls/winex11.drv/x11drv.h
View file @
d7d5fb0a
...
...
@@ -502,6 +502,7 @@ extern BOOL X11DRV_IsSolidColor(COLORREF color);
extern
COLORREF
X11DRV_PALETTE_ToLogical
(
X11DRV_PDEVICE
*
physDev
,
int
pixel
);
extern
int
X11DRV_PALETTE_ToPhysical
(
X11DRV_PDEVICE
*
physDev
,
COLORREF
color
);
extern
COLORREF
X11DRV_PALETTE_GetColor
(
X11DRV_PDEVICE
*
physDev
,
COLORREF
color
);
extern
int
X11DRV_PALETTE_LookupPixel
(
ColorShifts
*
shifts
,
COLORREF
color
);
extern
void
X11DRV_PALETTE_ComputeColorShifts
(
ColorShifts
*
shifts
,
unsigned
long
redMask
,
unsigned
long
greenMask
,
unsigned
long
blueMask
);
...
...
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