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
fb6ceb97
Commit
fb6ceb97
authored
May 31, 2011
by
Ričardas Barkauskas
Committed by
Alexandre Julliard
May 31, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Use unsafe_impl_from_IDirectDrawSurface3() for application provided interfaces.
parent
750cadd2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
17 deletions
+33
-17
ddraw.c
dlls/ddraw/ddraw.c
+11
-10
ddraw_private.h
dlls/ddraw/ddraw_private.h
+2
-0
surface.c
dlls/ddraw/surface.c
+20
-7
No files found.
dlls/ddraw/ddraw.c
View file @
fb6ceb97
...
...
@@ -4160,12 +4160,12 @@ static HRESULT WINAPI ddraw3_DuplicateSurface(IDirectDraw3 *iface, IDirectDrawSu
IDirectDrawSurface
**
dst
)
{
IDirectDrawImpl
*
This
=
impl_from_IDirectDraw3
(
iface
);
IDirectDrawSurface7
*
src7
,
*
dst7
;
IDirectDrawSurfaceImpl
*
src_impl
=
unsafe_impl_from_IDirectDrawSurface3
((
IDirectDrawSurface3
*
)
src
);
IDirectDrawSurface7
*
dst7
;
HRESULT
hr
;
TRACE
(
"iface %p, src %p, dst %p.
\n
"
,
iface
,
src
,
dst
);
src7
=
(
IDirectDrawSurface7
*
)
surface_from_surface3
((
IDirectDrawSurface3
*
)
src
);
hr
=
ddraw7_DuplicateSurface
(
&
This
->
IDirectDraw7_iface
,
src7
,
&
dst7
);
hr
=
ddraw7_DuplicateSurface
(
&
This
->
IDirectDraw7_iface
,
(
IDirectDrawSurface7
*
)
src_impl
,
&
dst7
);
if
(
FAILED
(
hr
))
return
hr
;
*
dst
=
(
IDirectDrawSurface
*
)
&
((
IDirectDrawSurfaceImpl
*
)
dst7
)
->
IDirectDrawSurface3_vtbl
;
...
...
@@ -4176,12 +4176,12 @@ static HRESULT WINAPI ddraw2_DuplicateSurface(IDirectDraw2 *iface,
IDirectDrawSurface
*
src
,
IDirectDrawSurface
**
dst
)
{
IDirectDrawImpl
*
This
=
impl_from_IDirectDraw2
(
iface
);
IDirectDrawSurface7
*
src7
,
*
dst7
;
IDirectDrawSurfaceImpl
*
src_impl
=
unsafe_impl_from_IDirectDrawSurface3
((
IDirectDrawSurface3
*
)
src
);
IDirectDrawSurface7
*
dst7
;
HRESULT
hr
;
TRACE
(
"iface %p, src %p, dst %p.
\n
"
,
iface
,
src
,
dst
);
src7
=
(
IDirectDrawSurface7
*
)
surface_from_surface3
((
IDirectDrawSurface3
*
)
src
);
hr
=
ddraw7_DuplicateSurface
(
&
This
->
IDirectDraw7_iface
,
src7
,
&
dst7
);
hr
=
ddraw7_DuplicateSurface
(
&
This
->
IDirectDraw7_iface
,
(
IDirectDrawSurface7
*
)
src_impl
,
&
dst7
);
if
(
FAILED
(
hr
))
return
hr
;
*
dst
=
(
IDirectDrawSurface
*
)
&
((
IDirectDrawSurfaceImpl
*
)
dst7
)
->
IDirectDrawSurface3_vtbl
;
...
...
@@ -4192,12 +4192,12 @@ static HRESULT WINAPI ddraw1_DuplicateSurface(IDirectDraw *iface, IDirectDrawSur
IDirectDrawSurface
**
dst
)
{
IDirectDrawImpl
*
This
=
impl_from_IDirectDraw
(
iface
);
IDirectDrawSurface7
*
src7
,
*
dst7
;
IDirectDrawSurfaceImpl
*
src_impl
=
unsafe_impl_from_IDirectDrawSurface3
((
IDirectDrawSurface3
*
)
src
);
IDirectDrawSurface7
*
dst7
;
HRESULT
hr
;
TRACE
(
"iface %p, src %p, dst %p.
\n
"
,
iface
,
src
,
dst
);
src7
=
(
IDirectDrawSurface7
*
)
surface_from_surface3
((
IDirectDrawSurface3
*
)
src
);
hr
=
ddraw7_DuplicateSurface
(
&
This
->
IDirectDraw7_iface
,
src7
,
&
dst7
);
hr
=
ddraw7_DuplicateSurface
(
&
This
->
IDirectDraw7_iface
,
(
IDirectDrawSurface7
*
)
src_impl
,
&
dst7
);
if
(
FAILED
(
hr
))
return
hr
;
*
dst
=
(
IDirectDrawSurface
*
)
&
((
IDirectDrawSurfaceImpl
*
)
dst7
)
->
IDirectDrawSurface3_vtbl
;
...
...
@@ -4778,13 +4778,14 @@ static HRESULT WINAPI d3d2_CreateDevice(IDirect3D2 *iface, REFCLSID riid,
IDirectDrawSurface
*
surface
,
IDirect3DDevice2
**
device
)
{
IDirectDrawImpl
*
This
=
impl_from_IDirect3D2
(
iface
);
IDirectDrawSurfaceImpl
*
surface_impl
=
unsafe_impl_from_IDirectDrawSurface3
((
IDirectDrawSurface3
*
)
surface
);
HRESULT
hr
;
TRACE
(
"iface %p, riid %s, surface %p, device %p.
\n
"
,
iface
,
debugstr_guid
(
riid
),
surface
,
device
);
hr
=
d3d7_CreateDevice
(
&
This
->
IDirect3D7_iface
,
riid
,
surface
?
(
IDirectDrawSurface7
*
)
surface_from_surface3
((
IDirectDrawSurface3
*
)
surface
)
:
NULL
,
surface
_impl
?
(
IDirectDrawSurface7
*
)
surface_impl
:
NULL
,
(
IDirect3DDevice7
**
)
device
);
if
(
*
device
)
*
device
=
(
IDirect3DDevice2
*
)
&
((
IDirect3DDeviceImpl
*
)
*
device
)
->
IDirect3DDevice2_vtbl
;
...
...
dlls/ddraw/ddraw_private.h
View file @
fb6ceb97
...
...
@@ -225,6 +225,8 @@ static inline IDirectDrawSurfaceImpl *surface_from_surface3(IDirectDrawSurface3
return
(
IDirectDrawSurfaceImpl
*
)((
char
*
)
iface
-
FIELD_OFFSET
(
IDirectDrawSurfaceImpl
,
IDirectDrawSurface3_vtbl
));
}
IDirectDrawSurfaceImpl
*
unsafe_impl_from_IDirectDrawSurface3
(
IDirectDrawSurface3
*
iface
)
DECLSPEC_HIDDEN
;
/* Get the number of bytes per pixel for a given surface */
#define PFGET_BPP(pf) (pf.dwFlags&DDPF_PALETTEINDEXED8?1:((pf.dwRGBBitCount+7)/8))
#define GET_BPP(desc) PFGET_BPP(desc.ddpfPixelFormat)
...
...
dlls/ddraw/surface.c
View file @
fb6ceb97
...
...
@@ -775,10 +775,11 @@ static HRESULT WINAPI ddraw_surface7_Flip(IDirectDrawSurface7 *iface, IDirectDra
static
HRESULT
WINAPI
ddraw_surface3_Flip
(
IDirectDrawSurface3
*
iface
,
IDirectDrawSurface3
*
dst
,
DWORD
flags
)
{
IDirectDrawSurfaceImpl
*
dst_impl
=
unsafe_impl_from_IDirectDrawSurface3
(
dst
);
TRACE
(
"iface %p, dst %p, flags %#x.
\n
"
,
iface
,
dst
,
flags
);
return
ddraw_surface7_Flip
((
IDirectDrawSurface7
*
)
surface_from_surface3
(
iface
),
dst
?
(
IDirectDrawSurface7
*
)
surface_from_surface3
(
dst
)
:
NULL
,
flags
);
dst
_impl
?
(
IDirectDrawSurface7
*
)
dst_impl
:
NULL
,
flags
);
}
/*****************************************************************************
...
...
@@ -871,11 +872,12 @@ static HRESULT WINAPI ddraw_surface7_Blt(IDirectDrawSurface7 *iface, RECT *DestR
static
HRESULT
WINAPI
ddraw_surface3_Blt
(
IDirectDrawSurface3
*
iface
,
RECT
*
dst_rect
,
IDirectDrawSurface3
*
src_surface
,
RECT
*
src_rect
,
DWORD
flags
,
DDBLTFX
*
fx
)
{
IDirectDrawSurfaceImpl
*
src_impl
=
unsafe_impl_from_IDirectDrawSurface3
(
src_surface
);
TRACE
(
"iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p.
\n
"
,
iface
,
wine_dbgstr_rect
(
dst_rect
),
src_surface
,
wine_dbgstr_rect
(
src_rect
),
flags
,
fx
);
return
ddraw_surface7_Blt
((
IDirectDrawSurface7
*
)
surface_from_surface3
(
iface
),
dst_rect
,
src_
surface
?
(
IDirectDrawSurface7
*
)
surface_from_surface3
(
src_surface
)
:
NULL
,
src_rect
,
flags
,
fx
);
src_
impl
?
(
IDirectDrawSurface7
*
)
src_impl
:
NULL
,
src_rect
,
flags
,
fx
);
}
/*****************************************************************************
...
...
@@ -982,7 +984,7 @@ static HRESULT WINAPI ddraw_surface7_AddAttachedSurface(IDirectDrawSurface7 *ifa
static
HRESULT
WINAPI
ddraw_surface3_AddAttachedSurface
(
IDirectDrawSurface3
*
iface
,
IDirectDrawSurface3
*
attachment
)
{
IDirectDrawSurfaceImpl
*
surface
=
surface_from_surface3
(
iface
);
IDirectDrawSurfaceImpl
*
attach_impl
=
surface_from_s
urface3
(
attachment
);
IDirectDrawSurfaceImpl
*
attach_impl
=
unsafe_impl_from_IDirectDrawS
urface3
(
attachment
);
TRACE
(
"iface %p, attachment %p.
\n
"
,
iface
,
attachment
);
...
...
@@ -1086,10 +1088,11 @@ static HRESULT WINAPI ddraw_surface7_DeleteAttachedSurface(IDirectDrawSurface7 *
static
HRESULT
WINAPI
ddraw_surface3_DeleteAttachedSurface
(
IDirectDrawSurface3
*
iface
,
DWORD
flags
,
IDirectDrawSurface3
*
attachment
)
{
IDirectDrawSurfaceImpl
*
attachment_impl
=
unsafe_impl_from_IDirectDrawSurface3
(
attachment
);
TRACE
(
"iface %p, flags %#x, attachment %p.
\n
"
,
iface
,
flags
,
attachment
);
return
ddraw_surface7_DeleteAttachedSurface
((
IDirectDrawSurface7
*
)
surface_from_surface3
(
iface
),
flags
,
attachment
?
(
IDirectDrawSurface7
*
)
surface_from_surface3
(
attachment
)
:
NULL
);
attachment
_impl
?
(
IDirectDrawSurface7
*
)
attachment_impl
:
NULL
);
}
/*****************************************************************************
...
...
@@ -2092,11 +2095,12 @@ static HRESULT WINAPI ddraw_surface7_UpdateOverlay(IDirectDrawSurface7 *iface, R
static
HRESULT
WINAPI
ddraw_surface3_UpdateOverlay
(
IDirectDrawSurface3
*
iface
,
RECT
*
src_rect
,
IDirectDrawSurface3
*
dst_surface
,
RECT
*
dst_rect
,
DWORD
flags
,
DDOVERLAYFX
*
fx
)
{
IDirectDrawSurfaceImpl
*
dst_impl
=
unsafe_impl_from_IDirectDrawSurface3
(
dst_surface
);
TRACE
(
"iface %p, src_rect %s, dst_surface %p, dst_rect %s, flags %#x, fx %p.
\n
"
,
iface
,
wine_dbgstr_rect
(
src_rect
),
dst_surface
,
wine_dbgstr_rect
(
dst_rect
),
flags
,
fx
);
return
ddraw_surface7_UpdateOverlay
((
IDirectDrawSurface7
*
)
surface_from_surface3
(
iface
),
src_rect
,
dst_
surface
?
(
IDirectDrawSurface7
*
)
surface_from_surface3
(
dst_surface
)
:
NULL
,
dst_rect
,
flags
,
fx
);
dst_
impl
?
(
IDirectDrawSurface7
*
)
dst_impl
:
NULL
,
dst_rect
,
flags
,
fx
);
}
/*****************************************************************************
...
...
@@ -2156,10 +2160,11 @@ static HRESULT WINAPI ddraw_surface7_UpdateOverlayZOrder(IDirectDrawSurface7 *if
static
HRESULT
WINAPI
ddraw_surface3_UpdateOverlayZOrder
(
IDirectDrawSurface3
*
iface
,
DWORD
flags
,
IDirectDrawSurface3
*
reference
)
{
IDirectDrawSurfaceImpl
*
reference_impl
=
unsafe_impl_from_IDirectDrawSurface3
(
reference
);
TRACE
(
"iface %p, flags %#x, reference %p.
\n
"
,
iface
,
flags
,
reference
);
return
ddraw_surface7_UpdateOverlayZOrder
((
IDirectDrawSurface7
*
)
surface_from_surface3
(
iface
),
flags
,
reference
?
(
IDirectDrawSurface7
*
)
surface_from_surface3
(
reference
)
:
NULL
);
reference
_impl
?
(
IDirectDrawSurface7
*
)
reference_impl
:
NULL
);
}
/*****************************************************************************
...
...
@@ -2408,11 +2413,12 @@ static HRESULT WINAPI ddraw_surface7_BltFast(IDirectDrawSurface7 *iface, DWORD d
static
HRESULT
WINAPI
ddraw_surface3_BltFast
(
IDirectDrawSurface3
*
iface
,
DWORD
dst_x
,
DWORD
dst_y
,
IDirectDrawSurface3
*
src_surface
,
RECT
*
src_rect
,
DWORD
flags
)
{
IDirectDrawSurfaceImpl
*
src_impl
=
unsafe_impl_from_IDirectDrawSurface3
(
src_surface
);
TRACE
(
"iface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.
\n
"
,
iface
,
dst_x
,
dst_y
,
src_surface
,
wine_dbgstr_rect
(
src_rect
),
flags
);
return
ddraw_surface7_BltFast
((
IDirectDrawSurface7
*
)
surface_from_surface3
(
iface
),
dst_x
,
dst_y
,
src_
surface
?
(
IDirectDrawSurface7
*
)
surface_from_surface3
(
src_surface
)
:
NULL
,
src_rect
,
flags
);
src_
impl
?
(
IDirectDrawSurface7
*
)
src_impl
:
NULL
,
src_rect
,
flags
);
}
/*****************************************************************************
...
...
@@ -3399,6 +3405,13 @@ static const struct IDirect3DTextureVtbl d3d_texture1_vtbl =
d3d_texture1_Unload
,
};
IDirectDrawSurfaceImpl
*
unsafe_impl_from_IDirectDrawSurface3
(
IDirectDrawSurface3
*
iface
)
{
if
(
!
iface
)
return
NULL
;
assert
(
iface
->
lpVtbl
==
&
ddraw_surface3_vtbl
);
return
CONTAINING_RECORD
(
iface
,
IDirectDrawSurfaceImpl
,
IDirectDrawSurface3_vtbl
);
}
static
void
STDMETHODCALLTYPE
ddraw_surface_wined3d_object_destroyed
(
void
*
parent
)
{
IDirectDrawSurfaceImpl
*
surface
=
parent
;
...
...
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