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
de690b8d
Commit
de690b8d
authored
Oct 31, 2012
by
Christian Costa
Committed by
Alexandre Julliard
Oct 31, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3drm: Move mesh builder data cleaning code into a separate function.
parent
43d3ba36
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
37 deletions
+22
-37
meshbuilder.c
dlls/d3drm/meshbuilder.c
+22
-37
No files found.
dlls/d3drm/meshbuilder.c
View file @
de690b8d
...
...
@@ -314,6 +314,25 @@ static inline IDirect3DRMMeshBuilderImpl *impl_from_IDirect3DRMMeshBuilder3(IDir
return
CONTAINING_RECORD
(
iface
,
IDirect3DRMMeshBuilderImpl
,
IDirect3DRMMeshBuilder3_iface
);
}
static
void
clean_mesh_builder_data
(
IDirect3DRMMeshBuilderImpl
*
mesh_builder
)
{
HeapFree
(
GetProcessHeap
(),
0
,
mesh_builder
->
name
);
mesh_builder
->
name
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
mesh_builder
->
pVertices
);
mesh_builder
->
pVertices
=
NULL
;
mesh_builder
->
nb_vertices
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
mesh_builder
->
pNormals
);
mesh_builder
->
pNormals
=
NULL
;
mesh_builder
->
nb_normals
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
mesh_builder
->
pFaceData
);
mesh_builder
->
pFaceData
=
NULL
;
mesh_builder
->
face_data_size
=
0
;
mesh_builder
->
nb_faces
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
mesh_builder
->
pCoords2d
);
mesh_builder
->
pCoords2d
=
NULL
;
mesh_builder
->
nb_coords2d
=
0
;
}
/*** IUnknown methods ***/
static
HRESULT
WINAPI
IDirect3DRMMeshBuilder2Impl_QueryInterface
(
IDirect3DRMMeshBuilder2
*
iface
,
REFIID
riid
,
void
**
ppvObject
)
...
...
@@ -363,15 +382,11 @@ static ULONG WINAPI IDirect3DRMMeshBuilder2Impl_Release(IDirect3DRMMeshBuilder2*
if
(
!
ref
)
{
clean_mesh_builder_data
(
This
);
if
(
This
->
material
)
IDirect3DRMMaterial2_Release
(
This
->
material
);
if
(
This
->
texture
)
IDirect3DRMTexture3_Release
(
This
->
texture
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
name
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pVertices
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pNormals
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pFaceData
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pCoords2d
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -1114,9 +1129,6 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3* iface, LPDIRECTXFILEDATA pData)
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
pData
);
/* Remove previous name */
HeapFree
(
GetProcessHeap
(),
0
,
This
->
name
);
This
->
name
=
NULL
;
hr
=
IDirectXFileData_GetName
(
pData
,
NULL
,
&
size
);
if
(
hr
!=
DXFILE_OK
)
return
hr
;
...
...
@@ -1128,11 +1140,7 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3* iface, LPDIRECTXFILEDATA pData)
hr
=
IDirectXFileData_GetName
(
pData
,
This
->
name
,
&
size
);
if
(
hr
!=
DXFILE_OK
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
name
);
This
->
name
=
NULL
;
return
hr
;
}
}
TRACE
(
"Mesh name is '%s'
\n
"
,
This
->
name
?
This
->
name
:
""
);
...
...
@@ -1518,15 +1526,7 @@ static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_Load(IDirect3DRMMeshBuilder3*
TRACE
(
"(%p)->(%p,%p,%x,%p,%p)
\n
"
,
This
,
filename
,
name
,
loadflags
,
cb
,
arg
);
/* First free allocated buffers of previous mesh data */
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pVertices
);
This
->
pVertices
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pNormals
);
This
->
pNormals
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pFaceData
);
This
->
pFaceData
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pCoords2d
);
This
->
pCoords2d
=
NULL
;
clean_mesh_builder_data
(
This
);
if
(
loadflags
==
D3DRMLOAD_FROMMEMORY
)
{
...
...
@@ -1622,22 +1622,7 @@ end:
IDirectXFile_Release
(
pDXFile
);
if
(
ret
!=
D3DRM_OK
)
{
/* Clean mesh data */
This
->
nb_vertices
=
0
;
This
->
nb_normals
=
0
;
This
->
nb_faces
=
0
;
This
->
face_data_size
=
0
;
This
->
nb_coords2d
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pVertices
);
This
->
pVertices
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pNormals
);
This
->
pNormals
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pFaceData
);
This
->
pFaceData
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pCoords2d
);
This
->
pCoords2d
=
NULL
;
}
clean_mesh_builder_data
(
This
);
return
ret
;
}
...
...
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