Commit 8bcdac04 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Move outline dumping helpers.

parent afaf35b9
......@@ -97,7 +97,11 @@ static inline BOOL dwrite_array_reserve(void **elements, size_t *capacity, size_
if (new_capacity < count)
new_capacity = max_capacity;
if (!(new_elements = heap_realloc(*elements, new_capacity * size)))
if (!*elements)
new_elements = RtlAllocateHeap(GetProcessHeap(), 0, new_capacity * size);
else
new_elements = RtlReAllocateHeap(GetProcessHeap(), 0, *elements, new_capacity * size);
if (!new_elements)
return FALSE;
*elements = new_elements;
......@@ -481,10 +485,6 @@ struct dwrite_outline
} points;
};
extern int dwrite_outline_push_tag(struct dwrite_outline *outline, unsigned char tag) DECLSPEC_HIDDEN;
extern int dwrite_outline_push_points(struct dwrite_outline *outline, const D2D1_POINT_2F *points,
unsigned int count) DECLSPEC_HIDDEN;
/* Glyph shaping */
enum SCRIPT_JUSTIFY
{
......
......@@ -832,33 +832,6 @@ static void WINAPI dwritefontface_ReleaseFontTable(IDWriteFontFace5 *iface, void
IDWriteFontFileStream_ReleaseFileFragment(fontface->stream, table_context);
}
int dwrite_outline_push_tag(struct dwrite_outline *outline, unsigned char tag)
{
if (!dwrite_array_reserve((void **)&outline->tags.values, &outline->tags.size, outline->tags.count + 1,
sizeof(*outline->tags.values)))
{
return 1;
}
outline->tags.values[outline->tags.count++] = tag;
return 0;
}
int dwrite_outline_push_points(struct dwrite_outline *outline, const D2D1_POINT_2F *points, unsigned int count)
{
if (!dwrite_array_reserve((void **)&outline->points.values, &outline->points.size, outline->points.count + count,
sizeof(*outline->points.values)))
{
return 1;
}
memcpy(&outline->points.values[outline->points.count], points, sizeof(*points) * count);
outline->points.count += count;
return 0;
}
static void apply_outline_point_offset(const D2D1_POINT_2F *src, const D2D1_POINT_2F *offset,
D2D1_POINT_2F *dst)
{
......
......@@ -267,6 +267,33 @@ static inline void ft_vector_to_d2d_point(const FT_Vector *v, D2D1_POINT_2F *p)
p->y = v->y / 64.0f;
}
static int dwrite_outline_push_tag(struct dwrite_outline *outline, unsigned char tag)
{
if (!dwrite_array_reserve((void **)&outline->tags.values, &outline->tags.size, outline->tags.count + 1,
sizeof(*outline->tags.values)))
{
return 1;
}
outline->tags.values[outline->tags.count++] = tag;
return 0;
}
static int dwrite_outline_push_points(struct dwrite_outline *outline, const D2D1_POINT_2F *points, unsigned int count)
{
if (!dwrite_array_reserve((void **)&outline->points.values, &outline->points.size, outline->points.count + count,
sizeof(*outline->points.values)))
{
return 1;
}
memcpy(&outline->points.values[outline->points.count], points, sizeof(*points) * count);
outline->points.count += count;
return 0;
}
static int decompose_beginfigure(struct decompose_context *ctxt)
{
D2D1_POINT_2F point;
......
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