From 8bcdac04a83c9e28e63bfd2dd03c5b9a1a84a46d Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 30 Mar 2021 14:06:15 +0300 Subject: [PATCH] dwrite: Move outline dumping helpers. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/dwrite/dwrite_private.h | 10 +++++----- dlls/dwrite/font.c | 27 --------------------------- dlls/dwrite/freetype.c | 27 +++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index 8536e3c6a36..2408251717b 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -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 { diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 57c64e4622d..2fd6ad90f1f 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -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) { diff --git a/dlls/dwrite/freetype.c b/dlls/dwrite/freetype.c index efa0f24d96c..128388c9c86 100644 --- a/dlls/dwrite/freetype.c +++ b/dlls/dwrite/freetype.c @@ -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;