ddraw: Use the global memory allocation helpers.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
529168ecf7
commit
9cc7c6e99f
|
@ -72,7 +72,7 @@ static ULONG WINAPI ddraw_clipper_Release(IDirectDrawClipper *iface)
|
||||||
{
|
{
|
||||||
if (clipper->region)
|
if (clipper->region)
|
||||||
DeleteObject(clipper->region);
|
DeleteObject(clipper->region);
|
||||||
HeapFree(GetProcessHeap(), 0, clipper);
|
heap_free(clipper);
|
||||||
}
|
}
|
||||||
|
|
||||||
return refcount;
|
return refcount;
|
||||||
|
|
|
@ -376,7 +376,7 @@ static void ddraw_destroy_swapchain(struct ddraw *ddraw)
|
||||||
{
|
{
|
||||||
wined3d_vertex_declaration_decref(ddraw->decls[i].decl);
|
wined3d_vertex_declaration_decref(ddraw->decls[i].decl);
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, ddraw->decls);
|
heap_free(ddraw->decls);
|
||||||
ddraw->numConvertedDecls = 0;
|
ddraw->numConvertedDecls = 0;
|
||||||
|
|
||||||
if (FAILED(wined3d_device_uninit_3d(ddraw->wined3d_device)))
|
if (FAILED(wined3d_device_uninit_3d(ddraw->wined3d_device)))
|
||||||
|
@ -442,7 +442,7 @@ static void ddraw_destroy(struct ddraw *This)
|
||||||
This->d3ddevice->ddraw = NULL;
|
This->d3ddevice->ddraw = NULL;
|
||||||
|
|
||||||
/* Now free the object */
|
/* Now free the object */
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
heap_free(This);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
@ -600,8 +600,7 @@ static HRESULT ddraw_attach_d3d_device(struct ddraw *ddraw,
|
||||||
}
|
}
|
||||||
|
|
||||||
ddraw->declArraySize = 2;
|
ddraw->declArraySize = 2;
|
||||||
ddraw->decls = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ddraw->decls) * ddraw->declArraySize);
|
if (!(ddraw->decls = heap_alloc_zero(ddraw->declArraySize * sizeof(*ddraw->decls))))
|
||||||
if (!ddraw->decls)
|
|
||||||
{
|
{
|
||||||
ERR("Error allocating an array for the converted vertex decls.\n");
|
ERR("Error allocating an array for the converted vertex decls.\n");
|
||||||
ddraw->declArraySize = 0;
|
ddraw->declArraySize = 0;
|
||||||
|
@ -2390,8 +2389,8 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags,
|
||||||
if (!cb)
|
if (!cb)
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
|
|
||||||
enum_modes = HeapAlloc(GetProcessHeap(), 0, sizeof(*enum_modes) * enum_mode_array_size);
|
if (!(enum_modes = heap_alloc(enum_mode_array_size * sizeof(*enum_modes))))
|
||||||
if (!enum_modes) return DDERR_OUTOFMEMORY;
|
return DDERR_OUTOFMEMORY;
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
|
|
||||||
|
@ -2455,7 +2454,7 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags,
|
||||||
if(cb(&callback_sd, Context) == DDENUMRET_CANCEL)
|
if(cb(&callback_sd, Context) == DDENUMRET_CANCEL)
|
||||||
{
|
{
|
||||||
TRACE("Application asked to terminate the enumeration\n");
|
TRACE("Application asked to terminate the enumeration\n");
|
||||||
HeapFree(GetProcessHeap(), 0, enum_modes);
|
heap_free(enum_modes);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
@ -2465,11 +2464,9 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags,
|
||||||
struct wined3d_display_mode *new_enum_modes;
|
struct wined3d_display_mode *new_enum_modes;
|
||||||
|
|
||||||
enum_mode_array_size *= 2;
|
enum_mode_array_size *= 2;
|
||||||
new_enum_modes = HeapReAlloc(GetProcessHeap(), 0, enum_modes,
|
if (!(new_enum_modes = heap_realloc(enum_modes, enum_mode_array_size * sizeof(*new_enum_modes))))
|
||||||
sizeof(*new_enum_modes) * enum_mode_array_size);
|
|
||||||
if (!new_enum_modes)
|
|
||||||
{
|
{
|
||||||
HeapFree(GetProcessHeap(), 0, enum_modes);
|
heap_free(enum_modes);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
return DDERR_OUTOFMEMORY;
|
return DDERR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
@ -2481,7 +2478,7 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags,
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("End of enumeration\n");
|
TRACE("End of enumeration\n");
|
||||||
HeapFree(GetProcessHeap(), 0, enum_modes);
|
heap_free(enum_modes);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
|
@ -3319,8 +3316,7 @@ HRESULT WINAPI DirectDrawCreateClipper(DWORD flags, IDirectDrawClipper **clipper
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
|
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||||
if (!object)
|
|
||||||
{
|
{
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -3330,7 +3326,7 @@ HRESULT WINAPI DirectDrawCreateClipper(DWORD flags, IDirectDrawClipper **clipper
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
WARN("Failed to initialize clipper, hr %#x.\n", hr);
|
WARN("Failed to initialize clipper, hr %#x.\n", hr);
|
||||||
HeapFree(GetProcessHeap(), 0, object);
|
heap_free(object);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -3430,8 +3426,7 @@ static HRESULT WINAPI ddraw7_CreatePalette(IDirectDraw7 *iface, DWORD Flags,
|
||||||
return DDERR_NOCOOPERATIVELEVELSET;
|
return DDERR_NOCOOPERATIVELEVELSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
object = HeapAlloc(GetProcessHeap(), 0, sizeof(*object));
|
if (!(object = heap_alloc(sizeof(*object))))
|
||||||
if (!object)
|
|
||||||
{
|
{
|
||||||
ERR("Out of memory when allocating memory for a palette implementation\n");
|
ERR("Out of memory when allocating memory for a palette implementation\n");
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
@ -3442,7 +3437,7 @@ static HRESULT WINAPI ddraw7_CreatePalette(IDirectDraw7 *iface, DWORD Flags,
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
WARN("Failed to initialize palette, hr %#x.\n", hr);
|
WARN("Failed to initialize palette, hr %#x.\n", hr);
|
||||||
HeapFree(GetProcessHeap(), 0, object);
|
heap_free(object);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -3838,10 +3833,10 @@ static HRESULT WINAPI d3d3_CreateLight(IDirect3D3 *iface, IDirect3DLight **light
|
||||||
|
|
||||||
TRACE("iface %p, light %p, outer_unknown %p.\n", iface, light, outer_unknown);
|
TRACE("iface %p, light %p, outer_unknown %p.\n", iface, light, outer_unknown);
|
||||||
|
|
||||||
if (outer_unknown) return CLASS_E_NOAGGREGATION;
|
if (outer_unknown)
|
||||||
|
return CLASS_E_NOAGGREGATION;
|
||||||
|
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||||
if (!object)
|
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate light memory.\n");
|
ERR("Failed to allocate light memory.\n");
|
||||||
return DDERR_OUTOFMEMORY;
|
return DDERR_OUTOFMEMORY;
|
||||||
|
@ -3988,8 +3983,7 @@ static HRESULT WINAPI d3d3_CreateViewport(IDirect3D3 *iface, IDirect3DViewport3
|
||||||
|
|
||||||
if (outer_unknown) return CLASS_E_NOAGGREGATION;
|
if (outer_unknown) return CLASS_E_NOAGGREGATION;
|
||||||
|
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||||
if (!object)
|
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate viewport memory.\n");
|
ERR("Failed to allocate viewport memory.\n");
|
||||||
return DDERR_OUTOFMEMORY;
|
return DDERR_OUTOFMEMORY;
|
||||||
|
@ -4704,11 +4698,12 @@ struct wined3d_vertex_declaration *ddraw_find_decl(struct ddraw *This, DWORD fvf
|
||||||
fvf, This, &ddraw_null_wined3d_parent_ops, &pDecl);
|
fvf, This, &ddraw_null_wined3d_parent_ops, &pDecl);
|
||||||
if (hr != S_OK) return NULL;
|
if (hr != S_OK) return NULL;
|
||||||
|
|
||||||
if(This->declArraySize == This->numConvertedDecls) {
|
if (This->declArraySize == This->numConvertedDecls)
|
||||||
int grow = max(This->declArraySize / 2, 8);
|
{
|
||||||
convertedDecls = HeapReAlloc(GetProcessHeap(), 0, convertedDecls,
|
unsigned int grow = max(This->declArraySize / 2, 8);
|
||||||
sizeof(convertedDecls[0]) * (This->numConvertedDecls + grow));
|
|
||||||
if (!convertedDecls)
|
if (!(convertedDecls = heap_realloc(convertedDecls,
|
||||||
|
(This->numConvertedDecls + grow) * sizeof(*convertedDecls))))
|
||||||
{
|
{
|
||||||
wined3d_vertex_declaration_decref(pDecl);
|
wined3d_vertex_declaration_decref(pDecl);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -4824,7 +4819,7 @@ static HRESULT CDECL device_parent_surface_created(struct wined3d_device_parent
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(ddraw_surface = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ddraw_surface))))
|
if (!(ddraw_surface = heap_alloc_zero(sizeof(*ddraw_surface))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate surface memory.\n");
|
ERR("Failed to allocate surface memory.\n");
|
||||||
return DDERR_OUTOFVIDEOMEMORY;
|
return DDERR_OUTOFVIDEOMEMORY;
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#define NONAMELESSSTRUCT
|
#define NONAMELESSSTRUCT
|
||||||
#define NONAMELESSUNION
|
#define NONAMELESSUNION
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
#include "wine/heap.h"
|
||||||
|
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "wingdi.h"
|
#include "wingdi.h"
|
||||||
|
|
|
@ -322,7 +322,7 @@ static ULONG WINAPI d3d_device_inner_Release(IUnknown *iface)
|
||||||
This->ddraw->d3ddevice = NULL;
|
This->ddraw->d3ddevice = NULL;
|
||||||
|
|
||||||
/* Now free the structure */
|
/* Now free the structure */
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
heap_free(This);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -663,8 +663,7 @@ static HRESULT WINAPI d3d_device1_CreateExecuteBuffer(IDirect3DDevice *iface,
|
||||||
return CLASS_E_NOAGGREGATION;
|
return CLASS_E_NOAGGREGATION;
|
||||||
|
|
||||||
/* Allocate the new Execute Buffer */
|
/* Allocate the new Execute Buffer */
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||||
if(!object)
|
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate execute buffer memory.\n");
|
ERR("Failed to allocate execute buffer memory.\n");
|
||||||
return DDERR_OUTOFMEMORY;
|
return DDERR_OUTOFMEMORY;
|
||||||
|
@ -674,7 +673,7 @@ static HRESULT WINAPI d3d_device1_CreateExecuteBuffer(IDirect3DDevice *iface,
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
WARN("Failed to initialize execute buffer, hr %#x.\n", hr);
|
WARN("Failed to initialize execute buffer, hr %#x.\n", hr);
|
||||||
HeapFree(GetProcessHeap(), 0, object);
|
heap_free(object);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1274,7 +1273,7 @@ static HRESULT WINAPI d3d_device1_EnumTextureFormats(IDirect3DDevice *iface,
|
||||||
static HRESULT WINAPI d3d_device1_CreateMatrix(IDirect3DDevice *iface, D3DMATRIXHANDLE *D3DMatHandle)
|
static HRESULT WINAPI d3d_device1_CreateMatrix(IDirect3DDevice *iface, D3DMATRIXHANDLE *D3DMatHandle)
|
||||||
{
|
{
|
||||||
struct d3d_device *device = impl_from_IDirect3DDevice(iface);
|
struct d3d_device *device = impl_from_IDirect3DDevice(iface);
|
||||||
D3DMATRIX *Matrix;
|
D3DMATRIX *matrix;
|
||||||
DWORD h;
|
DWORD h;
|
||||||
|
|
||||||
TRACE("iface %p, matrix_handle %p.\n", iface, D3DMatHandle);
|
TRACE("iface %p, matrix_handle %p.\n", iface, D3DMatHandle);
|
||||||
|
@ -1282,8 +1281,7 @@ static HRESULT WINAPI d3d_device1_CreateMatrix(IDirect3DDevice *iface, D3DMATRIX
|
||||||
if(!D3DMatHandle)
|
if(!D3DMatHandle)
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
|
|
||||||
Matrix = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(D3DMATRIX));
|
if (!(matrix = heap_alloc_zero(sizeof(*matrix))))
|
||||||
if(!Matrix)
|
|
||||||
{
|
{
|
||||||
ERR("Out of memory when allocating a D3DMATRIX\n");
|
ERR("Out of memory when allocating a D3DMATRIX\n");
|
||||||
return DDERR_OUTOFMEMORY;
|
return DDERR_OUTOFMEMORY;
|
||||||
|
@ -1291,11 +1289,11 @@ static HRESULT WINAPI d3d_device1_CreateMatrix(IDirect3DDevice *iface, D3DMATRIX
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
|
|
||||||
h = ddraw_allocate_handle(&device->handle_table, Matrix, DDRAW_HANDLE_MATRIX);
|
h = ddraw_allocate_handle(&device->handle_table, matrix, DDRAW_HANDLE_MATRIX);
|
||||||
if (h == DDRAW_INVALID_HANDLE)
|
if (h == DDRAW_INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate a matrix handle.\n");
|
ERR("Failed to allocate a matrix handle.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, Matrix);
|
heap_free(matrix);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
return DDERR_OUTOFMEMORY;
|
return DDERR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
@ -1446,7 +1444,7 @@ static HRESULT WINAPI d3d_device1_DeleteMatrix(IDirect3DDevice *iface, D3DMATRIX
|
||||||
|
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, m);
|
heap_free(m);
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
@ -2218,11 +2216,11 @@ static HRESULT WINAPI d3d_device3_Vertex(IDirect3DDevice3 *iface, void *vertex)
|
||||||
|
|
||||||
device->buffer_size = device->buffer_size ? device->buffer_size * 2 : device->vertex_size * 3;
|
device->buffer_size = device->buffer_size ? device->buffer_size * 2 : device->vertex_size * 3;
|
||||||
old_buffer = device->sysmem_vertex_buffer;
|
old_buffer = device->sysmem_vertex_buffer;
|
||||||
device->sysmem_vertex_buffer = HeapAlloc(GetProcessHeap(), 0, device->buffer_size);
|
device->sysmem_vertex_buffer = heap_alloc(device->buffer_size);
|
||||||
if (old_buffer)
|
if (old_buffer)
|
||||||
{
|
{
|
||||||
memcpy(device->sysmem_vertex_buffer, old_buffer, device->nb_vertices * device->vertex_size);
|
memcpy(device->sysmem_vertex_buffer, old_buffer, device->nb_vertices * device->vertex_size);
|
||||||
HeapFree(GetProcessHeap(), 0, old_buffer);
|
heap_free(old_buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7020,8 +7018,7 @@ HRESULT d3d_device_create(struct ddraw *ddraw, struct ddraw_surface *target, IUn
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||||
if (!object)
|
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate device memory.\n");
|
ERR("Failed to allocate device memory.\n");
|
||||||
return DDERR_OUTOFMEMORY;
|
return DDERR_OUTOFMEMORY;
|
||||||
|
@ -7030,7 +7027,7 @@ HRESULT d3d_device_create(struct ddraw *ddraw, struct ddraw_surface *target, IUn
|
||||||
if (FAILED(hr = d3d_device_init(object, ddraw, target, rt_iface, version, outer_unknown)))
|
if (FAILED(hr = d3d_device_init(object, ddraw, target, rt_iface, version, outer_unknown)))
|
||||||
{
|
{
|
||||||
WARN("Failed to initialize device, hr %#x.\n", hr);
|
WARN("Failed to initialize device, hr %#x.\n", hr);
|
||||||
HeapFree(GetProcessHeap(), 0, object);
|
heap_free(object);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -508,7 +508,7 @@ static ULONG WINAPI d3d_execute_buffer_Release(IDirect3DExecuteBuffer *iface)
|
||||||
if (!ref)
|
if (!ref)
|
||||||
{
|
{
|
||||||
if (buffer->need_free)
|
if (buffer->need_free)
|
||||||
HeapFree(GetProcessHeap(), 0, buffer->desc.lpData);
|
heap_free(buffer->desc.lpData);
|
||||||
if (buffer->index_buffer)
|
if (buffer->index_buffer)
|
||||||
wined3d_buffer_decref(buffer->index_buffer);
|
wined3d_buffer_decref(buffer->index_buffer);
|
||||||
if (buffer->dst_vertex_buffer)
|
if (buffer->dst_vertex_buffer)
|
||||||
|
@ -516,7 +516,7 @@ static ULONG WINAPI d3d_execute_buffer_Release(IDirect3DExecuteBuffer *iface)
|
||||||
wined3d_buffer_decref(buffer->src_vertex_buffer);
|
wined3d_buffer_decref(buffer->src_vertex_buffer);
|
||||||
wined3d_buffer_decref(buffer->dst_vertex_buffer);
|
wined3d_buffer_decref(buffer->dst_vertex_buffer);
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, buffer);
|
heap_free(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
|
@ -791,8 +791,7 @@ HRESULT d3d_execute_buffer_init(struct d3d_execute_buffer *execute_buffer,
|
||||||
if (!execute_buffer->desc.lpData && execute_buffer->desc.dwBufferSize)
|
if (!execute_buffer->desc.lpData && execute_buffer->desc.dwBufferSize)
|
||||||
{
|
{
|
||||||
execute_buffer->need_free = TRUE;
|
execute_buffer->need_free = TRUE;
|
||||||
execute_buffer->desc.lpData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, execute_buffer->desc.dwBufferSize);
|
if (!(execute_buffer->desc.lpData = heap_alloc_zero(execute_buffer->desc.dwBufferSize)))
|
||||||
if (!execute_buffer->desc.lpData)
|
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate execute buffer data.\n");
|
ERR("Failed to allocate execute buffer data.\n");
|
||||||
return DDERR_OUTOFMEMORY;
|
return DDERR_OUTOFMEMORY;
|
||||||
|
|
|
@ -133,7 +133,7 @@ static ULONG WINAPI d3d_light_Release(IDirect3DLight *iface)
|
||||||
|
|
||||||
if (!ref)
|
if (!ref)
|
||||||
{
|
{
|
||||||
HeapFree(GetProcessHeap(), 0, light);
|
heap_free(light);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return ref;
|
return ref;
|
||||||
|
|
|
@ -92,8 +92,7 @@ static void ddraw_enumerate_secondary_devices(struct wined3d *wined3d, LPDDENUMC
|
||||||
/* Handle table functions */
|
/* Handle table functions */
|
||||||
BOOL ddraw_handle_table_init(struct ddraw_handle_table *t, UINT initial_size)
|
BOOL ddraw_handle_table_init(struct ddraw_handle_table *t, UINT initial_size)
|
||||||
{
|
{
|
||||||
t->entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, initial_size * sizeof(*t->entries));
|
if (!(t->entries = heap_alloc_zero(initial_size * sizeof(*t->entries))))
|
||||||
if (!t->entries)
|
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate handle table memory.\n");
|
ERR("Failed to allocate handle table memory.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -107,7 +106,7 @@ BOOL ddraw_handle_table_init(struct ddraw_handle_table *t, UINT initial_size)
|
||||||
|
|
||||||
void ddraw_handle_table_destroy(struct ddraw_handle_table *t)
|
void ddraw_handle_table_destroy(struct ddraw_handle_table *t)
|
||||||
{
|
{
|
||||||
HeapFree(GetProcessHeap(), 0, t->entries);
|
heap_free(t->entries);
|
||||||
memset(t, 0, sizeof(*t));
|
memset(t, 0, sizeof(*t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,9 +135,9 @@ DWORD ddraw_allocate_handle(struct ddraw_handle_table *t, void *object, enum ddr
|
||||||
{
|
{
|
||||||
/* Grow the table */
|
/* Grow the table */
|
||||||
UINT new_size = t->table_size + (t->table_size >> 1);
|
UINT new_size = t->table_size + (t->table_size >> 1);
|
||||||
struct ddraw_handle_entry *new_entries = HeapReAlloc(GetProcessHeap(),
|
struct ddraw_handle_entry *new_entries;
|
||||||
0, t->entries, new_size * sizeof(*t->entries));
|
|
||||||
if (!new_entries)
|
if (!(new_entries = heap_realloc(t->entries, new_size * sizeof(*t->entries))))
|
||||||
{
|
{
|
||||||
ERR("Failed to grow the handle table.\n");
|
ERR("Failed to grow the handle table.\n");
|
||||||
return DDRAW_INVALID_HANDLE;
|
return DDRAW_INVALID_HANDLE;
|
||||||
|
@ -298,8 +297,7 @@ DDRAW_Create(const GUID *guid,
|
||||||
flags = WINED3D_LEGACY_FFP_LIGHTING;
|
flags = WINED3D_LEGACY_FFP_LIGHTING;
|
||||||
|
|
||||||
/* DirectDraw creation comes here */
|
/* DirectDraw creation comes here */
|
||||||
ddraw = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ddraw));
|
if (!(ddraw = heap_alloc_zero(sizeof(*ddraw))))
|
||||||
if (!ddraw)
|
|
||||||
{
|
{
|
||||||
ERR("Out of memory when creating DirectDraw\n");
|
ERR("Out of memory when creating DirectDraw\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -309,7 +307,7 @@ DDRAW_Create(const GUID *guid,
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
WARN("Failed to initialize ddraw object, hr %#x.\n", hr);
|
WARN("Failed to initialize ddraw object, hr %#x.\n", hr);
|
||||||
HeapFree(GetProcessHeap(), 0, ddraw);
|
heap_free(ddraw);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,7 +668,7 @@ static ULONG WINAPI ddraw_class_factory_Release(IClassFactory *iface)
|
||||||
TRACE("%p decreasing refcount to %u.\n", factory, ref);
|
TRACE("%p decreasing refcount to %u.\n", factory, ref);
|
||||||
|
|
||||||
if (!ref)
|
if (!ref)
|
||||||
HeapFree(GetProcessHeap(), 0, factory);
|
heap_free(factory);
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
@ -754,8 +752,8 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **out)
|
||||||
return CLASS_E_CLASSNOTAVAILABLE;
|
return CLASS_E_CLASSNOTAVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*factory));
|
if (!(factory = heap_alloc_zero(sizeof(*factory))))
|
||||||
if (factory == NULL) return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
factory->IClassFactory_iface.lpVtbl = &IClassFactory_Vtbl;
|
factory->IClassFactory_iface.lpVtbl = &IClassFactory_Vtbl;
|
||||||
factory->ref = 1;
|
factory->ref = 1;
|
||||||
|
|
|
@ -150,7 +150,7 @@ static ULONG WINAPI d3d_material3_Release(IDirect3DMaterial3 *iface)
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, material);
|
heap_free(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
|
@ -502,8 +502,7 @@ struct d3d_material *d3d_material_create(struct ddraw *ddraw)
|
||||||
{
|
{
|
||||||
struct d3d_material *material;
|
struct d3d_material *material;
|
||||||
|
|
||||||
material = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*material));
|
if (!(material = heap_alloc_zero(sizeof(*material))))
|
||||||
if (!material)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
material->IDirect3DMaterial3_iface.lpVtbl = &d3d_material3_vtbl;
|
material->IDirect3DMaterial3_iface.lpVtbl = &d3d_material3_vtbl;
|
||||||
|
|
|
@ -100,7 +100,7 @@ static ULONG WINAPI ddraw_palette_Release(IDirectDrawPalette *iface)
|
||||||
IUnknown_Release(palette->ifaceToRelease);
|
IUnknown_Release(palette->ifaceToRelease);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, palette);
|
heap_free(palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
|
|
|
@ -1505,7 +1505,7 @@ static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, cons
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(clip_list = HeapAlloc(GetProcessHeap(), 0, clip_list_size)))
|
if (!(clip_list = heap_alloc(clip_list_size)))
|
||||||
{
|
{
|
||||||
WARN("Failed to allocate clip list.\n");
|
WARN("Failed to allocate clip list.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -1515,7 +1515,7 @@ static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, cons
|
||||||
&dst_rect, clip_list, &clip_list_size)))
|
&dst_rect, clip_list, &clip_list_size)))
|
||||||
{
|
{
|
||||||
WARN("Failed to get clip list, hr %#x.\n", hr);
|
WARN("Failed to get clip list, hr %#x.\n", hr);
|
||||||
HeapFree(GetProcessHeap(), 0, clip_list);
|
heap_free(clip_list);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1549,7 +1549,7 @@ static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, clip_list);
|
heap_free(clip_list);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5750,7 +5750,7 @@ static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *paren
|
||||||
|
|
||||||
wined3d_private_store_cleanup(&surface->private_store);
|
wined3d_private_store_cleanup(&surface->private_store);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, surface);
|
heap_free(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wined3d_parent_ops ddraw_surface_wined3d_parent_ops =
|
static const struct wined3d_parent_ops ddraw_surface_wined3d_parent_ops =
|
||||||
|
@ -5762,7 +5762,7 @@ static void STDMETHODCALLTYPE ddraw_texture_wined3d_object_destroyed(void *paren
|
||||||
{
|
{
|
||||||
TRACE("parent %p.\n", parent);
|
TRACE("parent %p.\n", parent);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, parent);
|
heap_free(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wined3d_parent_ops ddraw_texture_wined3d_parent_ops =
|
static const struct wined3d_parent_ops ddraw_texture_wined3d_parent_ops =
|
||||||
|
@ -5804,7 +5804,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
if (!surface)
|
if (!surface)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
if (!(texture = HeapAlloc(GetProcessHeap(), 0, sizeof(*texture))))
|
if (!(texture = heap_alloc(sizeof(*texture))))
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
texture->version = version;
|
texture->version = version;
|
||||||
|
@ -5819,28 +5819,28 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
if (!(desc->dwFlags & DDSD_BACKBUFFERCOUNT) || !desc->u5.dwBackBufferCount)
|
if (!(desc->dwFlags & DDSD_BACKBUFFERCOUNT) || !desc->u5.dwBackBufferCount)
|
||||||
{
|
{
|
||||||
WARN("Tried to create a flippable surface without any back buffers.\n");
|
WARN("Tried to create a flippable surface without any back buffers.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDCAPS;
|
return DDERR_INVALIDCAPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX))
|
if (!(desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX))
|
||||||
{
|
{
|
||||||
WARN("Tried to create a flippable surface without DDSCAPS_COMPLEX.\n");
|
WARN("Tried to create a flippable surface without DDSCAPS_COMPLEX.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDCAPS;
|
return DDERR_INVALIDCAPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
|
if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
|
||||||
{
|
{
|
||||||
WARN("Tried to create a flippable cubemap.\n");
|
WARN("Tried to create a flippable cubemap.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
|
if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
|
||||||
{
|
{
|
||||||
FIXME("Flippable textures not implemented.\n");
|
FIXME("Flippable textures not implemented.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDCAPS;
|
return DDERR_INVALIDCAPS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5850,7 +5850,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
{
|
{
|
||||||
WARN("Tried to specify a back buffer count for a non-flippable surface.\n");
|
WARN("Tried to specify a back buffer count for a non-flippable surface.\n");
|
||||||
hr = desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP ? DDERR_INVALIDPARAMS : DDERR_INVALIDCAPS;
|
hr = desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP ? DDERR_INVALIDPARAMS : DDERR_INVALIDCAPS;
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5860,21 +5860,21 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
|
if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
|
||||||
{
|
{
|
||||||
WARN("Tried to create a primary surface with DDSCAPS_TEXTURE.\n");
|
WARN("Tried to create a primary surface with DDSCAPS_TEXTURE.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDCAPS;
|
return DDERR_INVALIDCAPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX) && !(desc->ddsCaps.dwCaps & DDSCAPS_FLIP))
|
if ((desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX) && !(desc->ddsCaps.dwCaps & DDSCAPS_FLIP))
|
||||||
{
|
{
|
||||||
WARN("Tried to create a flippable primary surface without both DDSCAPS_FLIP and DDSCAPS_COMPLEX.\n");
|
WARN("Tried to create a flippable primary surface without both DDSCAPS_FLIP and DDSCAPS_COMPLEX.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDCAPS;
|
return DDERR_INVALIDCAPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((desc->ddsCaps.dwCaps & DDSCAPS_FLIP) && !(ddraw->cooperative_level & DDSCL_EXCLUSIVE))
|
if ((desc->ddsCaps.dwCaps & DDSCAPS_FLIP) && !(ddraw->cooperative_level & DDSCL_EXCLUSIVE))
|
||||||
{
|
{
|
||||||
WARN("Tried to create a flippable primary surface without DDSCL_EXCLUSIVE.\n");
|
WARN("Tried to create a flippable primary surface without DDSCL_EXCLUSIVE.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_NOEXCLUSIVEMODE;
|
return DDERR_NOEXCLUSIVEMODE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5884,7 +5884,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
== (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
|
== (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
|
||||||
{
|
{
|
||||||
WARN("Tried to create a surface in both system and video memory.\n");
|
WARN("Tried to create a surface in both system and video memory.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDCAPS;
|
return DDERR_INVALIDCAPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5892,7 +5892,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
&& !(desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
|
&& !(desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
|
||||||
{
|
{
|
||||||
WARN("Caps %#x require DDSCAPS_TEXTURE.\n", desc->ddsCaps.dwCaps);
|
WARN("Caps %#x require DDSCAPS_TEXTURE.\n", desc->ddsCaps.dwCaps);
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDCAPS;
|
return DDERR_INVALIDCAPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5900,7 +5900,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
&& !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP))
|
&& !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP))
|
||||||
{
|
{
|
||||||
WARN("Cube map faces requested without cube map flag.\n");
|
WARN("Cube map faces requested without cube map flag.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDCAPS;
|
return DDERR_INVALIDCAPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5908,7 +5908,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
&& !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES))
|
&& !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES))
|
||||||
{
|
{
|
||||||
WARN("Cube map without faces requested.\n");
|
WARN("Cube map without faces requested.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5921,14 +5921,14 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
if (!(desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
|
if (!(desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
|
||||||
{
|
{
|
||||||
WARN("DDSCAPS2_TEXTUREMANAGE used without DDSCAPS_TEXTURE, returning DDERR_INVALIDCAPS.\n");
|
WARN("DDSCAPS2_TEXTUREMANAGE used without DDSCAPS_TEXTURE, returning DDERR_INVALIDCAPS.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDCAPS;
|
return DDERR_INVALIDCAPS;
|
||||||
}
|
}
|
||||||
if (desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
|
if (desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
|
||||||
{
|
{
|
||||||
WARN("DDSCAPS2_TEXTUREMANAGE used width DDSCAPS_VIDEOMEMORY "
|
WARN("DDSCAPS2_TEXTUREMANAGE used width DDSCAPS_VIDEOMEMORY "
|
||||||
"or DDSCAPS_SYSTEMMEMORY, returning DDERR_INVALIDCAPS.\n");
|
"or DDSCAPS_SYSTEMMEMORY, returning DDERR_INVALIDCAPS.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDCAPS;
|
return DDERR_INVALIDCAPS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5936,7 +5936,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
if (FAILED(hr = wined3d_get_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &mode, NULL)))
|
if (FAILED(hr = wined3d_get_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &mode, NULL)))
|
||||||
{
|
{
|
||||||
ERR("Failed to get display mode, hr %#x.\n", hr);
|
ERR("Failed to get display mode, hr %#x.\n", hr);
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return hr_ddraw_from_wined3d(hr);
|
return hr_ddraw_from_wined3d(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5953,7 +5953,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
if (wined3d_desc.format == WINED3DFMT_UNKNOWN)
|
if (wined3d_desc.format == WINED3DFMT_UNKNOWN)
|
||||||
{
|
{
|
||||||
WARN("Unsupported / unknown pixelformat.\n");
|
WARN("Unsupported / unknown pixelformat.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDPIXELFORMAT;
|
return DDERR_INVALIDPIXELFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5963,7 +5963,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
if (!(desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
|
if (!(desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
|
||||||
{
|
{
|
||||||
WARN("No width / height specified.\n");
|
WARN("No width / height specified.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5974,7 +5974,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
|
|
||||||
if (!desc->dwWidth || !desc->dwHeight)
|
if (!desc->dwWidth || !desc->dwHeight)
|
||||||
{
|
{
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5999,7 +5999,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
&swapchain_desc, NULL, ddraw_reset_enum_callback, TRUE)))
|
&swapchain_desc, NULL, ddraw_reset_enum_callback, TRUE)))
|
||||||
{
|
{
|
||||||
ERR("Failed to reset device.\n");
|
ERR("Failed to reset device.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return hr_ddraw_from_wined3d(hr);
|
return hr_ddraw_from_wined3d(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6033,7 +6033,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
/* Mipmap count is given, should not be 0. */
|
/* Mipmap count is given, should not be 0. */
|
||||||
if (!desc->u2.dwMipMapCount)
|
if (!desc->u2.dwMipMapCount)
|
||||||
{
|
{
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6094,7 +6094,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
== (DDSCAPS_OVERLAY | DDSCAPS_SYSTEMMEMORY))
|
== (DDSCAPS_OVERLAY | DDSCAPS_SYSTEMMEMORY))
|
||||||
{
|
{
|
||||||
WARN("System memory overlays are not allowed.\n");
|
WARN("System memory overlays are not allowed.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_NOOVERLAYHW;
|
return DDERR_NOOVERLAYHW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6132,21 +6132,21 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
if (wined3d_desc.access & WINED3D_RESOURCE_ACCESS_GPU)
|
if (wined3d_desc.access & WINED3D_RESOURCE_ACCESS_GPU)
|
||||||
{
|
{
|
||||||
WARN("User memory surfaces should not be GPU accessible.\n");
|
WARN("User memory surfaces should not be GPU accessible.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDCAPS;
|
return DDERR_INVALIDCAPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version < 4)
|
if (version < 4)
|
||||||
{
|
{
|
||||||
WARN("User memory surfaces not supported before version 4.\n");
|
WARN("User memory surfaces not supported before version 4.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!desc->lpSurface)
|
if (!desc->lpSurface)
|
||||||
{
|
{
|
||||||
WARN("NULL surface memory pointer specified.\n");
|
WARN("NULL surface memory pointer specified.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6155,14 +6155,14 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
if (version != 4 && (desc->dwFlags & DDSD_PITCH))
|
if (version != 4 && (desc->dwFlags & DDSD_PITCH))
|
||||||
{
|
{
|
||||||
WARN("Pitch specified on a compressed user memory surface.\n");
|
WARN("Pitch specified on a compressed user memory surface.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(desc->dwFlags & (DDSD_LINEARSIZE | DDSD_PITCH)))
|
if (!(desc->dwFlags & (DDSD_LINEARSIZE | DDSD_PITCH)))
|
||||||
{
|
{
|
||||||
WARN("Compressed user memory surfaces should explicitly specify the linear size.\n");
|
WARN("Compressed user memory surfaces should explicitly specify the linear size.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6171,7 +6171,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
wined3d_desc.format, wined3d_desc.width) * ((desc->dwHeight + 3) / 4))
|
wined3d_desc.format, wined3d_desc.width) * ((desc->dwHeight + 3) / 4))
|
||||||
{
|
{
|
||||||
WARN("Invalid linear size %u specified.\n", desc->u1.dwLinearSize);
|
WARN("Invalid linear size %u specified.\n", desc->u1.dwLinearSize);
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6180,7 +6180,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
if (!(desc->dwFlags & DDSD_PITCH))
|
if (!(desc->dwFlags & DDSD_PITCH))
|
||||||
{
|
{
|
||||||
WARN("User memory surfaces should explicitly specify the pitch.\n");
|
WARN("User memory surfaces should explicitly specify the pitch.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6188,7 +6188,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
wined3d_desc.format, wined3d_desc.width) || desc->u1.lPitch & 3)
|
wined3d_desc.format, wined3d_desc.width) || desc->u1.lPitch & 3)
|
||||||
{
|
{
|
||||||
WARN("Invalid pitch %u specified.\n", desc->u1.lPitch);
|
WARN("Invalid pitch %u specified.\n", desc->u1.lPitch);
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6206,7 +6206,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
&& desc->ddckCKSrcBlt.dwColorSpaceLowValue != desc->ddckCKSrcBlt.dwColorSpaceHighValue))
|
&& desc->ddckCKSrcBlt.dwColorSpaceLowValue != desc->ddckCKSrcBlt.dwColorSpaceHighValue))
|
||||||
{
|
{
|
||||||
WARN("Range color keys not supported, returning DDERR_NOCOLORKEYHW.\n");
|
WARN("Range color keys not supported, returning DDERR_NOCOLORKEYHW.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return DDERR_NOCOLORKEYHW;
|
return DDERR_NOCOLORKEYHW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6233,7 +6233,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
&ddraw_texture_wined3d_parent_ops, &wined3d_texture)))
|
&ddraw_texture_wined3d_parent_ops, &wined3d_texture)))
|
||||||
{
|
{
|
||||||
WARN("Failed to create wined3d texture, hr %#x.\n", hr);
|
WARN("Failed to create wined3d texture, hr %#x.\n", hr);
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
return hr_ddraw_from_wined3d(hr);
|
return hr_ddraw_from_wined3d(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6330,7 +6330,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
attach = &last->complex_array[0];
|
attach = &last->complex_array[0];
|
||||||
for (i = 0; i < count; ++i)
|
for (i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
if (!(texture = HeapAlloc(GetProcessHeap(), 0, sizeof(*texture))))
|
if (!(texture = heap_alloc(sizeof(*texture))))
|
||||||
{
|
{
|
||||||
hr = E_OUTOFMEMORY;
|
hr = E_OUTOFMEMORY;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -6352,7 +6352,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
WINED3D_TEXTURE_CREATE_GET_DC_LENIENT, NULL, texture,
|
WINED3D_TEXTURE_CREATE_GET_DC_LENIENT, NULL, texture,
|
||||||
&ddraw_texture_wined3d_parent_ops, &wined3d_texture)))
|
&ddraw_texture_wined3d_parent_ops, &wined3d_texture)))
|
||||||
{
|
{
|
||||||
HeapFree(GetProcessHeap(), 0, texture);
|
heap_free(texture);
|
||||||
hr = hr_ddraw_from_wined3d(hr);
|
hr = hr_ddraw_from_wined3d(hr);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ static ULONG WINAPI d3d_vertex_buffer7_Release(IDirect3DVertexBuffer7 *iface)
|
||||||
if (buffer->version == 7)
|
if (buffer->version == 7)
|
||||||
IDirectDraw7_Release(&buffer->ddraw->IDirectDraw7_iface);
|
IDirectDraw7_Release(&buffer->ddraw->IDirectDraw7_iface);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, buffer);
|
heap_free(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
|
@ -451,8 +451,7 @@ HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **vertex_buf,
|
||||||
TRACE(" FVF %#x\n", desc->dwFVF);
|
TRACE(" FVF %#x\n", desc->dwFVF);
|
||||||
TRACE(" dwNumVertices %u\n", desc->dwNumVertices);
|
TRACE(" dwNumVertices %u\n", desc->dwNumVertices);
|
||||||
|
|
||||||
buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*buffer));
|
if (!(buffer = heap_alloc_zero(sizeof(*buffer))))
|
||||||
if (!buffer)
|
|
||||||
return DDERR_OUTOFMEMORY;
|
return DDERR_OUTOFMEMORY;
|
||||||
|
|
||||||
buffer->IDirect3DVertexBuffer7_iface.lpVtbl = &d3d_vertex_buffer7_vtbl;
|
buffer->IDirect3DVertexBuffer7_iface.lpVtbl = &d3d_vertex_buffer7_vtbl;
|
||||||
|
@ -489,7 +488,7 @@ end:
|
||||||
if (hr == D3D_OK)
|
if (hr == D3D_OK)
|
||||||
*vertex_buf = buffer;
|
*vertex_buf = buffer;
|
||||||
else
|
else
|
||||||
HeapFree(GetProcessHeap(), 0, buffer);
|
heap_free(buffer);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,7 +221,7 @@ static ULONG WINAPI d3d_viewport_Release(IDirect3DViewport3 *iface)
|
||||||
TRACE("%p decreasing refcount to %u.\n", viewport, ref);
|
TRACE("%p decreasing refcount to %u.\n", viewport, ref);
|
||||||
|
|
||||||
if (!ref)
|
if (!ref)
|
||||||
HeapFree(GetProcessHeap(), 0, viewport);
|
heap_free(viewport);
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue