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
69ebf9de
Commit
69ebf9de
authored
Nov 28, 2013
by
Henri Verbeet
Committed by
Alexandre Julliard
Nov 28, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Get rid of CreateSurface().
parent
028960d9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
120 deletions
+19
-120
ddraw.c
dlls/ddraw/ddraw.c
+4
-116
ddraw_private.h
dlls/ddraw/ddraw_private.h
+2
-2
surface.c
dlls/ddraw/surface.c
+13
-2
No files found.
dlls/ddraw/ddraw.c
View file @
69ebf9de
...
...
@@ -2731,118 +2731,6 @@ static HRESULT WINAPI ddraw7_StartModeTest(IDirectDraw7 *iface, SIZE *Modes, DWO
return
DD_OK
;
}
/*****************************************************************************
* IDirectDraw7::CreateSurface
*
* Creates a new IDirectDrawSurface object and returns its interface.
*
* The surface connections with wined3d are a bit tricky. Basically it works
* like this:
*
* |------------------------| |-----------------|
* | DDraw surface | | WineD3DSurface |
* | | | |
* | WineD3DSurface |-------------->| |
* | Child |<------------->| Parent |
* |------------------------| |-----------------|
*
* The DDraw surface is the parent of the wined3d surface, and it releases
* the WineD3DSurface when the ddraw surface is destroyed.
*
* However, for all surfaces which can be in a container in WineD3D,
* we have to do this. These surfaces are usually complex surfaces,
* so this concerns primary surfaces with a front and a back buffer,
* and textures.
*
* |------------------------| |-----------------|
* | DDraw surface | | Container |
* | | | |
* | Child |<------------->| Parent |
* | Texture |<------------->| |
* | WineD3DSurface |<----| | Levels |<--|
* | Complex connection | | | | |
* |------------------------| | |-----------------| |
* ^ | |
* | | |
* | | |
* | |------------------| | |-----------------| |
* | | IParent | |-------->| WineD3DSurface | |
* | | | | | |
* | | Child |<------------->| Parent | |
* | | | | Container |<--|
* | |------------------| |-----------------| |
* | |
* | |----------------------| |
* | | DDraw surface 2 | |
* | | | |
* |<->| Complex root Child | |
* | | Texture | |
* | | WineD3DSurface |<----| |
* | |----------------------| | |
* | | |
* | |---------------------| | |-----------------| |
* | | IParent | |----->| WineD3DSurface | |
* | | | | | |
* | | Child |<---------->| Parent | |
* | |---------------------| | Container |<--|
* | |-----------------| |
* | |
* | ---More surfaces can follow--- |
*
* The reason is that the IWineD3DSwapchain(render target container)
* and the IWineD3DTexure(Texture container) release the parents
* of their surface's children, but by releasing the complex root
* the surfaces which are complexly attached to it are destroyed
* too. See IDirectDrawSurface::Release for a more detailed
* explanation.
*
* Params:
* DDSD: Description of the surface to create
* Surf: Address to store the interface pointer at
* UnkOuter: Basically for aggregation support, but ddraw doesn't support
* aggregation, so it has to be NULL
*
* Returns:
* DD_OK on success
* CLASS_E_NOAGGREGATION if UnkOuter != NULL
* DDERR_* if an error occurs
*
*****************************************************************************/
static
HRESULT
CreateSurface
(
struct
ddraw
*
ddraw
,
const
DDSURFACEDESC2
*
surface_desc
,
struct
ddraw_surface
**
surface
,
IUnknown
*
UnkOuter
,
UINT
version
)
{
struct
ddraw_surface
*
object
=
NULL
;
HRESULT
hr
;
TRACE
(
"ddraw %p, surface_desc %p, surface %p, outer_unknown %p.
\n
"
,
ddraw
,
surface_desc
,
surface
,
UnkOuter
);
if
(
UnkOuter
!=
NULL
)
{
FIXME
(
"(%p) : outer != NULL?
\n
"
,
ddraw
);
return
CLASS_E_NOAGGREGATION
;
/* unchecked */
}
if
(
!
surface
)
{
FIXME
(
"(%p) You want to get back a surface? Don't give NULL ptrs!
\n
"
,
ddraw
);
return
E_POINTER
;
/* unchecked */
}
if
(
FAILED
(
hr
=
ddraw_surface_create_texture
(
ddraw
,
surface_desc
,
version
,
&
object
)))
{
WARN
(
"Failed to create texture, hr %#x.
\n
"
,
hr
);
return
hr
;
}
object
->
is_complex_root
=
TRUE
;
*
surface
=
object
;
if
(
surface_desc
->
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
ddraw
->
primary
=
object
;
return
hr
;
}
static
HRESULT
WINAPI
ddraw7_CreateSurface
(
IDirectDraw7
*
iface
,
DDSURFACEDESC2
*
surface_desc
,
IDirectDrawSurface7
**
surface
,
IUnknown
*
outer_unknown
)
{
...
...
@@ -2882,7 +2770,7 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface, DDSURFACEDESC2 *
return
DDERR_INVALIDCAPS
;
}
hr
=
CreateSurfac
e
(
ddraw
,
surface_desc
,
&
impl
,
outer_unknown
,
7
);
hr
=
ddraw_surface_creat
e
(
ddraw
,
surface_desc
,
&
impl
,
outer_unknown
,
7
);
wined3d_mutex_unlock
();
if
(
FAILED
(
hr
))
{
...
...
@@ -2936,7 +2824,7 @@ static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface,
return
DDERR_INVALIDCAPS
;
}
hr
=
CreateSurfac
e
(
ddraw
,
surface_desc
,
&
impl
,
outer_unknown
,
4
);
hr
=
ddraw_surface_creat
e
(
ddraw
,
surface_desc
,
&
impl
,
outer_unknown
,
4
);
wined3d_mutex_unlock
();
if
(
FAILED
(
hr
))
{
...
...
@@ -2992,7 +2880,7 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface,
return
DDERR_INVALIDCAPS
;
}
hr
=
CreateSurfac
e
(
ddraw
,
&
surface_desc2
,
&
impl
,
outer_unknown
,
2
);
hr
=
ddraw_surface_creat
e
(
ddraw
,
&
surface_desc2
,
&
impl
,
outer_unknown
,
2
);
wined3d_mutex_unlock
();
if
(
FAILED
(
hr
))
{
...
...
@@ -3037,7 +2925,7 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface,
* primaries anyway. */
surface_desc
->
ddsCaps
.
dwCaps
&=
~
DDSCAPS_FRONTBUFFER
;
DDSD_to_DDSD2
(
surface_desc
,
&
surface_desc2
);
hr
=
CreateSurfac
e
(
ddraw
,
&
surface_desc2
,
&
impl
,
outer_unknown
,
1
);
hr
=
ddraw_surface_creat
e
(
ddraw
,
&
surface_desc2
,
&
impl
,
outer_unknown
,
1
);
wined3d_mutex_unlock
();
if
(
FAILED
(
hr
))
{
...
...
dlls/ddraw/ddraw_private.h
View file @
69ebf9de
...
...
@@ -193,8 +193,8 @@ struct ddraw_texture
struct
ddraw_surface
*
root
;
};
HRESULT
ddraw_surface_create
_texture
(
struct
ddraw
*
ddraw
,
const
DDSURFACEDESC2
*
desc
,
unsigned
int
version
,
struct
ddraw_surface
**
surface
)
DECLSPEC_HIDDEN
;
HRESULT
ddraw_surface_create
(
struct
ddraw
*
ddraw
,
const
DDSURFACEDESC2
*
surface_
desc
,
struct
ddraw_surface
**
surface
,
IUnknown
*
outer_unknown
,
unsigned
int
version
)
DECLSPEC_HIDDEN
;
HRESULT
ddraw_surface_init
(
struct
ddraw_surface
*
surface
,
struct
ddraw
*
ddraw
,
struct
ddraw_texture
*
texture
,
struct
wined3d_surface
*
wined3d_surface
,
const
struct
wined3d_parent_ops
**
parent_ops
)
DECLSPEC_HIDDEN
;
ULONG
ddraw_surface_release_iface
(
struct
ddraw_surface
*
This
)
DECLSPEC_HIDDEN
;
...
...
dlls/ddraw/surface.c
View file @
69ebf9de
...
...
@@ -5589,8 +5589,8 @@ static HRESULT CDECL ddraw_reset_enum_callback(struct wined3d_resource *resource
return
DD_OK
;
}
HRESULT
ddraw_surface_create
_texture
(
struct
ddraw
*
ddraw
,
const
DDSURFACEDESC2
*
surface_desc
,
unsigned
int
version
,
struct
ddraw_surface
**
surface
)
HRESULT
ddraw_surface_create
(
struct
ddraw
*
ddraw
,
const
DDSURFACEDESC2
*
surface_desc
,
struct
ddraw_surface
**
surface
,
IUnknown
*
outer_unknown
,
unsigned
int
version
)
{
struct
ddraw_surface
*
root
,
*
mip
,
**
attach
;
struct
wined3d_resource_desc
wined3d_desc
;
...
...
@@ -5602,12 +5602,20 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, const DDSURFACEDESC2 *
UINT
layers
,
levels
,
i
,
j
;
HRESULT
hr
;
TRACE
(
"ddraw %p, surface_desc %p, surface %p, outer_unknown %p, version %u.
\n
"
,
ddraw
,
surface_desc
,
surface
,
outer_unknown
,
version
);
if
(
TRACE_ON
(
ddraw
))
{
TRACE
(
"Requesting surface desc:
\n
"
);
DDRAW_dump_surface_desc
(
surface_desc
);
}
if
(
outer_unknown
)
return
CLASS_E_NOAGGREGATION
;
if
(
!
surface
)
return
E_POINTER
;
if
(
!
(
texture
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
texture
))))
return
E_OUTOFMEMORY
;
...
...
@@ -5915,6 +5923,7 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, const DDSURFACEDESC2 *
resource
=
wined3d_texture_get_sub_resource
(
wined3d_texture
,
0
);
root
=
wined3d_resource_get_parent
(
resource
);
root
->
wined3d_texture
=
wined3d_texture
;
root
->
is_complex_root
=
TRUE
;
texture
->
root
=
root
;
for
(
i
=
0
;
i
<
layers
;
++
i
)
...
...
@@ -6010,6 +6019,8 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, const DDSURFACEDESC2 *
}
}
if
(
surface_desc
->
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
ddraw
->
primary
=
root
;
*
surface
=
root
;
return
DD_OK
;
...
...
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