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
00e37a81
Commit
00e37a81
authored
Apr 28, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
May 07, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Primary surfaces always have screen size.
parent
742260d4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
103 additions
and
29 deletions
+103
-29
ddraw.c
dlls/ddraw/ddraw.c
+8
-29
dsurface.c
dlls/ddraw/tests/dsurface.c
+95
-0
No files found.
dlls/ddraw/ddraw.c
View file @
00e37a81
...
...
@@ -2328,43 +2328,22 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
}
}
/* No Width or no Height? Use the current window size or
* the original screen size
/* No Width or no Height? Use the original screen size
*/
if
(
!
(
desc2
.
dwFlags
&
DDSD_WIDTH
)
||
!
(
desc2
.
dwFlags
&
DDSD_HEIGHT
)
)
{
HWND
window
;
/* Invalid for non-render targets */
if
(
!
(
desc2
.
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
))
{
WARN
(
"Creating a non-Primary surface without Width or Height info, returning DDERR_INVALIDPARAMS
\n
"
);
*
Surf
=
NULL
;
return
DDERR_INVALIDPARAMS
;
}
/* Fallback: From WineD3D / original mode */
desc2
.
dwFlags
|=
DDSD_WIDTH
|
DDSD_HEIGHT
;
desc2
.
dwWidth
=
Mode
.
Width
;
desc2
.
dwHeight
=
Mode
.
Height
;
hr
=
IWineD3DDevice_GetHWND
(
This
->
wineD3DDevice
,
&
window
);
if
(
(
hr
==
D3D_OK
)
&&
(
window
!=
0
)
)
{
RECT
rect
;
if
(
GetWindowRect
(
window
,
&
rect
)
)
{
/* This is a hack until I find a better solution */
if
(
(
rect
.
right
-
rect
.
left
)
<=
1
||
(
rect
.
bottom
-
rect
.
top
)
<=
1
)
{
FIXME
(
"Wanted to get surface dimensions from window %p, but it has only "
"a size of %dx%d. Using full screen dimensions
\n
"
,
window
,
rect
.
right
-
rect
.
left
,
rect
.
bottom
-
rect
.
top
);
}
else
{
/* Not sure if this is correct */
desc2
.
dwWidth
=
rect
.
right
-
rect
.
left
;
desc2
.
dwHeight
=
rect
.
bottom
-
rect
.
top
;
TRACE
(
"Using window %p's dimensions: %dx%d
\n
"
,
window
,
desc2
.
dwWidth
,
desc2
.
dwHeight
);
}
}
}
}
/* Mipmap count fixes */
...
...
dlls/ddraw/tests/dsurface.c
View file @
00e37a81
...
...
@@ -4,6 +4,7 @@
* Copyright (C) 2005 Antoine Chavasse (a.chavasse@gmail.com)
* Copyright (C) 2005 Christian Costa
* Copyright 2005 Ivan Leo Puoti
* Copyright (C) 2007 Stefan Dsinger
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -1724,6 +1725,99 @@ static void CompressedTest(void)
IDirectDraw7_Release
(
dd7
);
}
static
void
SizeTest
(
void
)
{
LPDIRECTDRAWSURFACE
dsurface
=
NULL
;
DDSURFACEDESC
desc
;
HRESULT
ret
;
HWND
window
=
CreateWindow
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
100
,
100
,
160
,
160
,
NULL
,
NULL
,
NULL
,
NULL
);
/* Create an offscreen surface surface without a size */
ZeroMemory
(
&
desc
,
sizeof
(
desc
));
desc
.
dwSize
=
sizeof
(
desc
);
desc
.
dwFlags
=
DDSD_CAPS
;
desc
.
ddsCaps
.
dwCaps
|=
DDSCAPS_OFFSCREENPLAIN
;
ret
=
IDirectDraw_CreateSurface
(
lpDD
,
&
desc
,
&
dsurface
,
NULL
);
ok
(
ret
==
DDERR_INVALIDPARAMS
,
"Creating an offscreen plain surface without a size info returned %08x
\n
"
,
ret
);
if
(
dsurface
)
{
trace
(
"Surface at %p
\n
"
,
dsurface
);
IDirectDrawSurface_Release
(
dsurface
);
dsurface
=
NULL
;
}
/* Create an offscreen surface surface with only a width parameter */
ZeroMemory
(
&
desc
,
sizeof
(
desc
));
desc
.
dwSize
=
sizeof
(
desc
);
desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
;
desc
.
ddsCaps
.
dwCaps
|=
DDSCAPS_OFFSCREENPLAIN
;
desc
.
dwWidth
=
128
;
ret
=
IDirectDraw_CreateSurface
(
lpDD
,
&
desc
,
&
dsurface
,
NULL
);
ok
(
ret
==
DDERR_INVALIDPARAMS
,
"Creating an offscreen plain surface without hight info returned %08x
\n
"
,
ret
);
if
(
dsurface
)
{
IDirectDrawSurface_Release
(
dsurface
);
dsurface
=
NULL
;
}
/* Create an offscreen surface surface with only a height parameter */
ZeroMemory
(
&
desc
,
sizeof
(
desc
));
desc
.
dwSize
=
sizeof
(
desc
);
desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_HEIGHT
;
desc
.
ddsCaps
.
dwCaps
|=
DDSCAPS_OFFSCREENPLAIN
;
desc
.
dwHeight
=
128
;
ret
=
IDirectDraw_CreateSurface
(
lpDD
,
&
desc
,
&
dsurface
,
NULL
);
ok
(
ret
==
DDERR_INVALIDPARAMS
,
"Creating an offscreen plain surface without width info returned %08x
\n
"
,
ret
);
if
(
dsurface
)
{
IDirectDrawSurface_Release
(
dsurface
);
dsurface
=
NULL
;
}
/* Sanity check */
ZeroMemory
(
&
desc
,
sizeof
(
desc
));
desc
.
dwSize
=
sizeof
(
desc
);
desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_HEIGHT
|
DDSD_WIDTH
;
desc
.
ddsCaps
.
dwCaps
|=
DDSCAPS_OFFSCREENPLAIN
;
desc
.
dwHeight
=
128
;
desc
.
dwWidth
=
128
;
ret
=
IDirectDraw_CreateSurface
(
lpDD
,
&
desc
,
&
dsurface
,
NULL
);
ok
(
ret
==
DD_OK
,
"Creating an offscreen plain surface with width and height info returned %08x
\n
"
,
ret
);
if
(
dsurface
)
{
IDirectDrawSurface_Release
(
dsurface
);
dsurface
=
NULL
;
}
/* Test a primary surface size */
ret
=
IDirectDraw_SetCooperativeLevel
(
lpDD
,
window
,
DDSCL_NORMAL
);
ok
(
ret
==
DD_OK
,
"SetCooperativeLevel failed with %08x
\n
"
,
ret
);
ZeroMemory
(
&
desc
,
sizeof
(
desc
));
desc
.
dwSize
=
sizeof
(
desc
);
desc
.
dwFlags
=
DDSD_CAPS
;
desc
.
ddsCaps
.
dwCaps
|=
DDSCAPS_PRIMARYSURFACE
;
desc
.
dwHeight
=
128
;
/* Keep them set to check what happens */
desc
.
dwWidth
=
128
;
/* Keep them set to check what happens */
ret
=
IDirectDraw_CreateSurface
(
lpDD
,
&
desc
,
&
dsurface
,
NULL
);
ok
(
ret
==
DD_OK
,
"Creating a primary surface without width and height info returned %08x
\n
"
,
ret
);
if
(
dsurface
)
{
ret
=
IDirectDrawSurface_GetSurfaceDesc
(
dsurface
,
&
desc
);
ok
(
ret
==
DD_OK
,
"GetSurfaceDesc returned %x
\n
"
,
ret
);
IDirectDrawSurface_Release
(
dsurface
);
dsurface
=
NULL
;
ok
(
desc
.
dwFlags
&
DDSD_WIDTH
,
"Primary surface doesn't have width set
\n
"
);
ok
(
desc
.
dwFlags
&
DDSD_HEIGHT
,
"Primary surface doesn't have hight set
\n
"
);
ok
(
desc
.
dwWidth
==
GetSystemMetrics
(
SM_CXSCREEN
),
"Surface Width differs from screen Width
\n
"
);
ok
(
desc
.
dwHeight
==
GetSystemMetrics
(
SM_CYSCREEN
),
"Surface Width differs from screen Width
\n
"
);
}
ret
=
IDirectDraw_SetCooperativeLevel
(
lpDD
,
NULL
,
DDSCL_NORMAL
);
ok
(
ret
==
DD_OK
,
"SetCooperativeLevel failed with %08x
\n
"
,
ret
);
}
START_TEST
(
dsurface
)
{
if
(
!
CreateDirectDraw
())
...
...
@@ -1740,5 +1834,6 @@ START_TEST(dsurface)
CubeMapTest
();
test_lockrect_invalid
();
CompressedTest
();
SizeTest
();
ReleaseDirectDraw
();
}
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