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
0d27e3c0
Commit
0d27e3c0
authored
Mar 11, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add null driver entry points for the palette functions.
parent
e030b3ce
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
51 deletions
+60
-51
dc.c
dlls/gdi32/dc.c
+2
-1
driver.c
dlls/gdi32/driver.c
+20
-4
gdi_private.h
dlls/gdi32/gdi_private.h
+1
-0
palette.c
dlls/gdi32/palette.c
+37
-46
No files found.
dlls/gdi32/dc.c
View file @
0d27e3c0
...
@@ -274,7 +274,8 @@ static BOOL DC_DeleteObject( HGDIOBJ handle )
...
@@ -274,7 +274,8 @@ static BOOL DC_DeleteObject( HGDIOBJ handle )
*/
*/
void
DC_InitDC
(
DC
*
dc
)
void
DC_InitDC
(
DC
*
dc
)
{
{
if
(
dc
->
funcs
->
pRealizeDefaultPalette
)
dc
->
funcs
->
pRealizeDefaultPalette
(
dc
->
physDev
);
PHYSDEV
physdev
=
GET_DC_PHYSDEV
(
dc
,
pRealizeDefaultPalette
);
physdev
->
funcs
->
pRealizeDefaultPalette
(
physdev
);
SetTextColor
(
dc
->
hSelf
,
dc
->
textColor
);
SetTextColor
(
dc
->
hSelf
,
dc
->
textColor
);
SetBkColor
(
dc
->
hSelf
,
dc
->
backgroundColor
);
SetBkColor
(
dc
->
hSelf
,
dc
->
backgroundColor
);
SelectObject
(
dc
->
hSelf
,
dc
->
hPen
);
SelectObject
(
dc
->
hSelf
,
dc
->
hPen
);
...
...
dlls/gdi32/driver.c
View file @
0d27e3c0
...
@@ -413,6 +413,12 @@ static INT CDECL nulldrv_GetPixelFormat( PHYSDEV dev )
...
@@ -413,6 +413,12 @@ static INT CDECL nulldrv_GetPixelFormat( PHYSDEV dev )
return
0
;
return
0
;
}
}
static
UINT
CDECL
nulldrv_GetSystemPaletteEntries
(
PHYSDEV
dev
,
UINT
start
,
UINT
count
,
PALETTEENTRY
*
entries
)
{
return
0
;
}
static
BOOL
CDECL
nulldrv_LineTo
(
PHYSDEV
dev
,
INT
x
,
INT
y
)
static
BOOL
CDECL
nulldrv_LineTo
(
PHYSDEV
dev
,
INT
x
,
INT
y
)
{
{
return
TRUE
;
return
TRUE
;
...
@@ -456,6 +462,16 @@ static BOOL CDECL nulldrv_Polyline( PHYSDEV dev, const POINT *points, INT count
...
@@ -456,6 +462,16 @@ static BOOL CDECL nulldrv_Polyline( PHYSDEV dev, const POINT *points, INT count
return
TRUE
;
return
TRUE
;
}
}
static
UINT
CDECL
nulldrv_RealizeDefaultPalette
(
PHYSDEV
dev
)
{
return
0
;
}
static
UINT
CDECL
nulldrv_RealizePalette
(
PHYSDEV
dev
,
HPALETTE
palette
,
BOOL
primary
)
{
return
0
;
}
static
BOOL
CDECL
nulldrv_Rectangle
(
PHYSDEV
dev
,
INT
left
,
INT
top
,
INT
right
,
INT
bottom
)
static
BOOL
CDECL
nulldrv_Rectangle
(
PHYSDEV
dev
,
INT
left
,
INT
top
,
INT
right
,
INT
bottom
)
{
{
return
TRUE
;
return
TRUE
;
...
@@ -706,10 +722,10 @@ const DC_FUNCTIONS null_driver =
...
@@ -706,10 +722,10 @@ const DC_FUNCTIONS null_driver =
NULL
,
/* pGetDeviceCaps */
NULL
,
/* pGetDeviceCaps */
nulldrv_GetDeviceGammaRamp
,
/* pGetDeviceGammaRamp */
nulldrv_GetDeviceGammaRamp
,
/* pGetDeviceGammaRamp */
nulldrv_GetICMProfile
,
/* pGetICMProfile */
nulldrv_GetICMProfile
,
/* pGetICMProfile */
NULL
,
/* pGetNearestColor */
nulldrv_GetNearestColor
,
/* pGetNearestColor */
nulldrv_GetPixel
,
/* pGetPixel */
nulldrv_GetPixel
,
/* pGetPixel */
nulldrv_GetPixelFormat
,
/* pGetPixelFormat */
nulldrv_GetPixelFormat
,
/* pGetPixelFormat */
NULL
,
/* pGetSystemPaletteEntries */
nulldrv_GetSystemPaletteEntries
,
/* pGetSystemPaletteEntries */
NULL
,
/* pGetTextExtentExPoint */
NULL
,
/* pGetTextExtentExPoint */
NULL
,
/* pGetTextMetrics */
NULL
,
/* pGetTextMetrics */
nulldrv_IntersectClipRect
,
/* pIntersectClipRect */
nulldrv_IntersectClipRect
,
/* pIntersectClipRect */
...
@@ -731,8 +747,8 @@ const DC_FUNCTIONS null_driver =
...
@@ -731,8 +747,8 @@ const DC_FUNCTIONS null_driver =
nulldrv_Polygon
,
/* pPolygon */
nulldrv_Polygon
,
/* pPolygon */
nulldrv_Polyline
,
/* pPolyline */
nulldrv_Polyline
,
/* pPolyline */
nulldrv_PolylineTo
,
/* pPolylineTo */
nulldrv_PolylineTo
,
/* pPolylineTo */
NULL
,
/* pRealizeDefaultPalette */
nulldrv_RealizeDefaultPalette
,
/* pRealizeDefaultPalette */
NULL
,
/* pRealizePalette */
nulldrv_RealizePalette
,
/* pRealizePalette */
nulldrv_Rectangle
,
/* pRectangle */
nulldrv_Rectangle
,
/* pRectangle */
NULL
,
/* pResetDC */
NULL
,
/* pResetDC */
NULL
,
/* pRestoreDC */
NULL
,
/* pRestoreDC */
...
...
dlls/gdi32/gdi_private.h
View file @
0d27e3c0
...
@@ -520,6 +520,7 @@ extern INT CDECL nulldrv_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT r
...
@@ -520,6 +520,7 @@ extern INT CDECL nulldrv_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT r
extern
INT
CDECL
nulldrv_ExtSelectClipRgn
(
PHYSDEV
dev
,
HRGN
rgn
,
INT
mode
)
DECLSPEC_HIDDEN
;
extern
INT
CDECL
nulldrv_ExtSelectClipRgn
(
PHYSDEV
dev
,
HRGN
rgn
,
INT
mode
)
DECLSPEC_HIDDEN
;
extern
BOOL
CDECL
nulldrv_FillRgn
(
PHYSDEV
dev
,
HRGN
rgn
,
HBRUSH
brush
)
DECLSPEC_HIDDEN
;
extern
BOOL
CDECL
nulldrv_FillRgn
(
PHYSDEV
dev
,
HRGN
rgn
,
HBRUSH
brush
)
DECLSPEC_HIDDEN
;
extern
BOOL
CDECL
nulldrv_FrameRgn
(
PHYSDEV
dev
,
HRGN
rgn
,
HBRUSH
brush
,
INT
width
,
INT
height
)
DECLSPEC_HIDDEN
;
extern
BOOL
CDECL
nulldrv_FrameRgn
(
PHYSDEV
dev
,
HRGN
rgn
,
HBRUSH
brush
,
INT
width
,
INT
height
)
DECLSPEC_HIDDEN
;
extern
COLORREF
CDECL
nulldrv_GetNearestColor
(
PHYSDEV
dev
,
COLORREF
color
)
DECLSPEC_HIDDEN
;
extern
INT
CDECL
nulldrv_IntersectClipRect
(
PHYSDEV
dev
,
INT
left
,
INT
top
,
INT
right
,
INT
bottom
)
DECLSPEC_HIDDEN
;
extern
INT
CDECL
nulldrv_IntersectClipRect
(
PHYSDEV
dev
,
INT
left
,
INT
top
,
INT
right
,
INT
bottom
)
DECLSPEC_HIDDEN
;
extern
BOOL
CDECL
nulldrv_InvertRgn
(
PHYSDEV
dev
,
HRGN
rgn
)
DECLSPEC_HIDDEN
;
extern
BOOL
CDECL
nulldrv_InvertRgn
(
PHYSDEV
dev
,
HRGN
rgn
)
DECLSPEC_HIDDEN
;
extern
INT
CDECL
nulldrv_OffsetClipRgn
(
PHYSDEV
dev
,
INT
x
,
INT
y
)
DECLSPEC_HIDDEN
;
extern
INT
CDECL
nulldrv_OffsetClipRgn
(
PHYSDEV
dev
,
INT
x
,
INT
y
)
DECLSPEC_HIDDEN
;
...
...
dlls/gdi32/palette.c
View file @
0d27e3c0
...
@@ -513,8 +513,8 @@ UINT WINAPI GetSystemPaletteEntries(
...
@@ -513,8 +513,8 @@ UINT WINAPI GetSystemPaletteEntries(
if
((
dc
=
get_dc_ptr
(
hdc
)))
if
((
dc
=
get_dc_ptr
(
hdc
)))
{
{
if
(
dc
->
funcs
->
pGetSystemPaletteEntries
)
PHYSDEV
physdev
=
GET_DC_PHYSDEV
(
dc
,
pGetSystemPaletteEntries
);
ret
=
dc
->
funcs
->
pGetSystemPaletteEntries
(
dc
->
physD
ev
,
start
,
count
,
entries
);
ret
=
physdev
->
funcs
->
pGetSystemPaletteEntries
(
physd
ev
,
start
,
count
,
entries
);
release_dc_ptr
(
dc
);
release_dc_ptr
(
dc
);
}
}
return
ret
;
return
ret
;
...
@@ -563,47 +563,22 @@ UINT WINAPI GetNearestPaletteIndex(
...
@@ -563,47 +563,22 @@ UINT WINAPI GetNearestPaletteIndex(
}
}
/***********************************************************************
/* null driver fallback implementation for GetNearestColor */
* GetNearestColor [GDI32.@]
COLORREF
CDECL
nulldrv_GetNearestColor
(
PHYSDEV
dev
,
COLORREF
color
)
*
* Gets a system color to match.
*
* RETURNS
* Success: Color from system palette that corresponds to given color
* Failure: CLR_INVALID
*/
COLORREF
WINAPI
GetNearestColor
(
HDC
hdc
,
/* [in] Handle of device context */
COLORREF
color
)
/* [in] Color to be matched */
{
{
unsigned
char
spec_type
;
unsigned
char
spec_type
;
COLORREF
nearest
;
DC
*
dc
;
if
(
!
(
dc
=
get_dc_ptr
(
hdc
)))
return
CLR_INVALID
;
if
(
!
(
GetDeviceCaps
(
dev
->
hdc
,
RASTERCAPS
)
&
RC_PALETTE
))
return
color
;
if
(
dc
->
funcs
->
pGetNearestColor
)
{
nearest
=
dc
->
funcs
->
pGetNearestColor
(
dc
->
physDev
,
color
);
release_dc_ptr
(
dc
);
return
nearest
;
}
if
(
!
(
GetDeviceCaps
(
hdc
,
RASTERCAPS
)
&
RC_PALETTE
))
{
release_dc_ptr
(
dc
);
return
color
;
}
spec_type
=
color
>>
24
;
spec_type
=
color
>>
24
;
if
(
spec_type
==
1
||
spec_type
==
2
)
if
(
spec_type
==
1
||
spec_type
==
2
)
{
{
/* we need logical palette for PALETTERGB and PALETTEINDEX colorrefs */
/* we need logical palette for PALETTERGB and PALETTEINDEX colorrefs */
UINT
index
;
UINT
index
;
PALETTEENTRY
entry
;
PALETTEENTRY
entry
;
HPALETTE
hpal
=
dc
->
hPalette
?
dc
->
hPalette
:
GetStockObject
(
DEFAULT_PALETTE
);
HPALETTE
hpal
=
GetCurrentObject
(
dev
->
hdc
,
OBJ_PAL
);
if
(
!
hpal
)
hpal
=
GetStockObject
(
DEFAULT_PALETTE
);
if
(
spec_type
==
2
)
/* PALETTERGB */
if
(
spec_type
==
2
)
/* PALETTERGB */
index
=
GetNearestPaletteIndex
(
hpal
,
color
);
index
=
GetNearestPaletteIndex
(
hpal
,
color
);
else
/* PALETTEINDEX */
else
/* PALETTEINDEX */
...
@@ -612,18 +587,36 @@ COLORREF WINAPI GetNearestColor(
...
@@ -612,18 +587,36 @@ COLORREF WINAPI GetNearestColor(
if
(
!
GetPaletteEntries
(
hpal
,
index
,
1
,
&
entry
))
if
(
!
GetPaletteEntries
(
hpal
,
index
,
1
,
&
entry
))
{
{
WARN
(
"RGB(%x) : idx %d is out of bounds, assuming NULL
\n
"
,
color
,
index
);
WARN
(
"RGB(%x) : idx %d is out of bounds, assuming NULL
\n
"
,
color
,
index
);
if
(
!
GetPaletteEntries
(
hpal
,
0
,
1
,
&
entry
))
if
(
!
GetPaletteEntries
(
hpal
,
0
,
1
,
&
entry
))
return
CLR_INVALID
;
{
release_dc_ptr
(
dc
);
return
CLR_INVALID
;
}
}
}
color
=
RGB
(
entry
.
peRed
,
entry
.
peGreen
,
entry
.
peBlue
);
color
=
RGB
(
entry
.
peRed
,
entry
.
peGreen
,
entry
.
peBlue
);
}
}
nearest
=
color
&
0x00ffffff
;
return
color
&
0x00ffffff
;
release_dc_ptr
(
dc
);
}
TRACE
(
"(%06x): returning %06x
\n
"
,
color
,
nearest
);
/***********************************************************************
* GetNearestColor [GDI32.@]
*
* Gets a system color to match.
*
* RETURNS
* Success: Color from system palette that corresponds to given color
* Failure: CLR_INVALID
*/
COLORREF
WINAPI
GetNearestColor
(
HDC
hdc
,
/* [in] Handle of device context */
COLORREF
color
)
/* [in] Color to be matched */
{
COLORREF
nearest
=
CLR_INVALID
;
DC
*
dc
;
if
((
dc
=
get_dc_ptr
(
hdc
)))
{
PHYSDEV
physdev
=
GET_DC_PHYSDEV
(
dc
,
pGetNearestColor
);
nearest
=
physdev
->
funcs
->
pGetNearestColor
(
physdev
,
color
);
release_dc_ptr
(
dc
);
}
return
nearest
;
return
nearest
;
}
}
...
@@ -729,23 +722,21 @@ UINT WINAPI GDIRealizePalette( HDC hdc )
...
@@ -729,23 +722,21 @@ UINT WINAPI GDIRealizePalette( HDC hdc )
if
(
dc
->
hPalette
==
GetStockObject
(
DEFAULT_PALETTE
))
if
(
dc
->
hPalette
==
GetStockObject
(
DEFAULT_PALETTE
))
{
{
if
(
dc
->
funcs
->
pRealizeDefaultPalette
)
PHYSDEV
physdev
=
GET_DC_PHYSDEV
(
dc
,
pRealizeDefaultPalette
);
realized
=
dc
->
funcs
->
pRealizeDefaultPalette
(
dc
->
physD
ev
);
realized
=
physdev
->
funcs
->
pRealizeDefaultPalette
(
physd
ev
);
}
}
else
if
(
InterlockedExchangePointer
(
(
void
**
)
&
hLastRealizedPalette
,
dc
->
hPalette
)
!=
dc
->
hPalette
)
else
if
(
InterlockedExchangePointer
(
(
void
**
)
&
hLastRealizedPalette
,
dc
->
hPalette
)
!=
dc
->
hPalette
)
{
{
if
(
dc
->
funcs
->
pRealizePalette
)
PHYSDEV
physdev
=
GET_DC_PHYSDEV
(
dc
,
pRealizePalette
);
{
PALETTEOBJ
*
palPtr
=
GDI_GetObjPtr
(
dc
->
hPalette
,
OBJ_PAL
);
PALETTEOBJ
*
palPtr
=
GDI_GetObjPtr
(
dc
->
hPalette
,
OBJ_PAL
);
if
(
palPtr
)
if
(
palPtr
)
{
{
realized
=
dc
->
funcs
->
pRealizePalette
(
dc
->
physD
ev
,
dc
->
hPalette
,
realized
=
physdev
->
funcs
->
pRealizePalette
(
physd
ev
,
dc
->
hPalette
,
(
dc
->
hPalette
==
hPrimaryPalette
)
);
(
dc
->
hPalette
==
hPrimaryPalette
)
);
palPtr
->
funcs
=
dc
->
funcs
;
palPtr
->
funcs
=
dc
->
funcs
;
GDI_ReleaseObj
(
dc
->
hPalette
);
GDI_ReleaseObj
(
dc
->
hPalette
);
}
}
}
}
}
else
TRACE
(
" skipping (hLastRealizedPalette = %p)
\n
"
,
hLastRealizedPalette
);
else
TRACE
(
" skipping (hLastRealizedPalette = %p)
\n
"
,
hLastRealizedPalette
);
release_dc_ptr
(
dc
);
release_dc_ptr
(
dc
);
...
...
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