Commit b57db6f8 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Collect and sort positional lookups.

parent 3d1d9a1d
...@@ -76,6 +76,33 @@ static inline const char *debugstr_matrix(const DWRITE_MATRIX *m) ...@@ -76,6 +76,33 @@ static inline const char *debugstr_matrix(const DWRITE_MATRIX *m)
m->dx, m->dy); m->dx, m->dy);
} }
static inline BOOL dwrite_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
{
size_t new_capacity, max_capacity;
void *new_elements;
if (count <= *capacity)
return TRUE;
max_capacity = ~(SIZE_T)0 / size;
if (count > max_capacity)
return FALSE;
new_capacity = max(4, *capacity);
while (new_capacity < count && new_capacity <= max_capacity / 2)
new_capacity *= 2;
if (new_capacity < count)
new_capacity = max_capacity;
if (!(new_elements = heap_realloc(*elements, new_capacity * size)))
return FALSE;
*elements = new_elements;
*capacity = new_capacity;
return TRUE;
}
static inline const char *debugstr_tag(DWORD tag) static inline const char *debugstr_tag(DWORD tag)
{ {
return debugstr_an((char *)&tag, 4); return debugstr_an((char *)&tag, 4);
......
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