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
7c6ca207
Commit
7c6ca207
authored
Jan 27, 2014
by
Henri Verbeet
Committed by
Alexandre Julliard
Jan 27, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Allow attaching surfaces other than depth buffers in ddraw_surface4_AddAttachedSurface().
parent
fffaf03c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
55 deletions
+43
-55
surface.c
dlls/ddraw/surface.c
+36
-48
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+7
-7
No files found.
dlls/ddraw/surface.c
View file @
7c6ca207
...
@@ -1670,106 +1670,94 @@ static HRESULT WINAPI ddraw_surface7_AddAttachedSurface(IDirectDrawSurface7 *ifa
...
@@ -1670,106 +1670,94 @@ static HRESULT WINAPI ddraw_surface7_AddAttachedSurface(IDirectDrawSurface7 *ifa
static
HRESULT
WINAPI
ddraw_surface4_AddAttachedSurface
(
IDirectDrawSurface4
*
iface
,
IDirectDrawSurface4
*
attachment
)
static
HRESULT
WINAPI
ddraw_surface4_AddAttachedSurface
(
IDirectDrawSurface4
*
iface
,
IDirectDrawSurface4
*
attachment
)
{
{
struct
ddraw_surface
*
This
=
impl_from_IDirectDrawSurface4
(
iface
);
struct
ddraw_surface
*
surface
=
impl_from_IDirectDrawSurface4
(
iface
);
struct
ddraw_surface
*
attachment_impl
=
unsafe_impl_from_IDirectDrawSurface4
(
attachment
);
struct
ddraw_surface
*
attachment_impl
=
unsafe_impl_from_IDirectDrawSurface4
(
attachment
);
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"iface %p, attachment %p.
\n
"
,
iface
,
attachment
);
TRACE
(
"iface %p, attachment %p.
\n
"
,
iface
,
attachment
);
hr
=
ddraw_surface7_AddAttachedSurface
(
&
This
->
IDirectDrawSurface7_iface
,
attachment_impl
?
&
attachment_impl
->
IDirectDrawSurface7_iface
:
NULL
);
if
(
FAILED
(
hr
))
{
return
hr
;
}
attachment_impl
->
attached_iface
=
(
IUnknown
*
)
attachment
;
IUnknown_AddRef
(
attachment_impl
->
attached_iface
);
ddraw_surface7_Release
(
&
attachment_impl
->
IDirectDrawSurface7_iface
);
return
hr
;
}
static
HRESULT
WINAPI
ddraw_surface3_AddAttachedSurface
(
IDirectDrawSurface3
*
iface
,
IDirectDrawSurface3
*
attachment
)
{
struct
ddraw_surface
*
This
=
impl_from_IDirectDrawSurface3
(
iface
);
struct
ddraw_surface
*
attachment_impl
=
unsafe_impl_from_IDirectDrawSurface3
(
attachment
);
HRESULT
hr
;
TRACE
(
"iface %p, attachment %p.
\n
"
,
iface
,
attachment
);
/* Tests suggest that
/* Tests suggest that
* -> offscreen plain surfaces can be attached to other offscreen plain surfaces
* -> offscreen plain surfaces can be attached to other offscreen plain surfaces
* -> offscreen plain surfaces can be attached to primaries
* -> offscreen plain surfaces can be attached to primaries
* -> primaries can be attached to offscreen plain surfaces
* -> primaries can be attached to offscreen plain surfaces
* -> z buffers can be attached to primaries */
* -> z buffers can be attached to primaries */
if
(
This
->
surface_desc
.
ddsCaps
.
dwCaps
&
(
DDSCAPS_PRIMARYSURFACE
|
DDSCAPS_OFFSCREENPLAIN
)
if
(
surface
->
surface_desc
.
ddsCaps
.
dwCaps
&
(
DDSCAPS_PRIMARYSURFACE
|
DDSCAPS_OFFSCREENPLAIN
)
&&
attachment_impl
->
surface_desc
.
ddsCaps
.
dwCaps
&
(
DDSCAPS_PRIMARYSURFACE
|
DDSCAPS_OFFSCREENPLAIN
))
&&
attachment_impl
->
surface_desc
.
ddsCaps
.
dwCaps
&
(
DDSCAPS_PRIMARYSURFACE
|
DDSCAPS_OFFSCREENPLAIN
))
{
{
/* Sizes have to match */
/* Sizes have to match */
if
(
attachment_impl
->
surface_desc
.
dwWidth
!=
This
->
surface_desc
.
dwWidth
if
(
attachment_impl
->
surface_desc
.
dwWidth
!=
surface
->
surface_desc
.
dwWidth
||
attachment_impl
->
surface_desc
.
dwHeight
!=
This
->
surface_desc
.
dwHeight
)
||
attachment_impl
->
surface_desc
.
dwHeight
!=
surface
->
surface_desc
.
dwHeight
)
{
{
WARN
(
"Surface sizes do not match.
\n
"
);
WARN
(
"Surface sizes do not match.
\n
"
);
return
DDERR_CANNOTATTACHSURFACE
;
return
DDERR_CANNOTATTACHSURFACE
;
}
}
/* OK */
}
}
else
if
(
This
->
surface_desc
.
ddsCaps
.
dwCaps
&
(
DDSCAPS_PRIMARYSURFACE
|
DDSCAPS_3DDEVICE
)
else
if
(
!
(
surface
->
surface_desc
.
ddsCaps
.
dwCaps
&
(
DDSCAPS_PRIMARYSURFACE
|
DDSCAPS_3DDEVICE
))
&&
attachment_impl
->
surface_desc
.
ddsCaps
.
dwCaps
&
(
DDSCAPS_ZBUFFER
))
||
!
(
attachment_impl
->
surface_desc
.
ddsCaps
.
dwCaps
&
(
DDSCAPS_ZBUFFER
)))
{
/* OK */
}
else
{
{
WARN
(
"Invalid attachment combination.
\n
"
);
WARN
(
"Invalid attachment combination.
\n
"
);
return
DDERR_CANNOTATTACHSURFACE
;
return
DDERR_CANNOTATTACHSURFACE
;
}
}
hr
=
ddraw_surface_attach_surface
(
This
,
attachment_impl
);
if
(
FAILED
(
hr
=
ddraw_surface_attach_surface
(
surface
,
attachment_impl
)))
if
(
FAILED
(
hr
))
{
return
hr
;
return
hr
;
}
attachment_impl
->
attached_iface
=
(
IUnknown
*
)
attachment
;
attachment_impl
->
attached_iface
=
(
IUnknown
*
)
attachment
;
IUnknown_AddRef
(
attachment_impl
->
attached_iface
);
IUnknown_AddRef
(
attachment_impl
->
attached_iface
);
return
hr
;
return
hr
;
}
}
static
HRESULT
WINAPI
ddraw_surface3_AddAttachedSurface
(
IDirectDrawSurface3
*
iface
,
IDirectDrawSurface3
*
attachment
)
{
struct
ddraw_surface
*
surface
=
impl_from_IDirectDrawSurface3
(
iface
);
struct
ddraw_surface
*
attachment_impl
=
unsafe_impl_from_IDirectDrawSurface3
(
attachment
);
HRESULT
hr
;
TRACE
(
"iface %p, attachment %p.
\n
"
,
iface
,
attachment
);
if
(
FAILED
(
hr
=
ddraw_surface4_AddAttachedSurface
(
&
surface
->
IDirectDrawSurface4_iface
,
attachment_impl
?
&
attachment_impl
->
IDirectDrawSurface4_iface
:
NULL
)))
return
hr
;
attachment_impl
->
attached_iface
=
(
IUnknown
*
)
attachment
;
IUnknown_AddRef
(
attachment_impl
->
attached_iface
);
ddraw_surface4_Release
(
&
attachment_impl
->
IDirectDrawSurface4_iface
);
return
hr
;
}
static
HRESULT
WINAPI
ddraw_surface2_AddAttachedSurface
(
IDirectDrawSurface2
*
iface
,
IDirectDrawSurface2
*
attachment
)
static
HRESULT
WINAPI
ddraw_surface2_AddAttachedSurface
(
IDirectDrawSurface2
*
iface
,
IDirectDrawSurface2
*
attachment
)
{
{
struct
ddraw_surface
*
This
=
impl_from_IDirectDrawSurface2
(
iface
);
struct
ddraw_surface
*
surface
=
impl_from_IDirectDrawSurface2
(
iface
);
struct
ddraw_surface
*
attachment_impl
=
unsafe_impl_from_IDirectDrawSurface2
(
attachment
);
struct
ddraw_surface
*
attachment_impl
=
unsafe_impl_from_IDirectDrawSurface2
(
attachment
);
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"iface %p, attachment %p.
\n
"
,
iface
,
attachment
);
TRACE
(
"iface %p, attachment %p.
\n
"
,
iface
,
attachment
);
hr
=
ddraw_surface3_AddAttachedSurface
(
&
This
->
IDirectDrawSurface3_iface
,
if
(
FAILED
(
hr
=
ddraw_surface4_AddAttachedSurface
(
&
surface
->
IDirectDrawSurface4_iface
,
attachment_impl
?
&
attachment_impl
->
IDirectDrawSurface3_iface
:
NULL
);
attachment_impl
?
&
attachment_impl
->
IDirectDrawSurface4_iface
:
NULL
)))
if
(
FAILED
(
hr
))
{
return
hr
;
return
hr
;
}
attachment_impl
->
attached_iface
=
(
IUnknown
*
)
attachment
;
attachment_impl
->
attached_iface
=
(
IUnknown
*
)
attachment
;
IUnknown_AddRef
(
attachment_impl
->
attached_iface
);
IUnknown_AddRef
(
attachment_impl
->
attached_iface
);
ddraw_surface
3_Release
(
&
attachment_impl
->
IDirectDrawSurface3
_iface
);
ddraw_surface
4_Release
(
&
attachment_impl
->
IDirectDrawSurface4
_iface
);
return
hr
;
return
hr
;
}
}
static
HRESULT
WINAPI
ddraw_surface1_AddAttachedSurface
(
IDirectDrawSurface
*
iface
,
IDirectDrawSurface
*
attachment
)
static
HRESULT
WINAPI
ddraw_surface1_AddAttachedSurface
(
IDirectDrawSurface
*
iface
,
IDirectDrawSurface
*
attachment
)
{
{
struct
ddraw_surface
*
This
=
impl_from_IDirectDrawSurface
(
iface
);
struct
ddraw_surface
*
surface
=
impl_from_IDirectDrawSurface
(
iface
);
struct
ddraw_surface
*
attachment_impl
=
unsafe_impl_from_IDirectDrawSurface
(
attachment
);
struct
ddraw_surface
*
attachment_impl
=
unsafe_impl_from_IDirectDrawSurface
(
attachment
);
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"iface %p, attachment %p.
\n
"
,
iface
,
attachment
);
TRACE
(
"iface %p, attachment %p.
\n
"
,
iface
,
attachment
);
hr
=
ddraw_surface3_AddAttachedSurface
(
&
This
->
IDirectDrawSurface3_iface
,
if
(
FAILED
(
hr
=
ddraw_surface4_AddAttachedSurface
(
&
surface
->
IDirectDrawSurface4_iface
,
attachment_impl
?
&
attachment_impl
->
IDirectDrawSurface3_iface
:
NULL
);
attachment_impl
?
&
attachment_impl
->
IDirectDrawSurface4_iface
:
NULL
)))
if
(
FAILED
(
hr
))
{
return
hr
;
return
hr
;
}
attachment_impl
->
attached_iface
=
(
IUnknown
*
)
attachment
;
attachment_impl
->
attached_iface
=
(
IUnknown
*
)
attachment
;
IUnknown_AddRef
(
attachment_impl
->
attached_iface
);
IUnknown_AddRef
(
attachment_impl
->
attached_iface
);
ddraw_surface
3_Release
(
&
attachment_impl
->
IDirectDrawSurface3
_iface
);
ddraw_surface
4_Release
(
&
attachment_impl
->
IDirectDrawSurface4
_iface
);
return
hr
;
return
hr
;
}
}
...
...
dlls/ddraw/tests/ddraw4.c
View file @
7c6ca207
...
@@ -6005,25 +6005,25 @@ static void test_surface_attachment(void)
...
@@ -6005,25 +6005,25 @@ static void test_surface_attachment(void)
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_AddAttachedSurface
(
surface1
,
surface2
);
hr
=
IDirectDrawSurface4_AddAttachedSurface
(
surface1
,
surface2
);
todo_wine
ok
(
SUCCEEDED
(
hr
),
"Failed to attach surface, hr %#x.
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Failed to attach surface, hr %#x.
\n
"
,
hr
);
/* Try the reverse without detaching first. */
/* Try the reverse without detaching first. */
hr
=
IDirectDrawSurface4_AddAttachedSurface
(
surface2
,
surface1
);
hr
=
IDirectDrawSurface4_AddAttachedSurface
(
surface2
,
surface1
);
todo_wine
ok
(
hr
==
DDERR_SURFACEALREADYATTACHED
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_SURFACEALREADYATTACHED
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_DeleteAttachedSurface
(
surface1
,
0
,
surface2
);
hr
=
IDirectDrawSurface4_DeleteAttachedSurface
(
surface1
,
0
,
surface2
);
todo_wine
ok
(
SUCCEEDED
(
hr
),
"Failed to detach surface, hr %#x.
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Failed to detach surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_AddAttachedSurface
(
surface2
,
surface1
);
hr
=
IDirectDrawSurface4_AddAttachedSurface
(
surface2
,
surface1
);
todo_wine
ok
(
SUCCEEDED
(
hr
),
"Failed to attach surface, hr %#x.
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Failed to attach surface, hr %#x.
\n
"
,
hr
);
/* Try to detach reversed. */
/* Try to detach reversed. */
hr
=
IDirectDrawSurface4_DeleteAttachedSurface
(
surface1
,
0
,
surface2
);
hr
=
IDirectDrawSurface4_DeleteAttachedSurface
(
surface1
,
0
,
surface2
);
ok
(
hr
==
DDERR_CANNOTDETACHSURFACE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_CANNOTDETACHSURFACE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_DeleteAttachedSurface
(
surface2
,
0
,
surface1
);
hr
=
IDirectDrawSurface4_DeleteAttachedSurface
(
surface2
,
0
,
surface1
);
todo_wine
ok
(
SUCCEEDED
(
hr
),
"Failed to detach surface, hr %#x.
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Failed to detach surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_AddAttachedSurface
(
surface2
,
surface3
);
hr
=
IDirectDrawSurface4_AddAttachedSurface
(
surface2
,
surface3
);
todo_wine
ok
(
SUCCEEDED
(
hr
),
"Failed to attach surface, hr %#x.
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Failed to attach surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_DeleteAttachedSurface
(
surface2
,
0
,
surface3
);
hr
=
IDirectDrawSurface4_DeleteAttachedSurface
(
surface2
,
0
,
surface3
);
todo_wine
ok
(
SUCCEEDED
(
hr
),
"Failed to detach surface, hr %#x.
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Failed to detach surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_AddAttachedSurface
(
surface1
,
surface4
);
hr
=
IDirectDrawSurface4_AddAttachedSurface
(
surface1
,
surface4
);
ok
(
hr
==
DDERR_CANNOTATTACHSURFACE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_CANNOTATTACHSURFACE
,
"Got unexpected 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