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
d50ff220
Commit
d50ff220
authored
Jun 21, 2006
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jun 22, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Use the handle infrastructure for Matrix handles.
parent
22eeeb14
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
17 deletions
+78
-17
ddraw_private.h
dlls/ddraw/ddraw_private.h
+2
-1
device.c
dlls/ddraw/device.c
+76
-16
No files found.
dlls/ddraw/ddraw_private.h
View file @
d50ff220
...
...
@@ -270,7 +270,8 @@ typedef enum
{
DDrawHandle_Unknown
=
0
,
DDrawHandle_Texture
=
1
,
DDrawHandle_Material
=
2
DDrawHandle_Material
=
2
,
DDrawHandle_Matrix
=
3
}
DDrawHandleTypes
;
struct
HandleEntry
...
...
dlls/ddraw/device.c
View file @
d50ff220
...
...
@@ -341,6 +341,16 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
FIXME
(
"Material handle %ld not unset properly
\n
"
,
i
+
1
);
mat
->
Handle
=
0
;
}
break
;
case
DDrawHandle_Matrix
:
{
/* No fixme here because this might happen because of sloppy apps */
WARN
(
"Leftover matrix handle %ld, deleting
\n
"
,
i
+
1
);
IDirect3DDevice_DeleteMatrix
(
ICOM_INTERFACE
(
This
,
IDirect3DDevice
),
i
+
1
);
}
break
;
default:
FIXME
(
"Unknown handle %ld not unset properly
\n
"
,
i
+
1
);
...
...
@@ -1186,8 +1196,8 @@ Thunk_IDirect3DDeviceImpl_1_EnumTextureFormats(IDirect3DDevice *iface,
/*****************************************************************************
* IDirect3DDevice::CreateMatrix
*
* Creates a matrix handle.
In Wine, Matrix handles are simply pointer
s
*
to a D3DMATRIX structure
* Creates a matrix handle.
A handle is created and memory for a D3DMATRIX i
s
*
allocated for the handle.
*
* Version 1 only
*
...
...
@@ -1203,13 +1213,28 @@ static HRESULT WINAPI
IDirect3DDeviceImpl_1_CreateMatrix
(
IDirect3DDevice
*
iface
,
D3DMATRIXHANDLE
*
D3DMatHandle
)
{
ICOM_THIS_FROM
(
IDirect3DDeviceImpl
,
IDirect3DDevice
,
iface
);
D3DMATRIX
*
Matrix
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
D3DMatHandle
);
if
(
!
D3DMatHandle
)
return
DDERR_INVALIDPARAMS
;
*
D3DMatHandle
=
(
D3DMATRIXHANDLE
)
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
D3DMATRIX
));
TRACE
(
" returning matrix handle %p
\n
"
,
(
void
*
)
*
D3DMatHandle
);
Matrix
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
D3DMATRIX
));
if
(
!
Matrix
)
{
ERR
(
"Out of memory when allocating a D3DMATRIX
\n
"
);
return
DDERR_OUTOFMEMORY
;
}
*
D3DMatHandle
=
IDirect3DDeviceImpl_CreateHandle
(
This
);
if
(
!
(
*
D3DMatHandle
))
{
ERR
(
"Failed to create a matrix handle
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
Matrix
);
return
DDERR_OUTOFMEMORY
;
}
This
->
Handles
[(
DWORD
)
D3DMatHandle
-
1
].
ptr
=
Matrix
;
This
->
Handles
[(
DWORD
)
D3DMatHandle
-
1
].
type
=
DDrawHandle_Matrix
;
TRACE
(
" returning matrix handle %ld
\n
"
,
*
D3DMatHandle
);
return
D3D_OK
;
}
...
...
@@ -1217,9 +1242,8 @@ IDirect3DDeviceImpl_1_CreateMatrix(IDirect3DDevice *iface, D3DMATRIXHANDLE *D3DM
/*****************************************************************************
* IDirect3DDevice::SetMatrix
*
* Sets a matrix for a matrix handle. As matrix handles are pointers to
* a D3DMATRIX structure, the matrix is simply copied into the allocated
* memory.
* Sets a matrix for a matrix handle. The matrix is copied into the memory
* allocated for the handle
*
* Version 1 only
*
...
...
@@ -1229,7 +1253,8 @@ IDirect3DDeviceImpl_1_CreateMatrix(IDirect3DDevice *iface, D3DMATRIXHANDLE *D3DM
*
* Returns:
* D3D_OK on success
* DDERR_INVALIDPARAMS if the handle of the matrix is NULL
* DDERR_INVALIDPARAMS if the handle of the matrix is invalid or the matrix
* to set is NULL
*
*****************************************************************************/
static
HRESULT
WINAPI
...
...
@@ -1243,10 +1268,21 @@ IDirect3DDeviceImpl_1_SetMatrix(IDirect3DDevice *iface,
if
(
(
!
D3DMatHandle
)
||
(
!
D3DMatrix
)
)
return
DDERR_INVALIDPARAMS
;
if
(
D3DMatHandle
>
This
->
numHandles
)
{
ERR
(
"Handle %ld out of range
\n
"
,
D3DMatHandle
);
return
DDERR_INVALIDPARAMS
;
}
else
if
(
This
->
Handles
[
D3DMatHandle
-
1
].
type
!=
DDrawHandle_Matrix
)
{
ERR
(
"Handle %ld is not a matrix handle
\n
"
,
D3DMatHandle
);
return
DDERR_INVALIDPARAMS
;
}
if
(
TRACE_ON
(
d3d7
))
dump_D3DMATRIX
(
D3DMatrix
);
*
((
D3DMATRIX
*
)
D3DMatHandle
)
=
*
D3DMatrix
;
*
((
D3DMATRIX
*
)
This
->
Handles
[
D3DMatHandle
-
1
].
ptr
)
=
*
D3DMatrix
;
return
D3D_OK
;
}
...
...
@@ -1264,7 +1300,7 @@ IDirect3DDeviceImpl_1_SetMatrix(IDirect3DDevice *iface,
*
* Returns:
* D3D_OK on success
* DDERR_INVALIDPARAMS if D3DMatHandle
or D3DMatrix are
NULL
* DDERR_INVALIDPARAMS if D3DMatHandle
is invalid or D3DMatrix is
NULL
*
*****************************************************************************/
static
HRESULT
WINAPI
...
...
@@ -1277,11 +1313,22 @@ IDirect3DDeviceImpl_1_GetMatrix(IDirect3DDevice *iface,
if
(
!
D3DMatrix
)
return
DDERR_INVALIDPARAMS
;
if
(
!
(
D3DMATRIX
*
)
D3DMatHandle
)
if
(
!
D3DMatHandle
)
return
DDERR_INVALIDPARAMS
;
if
(
D3DMatHandle
>
This
->
numHandles
)
{
ERR
(
"Handle %ld out of range
\n
"
,
D3DMatHandle
);
return
DDERR_INVALIDPARAMS
;
}
else
if
(
This
->
Handles
[
D3DMatHandle
-
1
].
type
!=
DDrawHandle_Matrix
)
{
ERR
(
"Handle %ld is not a matrix handle
\n
"
,
D3DMatHandle
);
return
DDERR_INVALIDPARAMS
;
}
/* The handle is simply a pointer to a D3DMATRIX structure */
*
D3DMatrix
=
*
((
D3DMATRIX
*
)
D3DMatHandle
);
*
D3DMatrix
=
*
((
D3DMATRIX
*
)
This
->
Handles
[
D3DMatHandle
-
1
].
ptr
);
return
D3D_OK
;
}
...
...
@@ -1289,7 +1336,7 @@ IDirect3DDeviceImpl_1_GetMatrix(IDirect3DDevice *iface,
/*****************************************************************************
* IDirect3DDevice::DeleteMatrix
*
* Destroys a Matrix handle.
* Destroys a Matrix handle.
Frees the memory and unsets the handle data
*
* Version 1 only
*
...
...
@@ -1298,7 +1345,7 @@ IDirect3DDeviceImpl_1_GetMatrix(IDirect3DDevice *iface,
*
* Returns:
* D3D_OK on success
* DDERR_INVALIDPARAMS if D3DMatHandle is
NULL
* DDERR_INVALIDPARAMS if D3DMatHandle is
invalid
*
*****************************************************************************/
static
HRESULT
WINAPI
...
...
@@ -1308,10 +1355,23 @@ IDirect3DDeviceImpl_1_DeleteMatrix(IDirect3DDevice *iface,
ICOM_THIS_FROM
(
IDirect3DDeviceImpl
,
IDirect3DDevice
,
iface
);
TRACE
(
"(%p)->(%08lx)
\n
"
,
This
,
(
DWORD
)
D3DMatHandle
);
if
(
!
(
D3DMATRIX
*
)
D3DMatHandle
)
if
(
!
D3DMatHandle
)
return
DDERR_INVALIDPARAMS
;
if
(
D3DMatHandle
>
This
->
numHandles
)
{
ERR
(
"Handle %ld out of range
\n
"
,
D3DMatHandle
);
return
DDERR_INVALIDPARAMS
;
}
else
if
(
This
->
Handles
[
D3DMatHandle
-
1
].
type
!=
DDrawHandle_Matrix
)
{
ERR
(
"Handle %ld is not a matrix handle
\n
"
,
D3DMatHandle
);
return
DDERR_INVALIDPARAMS
;
}
HeapFree
(
GetProcessHeap
(),
0
,
(
void
*
)
D3DMatHandle
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
Handles
[
D3DMatHandle
-
1
].
ptr
);
This
->
Handles
[
D3DMatHandle
-
1
].
ptr
=
NULL
;
This
->
Handles
[
D3DMatHandle
-
1
].
type
=
DDrawHandle_Unknown
;
return
D3D_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