Commit 6d8ebf1d authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d2d1: Use the global memory allocation helpers.

parent 0bf0e0d3
......@@ -70,7 +70,7 @@ static ULONG STDMETHODCALLTYPE d2d_bitmap_Release(ID2D1Bitmap *iface)
{
ID3D10ShaderResourceView_Release(bitmap->view);
ID2D1Factory_Release(bitmap->factory);
HeapFree(GetProcessHeap(), 0, bitmap);
heap_free(bitmap);
}
return refcount;
......@@ -286,7 +286,7 @@ HRESULT d2d_bitmap_create(ID2D1Factory *factory, ID3D10Device *device, D2D1_SIZE
return hr;
}
if ((*bitmap = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(**bitmap))))
if ((*bitmap = heap_alloc_zero(sizeof(**bitmap))))
{
d2d_bitmap_init(*bitmap, factory, view, size, desc);
TRACE("Created bitmap %p.\n", *bitmap);
......@@ -340,7 +340,7 @@ HRESULT d2d_bitmap_create_shared(ID2D1RenderTarget *render_target, ID3D10Device
goto failed;
}
if (!(*bitmap = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(**bitmap))))
if (!(*bitmap = heap_alloc_zero(sizeof(**bitmap))))
{
hr = E_OUTOFMEMORY;
goto failed;
......@@ -386,7 +386,7 @@ HRESULT d2d_bitmap_create_shared(ID2D1RenderTarget *render_target, ID3D10Device
return hr;
}
if (!(*bitmap = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(**bitmap))))
if (!(*bitmap = heap_alloc_zero(sizeof(**bitmap))))
{
ID3D10ShaderResourceView_Release(view);
return E_OUTOFMEMORY;
......@@ -510,7 +510,7 @@ HRESULT d2d_bitmap_create_from_wic_bitmap(ID2D1Factory *factory, ID3D10Device *d
pitch = ((bpp * size.width) + 15) & ~15;
data_size = pitch * size.height;
if (!(data = HeapAlloc(GetProcessHeap(), 0, data_size)))
if (!(data = heap_alloc(data_size)))
return E_OUTOFMEMORY;
rect.X = 0;
......@@ -520,13 +520,13 @@ HRESULT d2d_bitmap_create_from_wic_bitmap(ID2D1Factory *factory, ID3D10Device *d
if (FAILED(hr = IWICBitmapSource_CopyPixels(bitmap_source, &rect, pitch, data_size, data)))
{
WARN("Failed to copy bitmap pixels, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, data);
heap_free(data);
return hr;
}
hr = d2d_bitmap_create(factory, device, size, data, pitch, &bitmap_desc, bitmap);
HeapFree(GetProcessHeap(), 0, data);
heap_free(data);
return hr;
}
......
......@@ -75,7 +75,7 @@ static ULONG STDMETHODCALLTYPE d2d_bitmap_render_target_Release(ID2D1BitmapRende
{
ID2D1RenderTarget_Release(render_target->dxgi_target);
ID2D1Bitmap_Release(render_target->bitmap);
HeapFree(GetProcessHeap(), 0, render_target);
heap_free(render_target);
}
return refcount;
......
......@@ -67,10 +67,10 @@ static ULONG STDMETHODCALLTYPE d2d_gradient_Release(ID2D1GradientStopCollection
if (!refcount)
{
HeapFree(GetProcessHeap(), 0, gradient->stops);
heap_free(gradient->stops);
ID3D10ShaderResourceView_Release(gradient->view);
ID2D1Factory_Release(gradient->factory);
HeapFree(GetProcessHeap(), 0, gradient);
heap_free(gradient);
}
return refcount;
......@@ -142,7 +142,7 @@ HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D10Device *device, const D
unsigned int i;
HRESULT hr;
if (!(data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 2 * stop_count * sizeof(*data))))
if (!(data = heap_alloc_zero(2 * stop_count * sizeof(*data))))
{
ERR("Failed to allocate data.\n");
return E_OUTOFMEMORY;
......@@ -168,7 +168,7 @@ HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D10Device *device, const D
buffer_data.SysMemSlicePitch = 0;
hr = ID3D10Device_CreateBuffer(device, &buffer_desc, &buffer_data, &buffer);
HeapFree(GetProcessHeap(), 0, data);
heap_free(data);
if (FAILED(hr))
{
ERR("Failed to create buffer, hr %#x.\n", hr);
......@@ -188,7 +188,7 @@ HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D10Device *device, const D
return hr;
}
if (!(*gradient = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(**gradient))))
if (!(*gradient = heap_alloc_zero(sizeof(**gradient))))
{
ID3D10ShaderResourceView_Release(view);
return E_OUTOFMEMORY;
......@@ -205,10 +205,10 @@ HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D10Device *device, const D
(*gradient)->view = view;
(*gradient)->stop_count = stop_count;
if (!((*gradient)->stops = HeapAlloc(GetProcessHeap(), 0, stop_count * sizeof(*stops))))
if (!((*gradient)->stops = heap_alloc(stop_count * sizeof(*stops))))
{
ID3D10ShaderResourceView_Release(view);
HeapFree(GetProcessHeap(), 0, *gradient);
heap_free(*gradient);
return E_OUTOFMEMORY;
}
memcpy((*gradient)->stops, stops, stop_count * sizeof(*stops));
......@@ -233,7 +233,7 @@ static void d2d_gradient_bind(struct d2d_gradient *gradient, ID3D10Device *devic
static void d2d_brush_destroy(struct d2d_brush *brush)
{
ID2D1Factory_Release(brush->factory);
HeapFree(GetProcessHeap(), 0, brush);
heap_free(brush);
}
static void d2d_brush_init(struct d2d_brush *brush, ID2D1Factory *factory,
......@@ -386,7 +386,7 @@ static const struct ID2D1SolidColorBrushVtbl d2d_solid_color_brush_vtbl =
HRESULT d2d_solid_color_brush_create(ID2D1Factory *factory, const D2D1_COLOR_F *color,
const D2D1_BRUSH_PROPERTIES *desc, struct d2d_brush **brush)
{
if (!(*brush = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(**brush))))
if (!(*brush = heap_alloc_zero(sizeof(**brush))))
return E_OUTOFMEMORY;
d2d_brush_init(*brush, factory, D2D_BRUSH_TYPE_SOLID, desc,
......@@ -566,10 +566,11 @@ static const struct ID2D1LinearGradientBrushVtbl d2d_linear_gradient_brush_vtbl
d2d_linear_gradient_brush_GetGradientStopCollection,
};
HRESULT d2d_linear_gradient_brush_create(ID2D1Factory *factory, const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *gradient_brush_desc,
const D2D1_BRUSH_PROPERTIES *brush_desc, ID2D1GradientStopCollection *gradient, struct d2d_brush **brush)
HRESULT d2d_linear_gradient_brush_create(ID2D1Factory *factory,
const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *gradient_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc,
ID2D1GradientStopCollection *gradient, struct d2d_brush **brush)
{
if (!(*brush = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(**brush))))
if (!(*brush = heap_alloc_zero(sizeof(**brush))))
return E_OUTOFMEMORY;
d2d_brush_init(*brush, factory, D2D_BRUSH_TYPE_LINEAR, brush_desc,
......@@ -798,7 +799,7 @@ HRESULT d2d_radial_gradient_brush_create(ID2D1Factory *factory,
{
struct d2d_brush *b;
if (!(b = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*b))))
if (!(b = heap_alloc_zero(sizeof(*b))))
return E_OUTOFMEMORY;
d2d_brush_init(b, factory, D2D_BRUSH_TYPE_RADIAL, brush_desc, (ID2D1BrushVtbl *)&d2d_radial_gradient_brush_vtbl);
......@@ -1034,7 +1035,7 @@ static const struct ID2D1BitmapBrushVtbl d2d_bitmap_brush_vtbl =
HRESULT d2d_bitmap_brush_create(ID2D1Factory *factory, ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmap_brush_desc,
const D2D1_BRUSH_PROPERTIES *brush_desc, struct d2d_brush **brush)
{
if (!(*brush = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(**brush))))
if (!(*brush = heap_alloc_zero(sizeof(**brush))))
return E_OUTOFMEMORY;
d2d_brush_init(*brush, factory, D2D_BRUSH_TYPE_BITMAP,
......
......@@ -20,6 +20,7 @@
#define __WINE_D2D1_PRIVATE_H
#include "wine/debug.h"
#include "wine/heap.h"
#include <assert.h>
#include <limits.h>
......
......@@ -94,7 +94,7 @@ static ULONG STDMETHODCALLTYPE d2d_dc_render_target_Release(ID2D1DCRenderTarget
{
ID2D1RenderTarget_Release(render_target->dxgi_target);
IDXGISurface1_Release(render_target->dxgi_surface);
HeapFree(GetProcessHeap(), 0, render_target);
heap_free(render_target);
}
return refcount;
......
......@@ -104,7 +104,7 @@ static ULONG STDMETHODCALLTYPE d2d_factory_Release(ID2D1Factory1 *iface)
{
if (factory->device)
ID3D10Device1_Release(factory->device);
HeapFree(GetProcessHeap(), 0, factory);
heap_free(factory);
}
return refcount;
......@@ -137,13 +137,13 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateRectangleGeometry(ID2D1Factor
TRACE("iface %p, rect %s, geometry %p.\n", iface, debug_d2d_rect_f(rect), geometry);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d2d_rectangle_geometry_init(object, (ID2D1Factory *)iface, rect)))
{
WARN("Failed to initialize rectangle geometry, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
heap_free(object);
return hr;
}
......@@ -187,7 +187,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateTransformedGeometry(ID2D1Fact
TRACE("iface %p, src_geometry %p, transform %p, transformed_geometry %p.\n",
iface, src_geometry, transform, transformed_geometry);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
d2d_transformed_geometry_init(object, (ID2D1Factory *)iface, src_geometry, transform);
......@@ -204,7 +204,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreatePathGeometry(ID2D1Factory1 *i
TRACE("iface %p, geometry %p.\n", iface, geometry);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
d2d_path_geometry_init(object, (ID2D1Factory *)iface);
......@@ -225,13 +225,13 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateStrokeStyle(ID2D1Factory1 *if
TRACE("iface %p, desc %p, dashes %p, dash_count %u, stroke_style %p.\n",
iface, desc, dashes, dash_count, stroke_style);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d2d_stroke_style_init(object, (ID2D1Factory *)iface, desc, dashes, dash_count)))
{
WARN("Failed to initialize stroke style, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
heap_free(object);
return hr;
}
......@@ -250,7 +250,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateDrawingStateBlock(ID2D1Factor
TRACE("iface %p, desc %p, text_rendering_params %p, state_block %p.\n",
iface, desc, text_rendering_params, state_block);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
d2d_state_block_init(object, (ID2D1Factory *)iface, desc, text_rendering_params);
......@@ -283,19 +283,19 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateWicBitmapRenderTarget(ID2D1Fa
TRACE("iface %p, target %p, desc %p, render_target %p.\n", iface, target, desc, render_target);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d2d_factory_get_device(factory, &device)))
{
HeapFree(GetProcessHeap(), 0, object);
heap_free(object);
return hr;
}
if (FAILED(hr = d2d_wic_render_target_init(object, (ID2D1Factory *)iface, device, target, desc)))
{
WARN("Failed to initialize render target, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
heap_free(object);
return hr;
}
......@@ -319,13 +319,13 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateHwndRenderTarget(ID2D1Factory
if (FAILED(hr = d2d_factory_get_device(factory, &device)))
return hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d2d_hwnd_render_target_init(object, (ID2D1Factory *)iface, device, desc, hwnd_rt_desc)))
{
WARN("Failed to initialize render target, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
heap_free(object);
return hr;
}
......@@ -356,13 +356,13 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateDCRenderTarget(ID2D1Factory1
if (FAILED(hr = d2d_factory_get_device(factory, &device)))
return hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d2d_dc_render_target_init(object, (ID2D1Factory *)iface, device, desc)))
{
WARN("Failed to initialize render target, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
heap_free(object);
return hr;
}
......@@ -512,7 +512,7 @@ HRESULT WINAPI D2D1CreateFactory(D2D1_FACTORY_TYPE factory_type, REFIID iid,
TRACE("factory_type %#x, iid %s, factory_options %p, factory %p.\n",
factory_type, debugstr_guid(iid), factory_options, factory);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
d2d_factory_init(object, factory_type, factory_options);
......
......@@ -581,12 +581,7 @@ static BOOL d2d_array_reserve(void **elements, size_t *capacity, size_t element_
if (new_capacity < element_count)
new_capacity = max_capacity;
if (*elements)
new_elements = HeapReAlloc(GetProcessHeap(), 0, *elements, new_capacity * element_size);
else
new_elements = HeapAlloc(GetProcessHeap(), 0, new_capacity * element_size);
if (!new_elements)
if (!(new_elements = heap_realloc(*elements, new_capacity * element_size)))
return FALSE;
*elements = new_elements;
......@@ -1438,7 +1433,7 @@ static BOOL d2d_cdt_generate_faces(const struct d2d_cdt *cdt, struct d2d_geometr
return TRUE;
fail:
HeapFree(GetProcessHeap(), 0, geometry->fill.faces);
heap_free(geometry->fill.faces);
geometry->fill.faces = NULL;
geometry->fill.faces_size = 0;
geometry->fill.face_count = 0;
......@@ -2035,7 +2030,7 @@ static BOOL d2d_geometry_intersect_self(struct d2d_geometry *geometry)
ret = d2d_geometry_apply_intersections(geometry, &intersections);
done:
HeapFree(GetProcessHeap(), 0, intersections.intersections);
heap_free(intersections.intersections);
return ret;
}
......@@ -2057,7 +2052,7 @@ static HRESULT d2d_path_geometry_triangulate(struct d2d_geometry *geometry)
return S_OK;
}
if (!(vertices = HeapAlloc(GetProcessHeap(), 0, vertex_count * sizeof(*vertices))))
if (!(vertices = heap_alloc(vertex_count * sizeof(*vertices))))
return E_OUTOFMEMORY;
for (i = 0, j = 0; i < geometry->u.path.figure_count; ++i)
......@@ -2091,14 +2086,14 @@ static HRESULT d2d_path_geometry_triangulate(struct d2d_geometry *geometry)
if (!d2d_cdt_generate_faces(&cdt, geometry))
goto fail;
HeapFree(GetProcessHeap(), 0, cdt.edges);
heap_free(cdt.edges);
return S_OK;
fail:
geometry->fill.vertices = NULL;
geometry->fill.vertex_count = 0;
HeapFree(GetProcessHeap(), 0, vertices);
HeapFree(GetProcessHeap(), 0, cdt.edges);
heap_free(vertices);
heap_free(cdt.edges);
return E_FAIL;
}
......@@ -2368,13 +2363,13 @@ static BOOL d2d_geometry_add_figure_outline(struct d2d_geometry *geometry,
static void d2d_geometry_cleanup(struct d2d_geometry *geometry)
{
HeapFree(GetProcessHeap(), 0, geometry->outline.bezier_faces);
HeapFree(GetProcessHeap(), 0, geometry->outline.beziers);
HeapFree(GetProcessHeap(), 0, geometry->outline.faces);
HeapFree(GetProcessHeap(), 0, geometry->outline.vertices);
HeapFree(GetProcessHeap(), 0, geometry->fill.bezier_vertices);
HeapFree(GetProcessHeap(), 0, geometry->fill.faces);
HeapFree(GetProcessHeap(), 0, geometry->fill.vertices);
heap_free(geometry->outline.bezier_faces);
heap_free(geometry->outline.beziers);
heap_free(geometry->outline.faces);
heap_free(geometry->outline.vertices);
heap_free(geometry->fill.bezier_vertices);
heap_free(geometry->fill.faces);
heap_free(geometry->fill.vertices);
ID2D1Factory_Release(geometry->factory);
}
......@@ -2604,11 +2599,11 @@ static void d2d_path_geometry_free_figures(struct d2d_geometry *geometry)
for (i = 0; i < geometry->u.path.figure_count; ++i)
{
HeapFree(GetProcessHeap(), 0, geometry->u.path.figures[i].bezier_controls);
HeapFree(GetProcessHeap(), 0, geometry->u.path.figures[i].original_bezier_controls);
HeapFree(GetProcessHeap(), 0, geometry->u.path.figures[i].vertices);
heap_free(geometry->u.path.figures[i].bezier_controls);
heap_free(geometry->u.path.figures[i].original_bezier_controls);
heap_free(geometry->u.path.figures[i].vertices);
}
HeapFree(GetProcessHeap(), 0, geometry->u.path.figures);
heap_free(geometry->u.path.figures);
geometry->u.path.figures = NULL;
geometry->u.path.figures_size = 0;
}
......@@ -2824,8 +2819,8 @@ static HRESULT d2d_geometry_resolve_beziers(struct d2d_geometry *geometry)
geometry->fill.bezier_vertex_count += 3 * geometry->u.path.figures[i].bezier_control_count;
}
if (!(geometry->fill.bezier_vertices = HeapAlloc(GetProcessHeap(), 0,
geometry->fill.bezier_vertex_count * sizeof(*geometry->fill.bezier_vertices))))
if (!(geometry->fill.bezier_vertices = heap_alloc(geometry->fill.bezier_vertex_count
* sizeof(*geometry->fill.bezier_vertices))))
{
ERR("Failed to allocate bezier vertices array.\n");
geometry->fill.bezier_vertex_count = 0;
......@@ -2889,7 +2884,7 @@ static HRESULT STDMETHODCALLTYPE d2d_geometry_sink_Close(ID2D1GeometrySink *ifac
{
struct d2d_figure *figure = &geometry->u.path.figures[i];
size_t size = figure->bezier_control_count * sizeof(*figure->original_bezier_controls);
if (!(figure->original_bezier_controls = HeapAlloc(GetProcessHeap(), 0, size)))
if (!(figure->original_bezier_controls = heap_alloc(size)))
goto done;
memcpy(figure->original_bezier_controls, figure->bezier_controls, size);
}
......@@ -2904,7 +2899,7 @@ static HRESULT STDMETHODCALLTYPE d2d_geometry_sink_Close(ID2D1GeometrySink *ifac
done:
if (FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, geometry->fill.bezier_vertices);
heap_free(geometry->fill.bezier_vertices);
geometry->fill.bezier_vertex_count = 0;
d2d_path_geometry_free_figures(geometry);
geometry->u.path.state = D2D_GEOMETRY_STATE_ERROR;
......@@ -3063,7 +3058,7 @@ static ULONG STDMETHODCALLTYPE d2d_path_geometry_Release(ID2D1PathGeometry *ifac
{
d2d_path_geometry_free_figures(geometry);
d2d_geometry_cleanup(geometry);
HeapFree(GetProcessHeap(), 0, geometry);
heap_free(geometry);
}
return refcount;
......@@ -3579,7 +3574,7 @@ static ULONG STDMETHODCALLTYPE d2d_rectangle_geometry_Release(ID2D1RectangleGeom
if (!refcount)
{
d2d_geometry_cleanup(geometry);
HeapFree(GetProcessHeap(), 0, geometry);
heap_free(geometry);
}
return refcount;
......@@ -3821,7 +3816,7 @@ HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry, ID2D1Factory
d2d_geometry_init(geometry, factory, &identity, (ID2D1GeometryVtbl *)&d2d_rectangle_geometry_vtbl);
geometry->u.rectangle.rect = *rect;
if (!(geometry->fill.vertices = HeapAlloc(GetProcessHeap(), 0, 4 * sizeof(*geometry->fill.vertices))))
if (!(geometry->fill.vertices = heap_alloc(4 * sizeof(*geometry->fill.vertices))))
goto fail;
if (!d2d_array_reserve((void **)&geometry->fill.faces,
&geometry->fill.faces_size, 2, sizeof(*geometry->fill.faces)))
......@@ -3923,7 +3918,7 @@ static ULONG STDMETHODCALLTYPE d2d_transformed_geometry_Release(ID2D1Transformed
geometry->fill.vertices = NULL;
ID2D1Geometry_Release(geometry->u.transformed.src_geometry);
d2d_geometry_cleanup(geometry);
HeapFree(GetProcessHeap(), 0, geometry);
heap_free(geometry);
}
return refcount;
......
......@@ -83,7 +83,7 @@ static ULONG STDMETHODCALLTYPE d2d_hwnd_render_target_Release(ID2D1HwndRenderTar
{
ID2D1RenderTarget_Release(render_target->dxgi_target);
IDXGISwapChain_Release(render_target->swapchain);
HeapFree(GetProcessHeap(), 0, render_target);
heap_free(render_target);
}
return refcount;
......
......@@ -67,7 +67,7 @@ static ULONG STDMETHODCALLTYPE d2d_layer_Release(ID2D1Layer *iface)
if (!refcount)
{
ID2D1Factory_Release(layer->factory);
HeapFree(GetProcessHeap(), 0, layer);
heap_free(layer);
}
return refcount;
......@@ -103,7 +103,7 @@ static const struct ID2D1LayerVtbl d2d_layer_vtbl =
HRESULT d2d_layer_create(ID2D1Factory *factory, const D2D1_SIZE_F *size, struct d2d_layer **layer)
{
if (!(*layer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(**layer))))
if (!(*layer = heap_alloc_zero(sizeof(**layer))))
return E_OUTOFMEMORY;
(*layer)->ID2D1Layer_iface.lpVtbl = &d2d_layer_vtbl;
......
......@@ -67,7 +67,7 @@ static ULONG STDMETHODCALLTYPE d2d_mesh_Release(ID2D1Mesh *iface)
if (!refcount)
{
ID2D1Factory_Release(mesh->factory);
HeapFree(GetProcessHeap(), 0, mesh);
heap_free(mesh);
}
return refcount;
......@@ -100,7 +100,7 @@ static const struct ID2D1MeshVtbl d2d_mesh_vtbl =
HRESULT d2d_mesh_create(ID2D1Factory *factory, struct d2d_mesh **mesh)
{
if (!(*mesh = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(**mesh))))
if (!(*mesh = heap_alloc_zero(sizeof(**mesh))))
return E_OUTOFMEMORY;
(*mesh)->ID2D1Mesh_iface.lpVtbl = &d2d_mesh_vtbl;
......
......@@ -77,7 +77,7 @@ static void d2d_size_set(D2D1_SIZE_U *dst, float width, float height)
static BOOL d2d_clip_stack_init(struct d2d_clip_stack *stack)
{
if (!(stack->stack = HeapAlloc(GetProcessHeap(), 0, INITIAL_CLIP_STACK_SIZE * sizeof(*stack->stack))))
if (!(stack->stack = heap_alloc(INITIAL_CLIP_STACK_SIZE * sizeof(*stack->stack))))
return FALSE;
stack->size = INITIAL_CLIP_STACK_SIZE;
......@@ -88,7 +88,7 @@ static BOOL d2d_clip_stack_init(struct d2d_clip_stack *stack)
static void d2d_clip_stack_cleanup(struct d2d_clip_stack *stack)
{
HeapFree(GetProcessHeap(), 0, stack->stack);
heap_free(stack->stack);
}
static BOOL d2d_clip_stack_push(struct d2d_clip_stack *stack, const D2D1_RECT_F *rect)
......@@ -104,7 +104,7 @@ static BOOL d2d_clip_stack_push(struct d2d_clip_stack *stack, const D2D1_RECT_F
return FALSE;
new_size = stack->size * 2;
if (!(new_stack = HeapReAlloc(GetProcessHeap(), 0, stack->stack, new_size * sizeof(*stack->stack))))
if (!(new_stack = heap_realloc(stack->stack, new_size * sizeof(*stack->stack))))
return FALSE;
stack->stack = new_stack;
......@@ -272,7 +272,7 @@ static ULONG STDMETHODCALLTYPE d2d_d3d_render_target_Release(ID2D1RenderTarget *
ID3D10RenderTargetView_Release(render_target->view);
ID3D10Device_Release(render_target->device);
ID2D1Factory_Release(render_target->factory);
HeapFree(GetProcessHeap(), 0, render_target);
heap_free(render_target);
}
return refcount;
......@@ -434,14 +434,14 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateCompatibleRenderTar
TRACE("iface %p, size %p, pixel_size %p, format %p, options %#x, render_target %p.\n",
iface, size, pixel_size, format, options, rt);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d2d_bitmap_render_target_init(object, render_target, size, pixel_size,
format, options)))
{
WARN("Failed to initialize render target, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
heap_free(object);
return hr;
}
......@@ -1176,7 +1176,7 @@ static void d2d_rt_draw_glyph_run_bitmap(struct d2d_d3d_render_target *render_ta
if (texture_type == DWRITE_TEXTURE_CLEARTYPE_3x1)
bitmap_size.width *= 3;
opacity_values_size = bitmap_size.width * bitmap_size.height;
if (!(opacity_values = HeapAlloc(GetProcessHeap(), 0, opacity_values_size)))
if (!(opacity_values = heap_alloc(opacity_values_size)))
{
ERR("Failed to allocate opacity values.\n");
goto done;
......@@ -1237,7 +1237,7 @@ done:
ID2D1BitmapBrush_Release(opacity_brush);
if (opacity_bitmap)
ID2D1Bitmap_Release(opacity_bitmap);
HeapFree(GetProcessHeap(), 0, opacity_values);
heap_free(opacity_values);
IDWriteGlyphRunAnalysis_Release(analysis);
}
......@@ -3243,13 +3243,13 @@ HRESULT d2d_d3d_create_render_target(ID2D1Factory *factory, IDXGISurface *surfac
struct d2d_d3d_render_target *object;
HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d2d_d3d_render_target_init(object, factory, surface, outer_unknown, desc)))
{
WARN("Failed to initialize render target, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
heap_free(object);
return hr;
}
......
......@@ -69,7 +69,7 @@ static ULONG STDMETHODCALLTYPE d2d_state_block_Release(ID2D1DrawingStateBlock *i
if (state_block->text_rendering_params)
IDWriteRenderingParams_Release(state_block->text_rendering_params);
ID2D1Factory_Release(state_block->factory);
HeapFree(GetProcessHeap(), 0, state_block);
heap_free(state_block);
}
return refcount;
......
......@@ -68,8 +68,8 @@ static ULONG STDMETHODCALLTYPE d2d_stroke_style_Release(ID2D1StrokeStyle *iface)
{
ID2D1Factory_Release(style->factory);
if (style->desc.dashStyle == D2D1_DASH_STYLE_CUSTOM)
HeapFree(GetProcessHeap(), 0, style->dashes);
HeapFree(GetProcessHeap(), 0, style);
heap_free(style->dashes);
heap_free(style);
}
return refcount;
......@@ -212,7 +212,7 @@ HRESULT d2d_stroke_style_init(struct d2d_stroke_style *style, ID2D1Factory *fact
if (!dashes || !dash_count)
return E_INVALIDARG;
if (!(style->dashes = HeapAlloc(GetProcessHeap(), 0, dash_count * sizeof(*style->dashes))))
if (!(style->dashes = heap_alloc(dash_count * sizeof(*style->dashes))))
return E_OUTOFMEMORY;
memcpy(style->dashes, dashes, dash_count * sizeof(*style->dashes));
style->dash_count = dash_count;
......
......@@ -144,7 +144,7 @@ static ULONG STDMETHODCALLTYPE d2d_wic_render_target_Release(ID2D1RenderTarget *
ID3D10Texture2D_Release(render_target->readback_texture);
ID2D1RenderTarget_Release(render_target->dxgi_target);
IDXGISurface_Release(render_target->dxgi_surface);
HeapFree(GetProcessHeap(), 0, render_target);
heap_free(render_target);
}
return refcount;
......
......@@ -22,7 +22,7 @@
#ifndef __WINE_WINE_HEAP_H
#define __WINE_WINE_HEAP_H
#include <windef.h>
#include <winbase.h>
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(SIZE_T len)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment