[PATCH 5/5] d3drm: Assign animation key ids
Henri Verbeet
hverbeet at gmail.com
Mon Jul 10 06:31:35 CDT 2017
On 10 July 2017 at 12:40, Nikolay Sivov <nsivov at codeweavers.com> wrote:
> +static BOOL d3drm_animation_get_next_key_id(struct d3drm_animation_keys *keys, DWORD *id)
> +{
> + DWORD i;
> +
> + if (keys->next_unused <= keys->last_id)
> + {
> + *id = keys->next_unused++;
> + return TRUE;
> + }
> +
> + if (keys->next_free <= keys->last_id)
> + {
> + *id = keys->next_free;
> + keys->next_free = ~0u;
> + return TRUE;
> + }
> +
> + if (keys->count == keys->last_id - keys->first_id + 1)
> + return FALSE;
> +
> + /* Worst case, look for the spot from the beginning. */
> + for (i = 0, *id = keys->first_id; i < keys->count; i++, ++*id)
> + {
> + if (*id != keys->keys[i].id)
> + break;
> + }
Does that work? The keys aren't necessarily ordered by ID, right?
Regardless, it may be easier to make use of the fact that we never
shrink the keys array.
More information about the wine-devel
mailing list