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
d0a37cde
Commit
d0a37cde
authored
Mar 12, 2012
by
Henri Verbeet
Committed by
Alexandre Julliard
Mar 13, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Get rid of IDirectDrawPaletteImpl.
parent
9e44c4bc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
67 deletions
+48
-67
ddraw.c
dlls/ddraw/ddraw.c
+6
-6
ddraw_private.h
dlls/ddraw/ddraw_private.h
+5
-6
palette.c
dlls/ddraw/palette.c
+34
-52
surface.c
dlls/ddraw/surface.c
+3
-3
No files found.
dlls/ddraw/ddraw.c
View file @
d0a37cde
...
...
@@ -3700,7 +3700,7 @@ static HRESULT WINAPI ddraw7_CreatePalette(IDirectDraw7 *iface, DWORD Flags,
PALETTEENTRY
*
ColorTable
,
IDirectDrawPalette
**
Palette
,
IUnknown
*
pUnkOuter
)
{
struct
ddraw
*
ddraw
=
impl_from_IDirectDraw7
(
iface
);
IDirectDrawPaletteImpl
*
object
;
struct
ddraw_palette
*
object
;
HRESULT
hr
;
TRACE
(
"iface %p, flags %#x, color_table %p, palette %p, outer_unknown %p.
\n
"
,
...
...
@@ -3719,8 +3719,8 @@ static HRESULT WINAPI ddraw7_CreatePalette(IDirectDraw7 *iface, DWORD Flags,
return
DDERR_NOCOOPERATIVELEVELSET
;
}
object
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
IDirectDrawPaletteImpl
));
if
(
!
object
)
object
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
object
));
if
(
!
object
)
{
ERR
(
"Out of memory when allocating memory for a palette implementation
\n
"
);
wined3d_mutex_unlock
();
...
...
@@ -3755,7 +3755,7 @@ static HRESULT WINAPI ddraw4_CreatePalette(IDirectDraw4 *iface, DWORD flags, PAL
hr
=
ddraw7_CreatePalette
(
&
ddraw
->
IDirectDraw7_iface
,
flags
,
entries
,
palette
,
outer_unknown
);
if
(
SUCCEEDED
(
hr
)
&&
*
palette
)
{
IDirectDrawPaletteImpl
*
impl
=
impl_from_IDirectDrawPalette
(
*
palette
);
struct
ddraw_palette
*
impl
=
impl_from_IDirectDrawPalette
(
*
palette
);
IDirectDraw7_Release
(
&
ddraw
->
IDirectDraw7_iface
);
IDirectDraw4_AddRef
(
iface
);
impl
->
ifaceToRelease
=
(
IUnknown
*
)
iface
;
...
...
@@ -3775,7 +3775,7 @@ static HRESULT WINAPI ddraw2_CreatePalette(IDirectDraw2 *iface, DWORD flags,
hr
=
ddraw7_CreatePalette
(
&
ddraw
->
IDirectDraw7_iface
,
flags
,
entries
,
palette
,
outer_unknown
);
if
(
SUCCEEDED
(
hr
)
&&
*
palette
)
{
IDirectDrawPaletteImpl
*
impl
=
impl_from_IDirectDrawPalette
(
*
palette
);
struct
ddraw_palette
*
impl
=
impl_from_IDirectDrawPalette
(
*
palette
);
IDirectDraw7_Release
(
&
ddraw
->
IDirectDraw7_iface
);
impl
->
ifaceToRelease
=
NULL
;
}
...
...
@@ -3795,7 +3795,7 @@ static HRESULT WINAPI ddraw1_CreatePalette(IDirectDraw *iface, DWORD flags,
hr
=
ddraw7_CreatePalette
(
&
ddraw
->
IDirectDraw7_iface
,
flags
,
entries
,
palette
,
outer_unknown
);
if
(
SUCCEEDED
(
hr
)
&&
*
palette
)
{
IDirectDrawPaletteImpl
*
impl
=
impl_from_IDirectDrawPalette
(
*
palette
);
struct
ddraw_palette
*
impl
=
impl_from_IDirectDrawPalette
(
*
palette
);
IDirectDraw7_Release
(
&
ddraw
->
IDirectDraw7_iface
);
impl
->
ifaceToRelease
=
NULL
;
}
...
...
dlls/ddraw/ddraw_private.h
View file @
d0a37cde
...
...
@@ -41,7 +41,6 @@ extern const struct wined3d_parent_ops ddraw_surface_wined3d_parent_ops DECLSPEC
extern
const
struct
wined3d_parent_ops
ddraw_null_wined3d_parent_ops
DECLSPEC_HIDDEN
;
/* Typdef the interfaces */
typedef
struct
IDirectDrawPaletteImpl
IDirectDrawPaletteImpl
;
typedef
struct
IDirect3DDeviceImpl
IDirect3DDeviceImpl
;
typedef
struct
IDirect3DLightImpl
IDirect3DLightImpl
;
typedef
struct
IDirect3DViewportImpl
IDirect3DViewportImpl
;
...
...
@@ -370,7 +369,7 @@ struct ddraw_clipper *unsafe_impl_from_IDirectDrawClipper(IDirectDrawClipper *if
/*****************************************************************************
* IDirectDrawPalette implementation structure
*****************************************************************************/
struct
IDirectDrawPaletteImpl
struct
ddraw_palette
{
/* IUnknown fields */
IDirectDrawPalette
IDirectDrawPalette_iface
;
...
...
@@ -382,14 +381,14 @@ struct IDirectDrawPaletteImpl
IUnknown
*
ifaceToRelease
;
};
static
inline
IDirectDrawPaletteImpl
*
impl_from_IDirectDrawPalette
(
IDirectDrawPalette
*
iface
)
static
inline
struct
ddraw_palette
*
impl_from_IDirectDrawPalette
(
IDirectDrawPalette
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
IDirectDrawPaletteImpl
,
IDirectDrawPalette_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
ddraw_palette
,
IDirectDrawPalette_iface
);
}
IDirectDrawPaletteImpl
*
unsafe_impl_from_IDirectDrawPalette
(
IDirectDrawPalette
*
iface
)
DECLSPEC_HIDDEN
;
struct
ddraw_palette
*
unsafe_impl_from_IDirectDrawPalette
(
IDirectDrawPalette
*
iface
)
DECLSPEC_HIDDEN
;
HRESULT
ddraw_palette_init
(
IDirectDrawPaletteImpl
*
palette
,
HRESULT
ddraw_palette_init
(
struct
ddraw_palette
*
palette
,
struct
ddraw
*
ddraw
,
DWORD
flags
,
PALETTEENTRY
*
entries
)
DECLSPEC_HIDDEN
;
/* Helper structures */
...
...
dlls/ddraw/palette.c
View file @
d0a37cde
...
...
@@ -37,10 +37,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
* S_OK on success
* E_NOINTERFACE if the requested interface wasn't found
*****************************************************************************/
static
HRESULT
WINAPI
IDirectDrawPaletteImpl_QueryInterface
(
IDirectDrawPalette
*
iface
,
REFIID
refiid
,
void
**
obj
)
static
HRESULT
WINAPI
ddraw_palette_QueryInterface
(
IDirectDrawPalette
*
iface
,
REFIID
refiid
,
void
**
obj
)
{
TRACE
(
"iface %p, riid %s, object %p.
\n
"
,
iface
,
debugstr_guid
(
refiid
),
obj
);
...
...
@@ -67,10 +64,9 @@ IDirectDrawPaletteImpl_QueryInterface(IDirectDrawPalette *iface,
* The new refcount
*
*****************************************************************************/
static
ULONG
WINAPI
IDirectDrawPaletteImpl_AddRef
(
IDirectDrawPalette
*
iface
)
static
ULONG
WINAPI
ddraw_palette_AddRef
(
IDirectDrawPalette
*
iface
)
{
IDirectDrawPaletteImpl
*
This
=
impl_from_IDirectDrawPalette
(
iface
);
struct
ddraw_palette
*
This
=
impl_from_IDirectDrawPalette
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
This
,
ref
);
...
...
@@ -87,10 +83,9 @@ IDirectDrawPaletteImpl_AddRef(IDirectDrawPalette *iface)
* The new refcount
*
*****************************************************************************/
static
ULONG
WINAPI
IDirectDrawPaletteImpl_Release
(
IDirectDrawPalette
*
iface
)
static
ULONG
WINAPI
ddraw_palette_Release
(
IDirectDrawPalette
*
iface
)
{
IDirectDrawPaletteImpl
*
This
=
impl_from_IDirectDrawPalette
(
iface
);
struct
ddraw_palette
*
This
=
impl_from_IDirectDrawPalette
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
This
,
ref
);
...
...
@@ -126,14 +121,11 @@ IDirectDrawPaletteImpl_Release(IDirectDrawPalette *iface)
* DDERR_ALREADYINITIALIZED
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirectDrawPaletteImpl_Initialize
(
IDirectDrawPalette
*
iface
,
IDirectDraw
*
DD
,
DWORD
Flags
,
PALETTEENTRY
*
ColorTable
)
static
HRESULT
WINAPI
ddraw_palette_Initialize
(
IDirectDrawPalette
*
iface
,
IDirectDraw
*
ddraw
,
DWORD
flags
,
PALETTEENTRY
*
entries
)
{
TRACE
(
"iface %p, ddraw %p, flags %#x, entries %p.
\n
"
,
iface
,
DD
,
Flags
,
ColorTable
);
iface
,
ddraw
,
flags
,
entries
);
return
DDERR_ALREADYINITIALIZED
;
}
...
...
@@ -152,16 +144,14 @@ IDirectDrawPaletteImpl_Initialize(IDirectDrawPalette *iface,
* For more details, see IWineD3DPalette::GetCaps
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirectDrawPaletteImpl_GetCaps
(
IDirectDrawPalette
*
iface
,
DWORD
*
Caps
)
static
HRESULT
WINAPI
ddraw_palette_GetCaps
(
IDirectDrawPalette
*
iface
,
DWORD
*
caps
)
{
IDirectDrawPaletteImpl
*
This
=
impl_from_IDirectDrawPalette
(
iface
);
struct
ddraw_palette
*
palette
=
impl_from_IDirectDrawPalette
(
iface
);
TRACE
(
"iface %p, caps %p.
\n
"
,
iface
,
C
aps
);
TRACE
(
"iface %p, caps %p.
\n
"
,
iface
,
c
aps
);
wined3d_mutex_lock
();
*
Caps
=
wined3d_palette_get_flags
(
This
->
wineD3DPalette
);
*
caps
=
wined3d_palette_get_flags
(
palette
->
wineD3DPalette
);
wined3d_mutex_unlock
();
return
D3D_OK
;
...
...
@@ -185,24 +175,20 @@ IDirectDrawPaletteImpl_GetCaps(IDirectDrawPalette *iface,
* For details, see IWineD3DDevice::SetEntries
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirectDrawPaletteImpl_SetEntries
(
IDirectDrawPalette
*
iface
,
DWORD
Flags
,
DWORD
Start
,
DWORD
Count
,
PALETTEENTRY
*
PalEnt
)
static
HRESULT
WINAPI
ddraw_palette_SetEntries
(
IDirectDrawPalette
*
iface
,
DWORD
flags
,
DWORD
start
,
DWORD
count
,
PALETTEENTRY
*
entries
)
{
IDirectDrawPaletteImpl
*
This
=
impl_from_IDirectDrawPalette
(
iface
);
struct
ddraw_palette
*
palette
=
impl_from_IDirectDrawPalette
(
iface
);
HRESULT
hr
;
TRACE
(
"iface %p, flags %#x, start %u, count %u, entries %p.
\n
"
,
iface
,
Flags
,
Start
,
Count
,
PalEnt
);
iface
,
flags
,
start
,
count
,
entries
);
if
(
!
PalEnt
)
if
(
!
entries
)
return
DDERR_INVALIDPARAMS
;
wined3d_mutex_lock
();
hr
=
wined3d_palette_set_entries
(
This
->
wineD3DPalette
,
Flags
,
Start
,
Count
,
PalEnt
);
hr
=
wined3d_palette_set_entries
(
palette
->
wineD3DPalette
,
flags
,
start
,
count
,
entries
);
wined3d_mutex_unlock
();
return
hr
;
...
...
@@ -225,24 +211,20 @@ IDirectDrawPaletteImpl_SetEntries(IDirectDrawPalette *iface,
* For details, see IWineD3DDevice::SetEntries
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirectDrawPaletteImpl_GetEntries
(
IDirectDrawPalette
*
iface
,
DWORD
Flags
,
DWORD
Start
,
DWORD
Count
,
PALETTEENTRY
*
PalEnt
)
static
HRESULT
WINAPI
ddraw_palette_GetEntries
(
IDirectDrawPalette
*
iface
,
DWORD
flags
,
DWORD
start
,
DWORD
count
,
PALETTEENTRY
*
entries
)
{
IDirectDrawPaletteImpl
*
This
=
impl_from_IDirectDrawPalette
(
iface
);
struct
ddraw_palette
*
palette
=
impl_from_IDirectDrawPalette
(
iface
);
HRESULT
hr
;
TRACE
(
"iface %p, flags %#x, start %u, count %u, entries %p.
\n
"
,
iface
,
Flags
,
Start
,
Count
,
PalEnt
);
iface
,
flags
,
start
,
count
,
entries
);
if
(
!
PalEnt
)
if
(
!
entries
)
return
DDERR_INVALIDPARAMS
;
wined3d_mutex_lock
();
hr
=
wined3d_palette_get_entries
(
This
->
wineD3DPalette
,
Flags
,
Start
,
Count
,
PalEnt
);
hr
=
wined3d_palette_get_entries
(
palette
->
wineD3DPalette
,
flags
,
start
,
count
,
entries
);
wined3d_mutex_unlock
();
return
hr
;
...
...
@@ -251,24 +233,24 @@ IDirectDrawPaletteImpl_GetEntries(IDirectDrawPalette *iface,
static
const
struct
IDirectDrawPaletteVtbl
ddraw_palette_vtbl
=
{
/*** IUnknown ***/
IDirectDrawPaletteImpl
_QueryInterface
,
IDirectDrawPaletteImpl
_AddRef
,
IDirectDrawPaletteImpl
_Release
,
ddraw_palette
_QueryInterface
,
ddraw_palette
_AddRef
,
ddraw_palette
_Release
,
/*** IDirectDrawPalette ***/
IDirectDrawPaletteImpl
_GetCaps
,
IDirectDrawPaletteImpl
_GetEntries
,
IDirectDrawPaletteImpl
_Initialize
,
IDirectDrawPaletteImpl
_SetEntries
ddraw_palette
_GetCaps
,
ddraw_palette
_GetEntries
,
ddraw_palette
_Initialize
,
ddraw_palette
_SetEntries
};
IDirectDrawPaletteImpl
*
unsafe_impl_from_IDirectDrawPalette
(
IDirectDrawPalette
*
iface
)
struct
ddraw_palette
*
unsafe_impl_from_IDirectDrawPalette
(
IDirectDrawPalette
*
iface
)
{
if
(
!
iface
)
return
NULL
;
assert
(
iface
->
lpVtbl
==
&
ddraw_palette_vtbl
);
return
CONTAINING_RECORD
(
iface
,
IDirectDrawPaletteImpl
,
IDirectDrawPalette_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
ddraw_palette
,
IDirectDrawPalette_iface
);
}
HRESULT
ddraw_palette_init
(
IDirectDrawPaletteImpl
*
palette
,
HRESULT
ddraw_palette_init
(
struct
ddraw_palette
*
palette
,
struct
ddraw
*
ddraw
,
DWORD
flags
,
PALETTEENTRY
*
entries
)
{
HRESULT
hr
;
...
...
dlls/ddraw/surface.c
View file @
d0a37cde
...
...
@@ -4685,9 +4685,9 @@ static HRESULT WINAPI ddraw_surface1_SetColorKey(IDirectDrawSurface *iface, DWOR
static
HRESULT
WINAPI
ddraw_surface7_SetPalette
(
IDirectDrawSurface7
*
iface
,
IDirectDrawPalette
*
Pal
)
{
struct
ddraw_surface
*
This
=
impl_from_IDirectDrawSurface7
(
iface
);
struct
ddraw_palette
*
palette_impl
=
unsafe_impl_from_IDirectDrawPalette
(
Pal
);
IDirectDrawPalette
*
oldPal
;
struct
ddraw_surface
*
surf
;
IDirectDrawPaletteImpl
*
PalImpl
=
unsafe_impl_from_IDirectDrawPalette
(
Pal
);
HRESULT
hr
;
TRACE
(
"iface %p, palette %p.
\n
"
,
iface
,
Pal
);
...
...
@@ -4713,7 +4713,7 @@ static HRESULT WINAPI ddraw_surface7_SetPalette(IDirectDrawSurface7 *iface, IDir
if
(
oldPal
)
IDirectDrawPalette_Release
(
oldPal
);
/* For the GetPalette */
/* Set the new Palette */
wined3d_surface_set_palette
(
This
->
wined3d_surface
,
PalImpl
?
PalI
mpl
->
wineD3DPalette
:
NULL
);
wined3d_surface_set_palette
(
This
->
wined3d_surface
,
palette_impl
?
palette_i
mpl
->
wineD3DPalette
:
NULL
);
/* AddRef the Palette */
if
(
Pal
)
IDirectDrawPalette_AddRef
(
Pal
);
...
...
@@ -4723,7 +4723,7 @@ static HRESULT WINAPI ddraw_surface7_SetPalette(IDirectDrawSurface7 *iface, IDir
/* Update the wined3d frontbuffer if this is the frontbuffer. */
if
((
This
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_FRONTBUFFER
)
&&
This
->
ddraw
->
wined3d_frontbuffer
)
{
hr
=
wined3d_surface_set_palette
(
This
->
ddraw
->
wined3d_frontbuffer
,
PalImpl
?
PalI
mpl
->
wineD3DPalette
:
NULL
);
hr
=
wined3d_surface_set_palette
(
This
->
ddraw
->
wined3d_frontbuffer
,
palette_impl
?
palette_i
mpl
->
wineD3DPalette
:
NULL
);
if
(
FAILED
(
hr
))
ERR
(
"Failed to set frontbuffer palette, hr %#x.
\n
"
,
hr
);
}
...
...
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