dwrite: Move outline dumping helpers.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-03-30 14:06:15 +03:00 committed by Alexandre Julliard
parent afaf35b9e1
commit 8bcdac04a8
3 changed files with 32 additions and 32 deletions

View File

@ -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
{

View File

@ -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)
{

View File

@ -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;