[PATCH 2/3] d2d1: Handle invalid interpolation mode in DrawBitmap().

Henri Verbeet hverbeet at gmail.com
Thu Oct 4 08:59:03 CDT 2018


On Thu, 4 Oct 2018 at 15:08, Nikolay Sivov <nsivov at codeweavers.com> wrote:
> @@ -1015,6 +1016,13 @@ static void STDMETHODCALLTYPE d2d_device_context_DrawBitmap(ID2D1DeviceContext *
>      TRACE("iface %p, bitmap %p, dst_rect %s, opacity %.8e, interpolation_mode %#x, src_rect %s.\n",
>              iface, bitmap, debug_d2d_rect_f(dst_rect), opacity, interpolation_mode, debug_d2d_rect_f(src_rect));
>
> +    if (interpolation_mode != D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR
> +            && interpolation_mode != D2D1_BITMAP_INTERPOLATION_MODE_LINEAR)
> +    {
> +        context->error.code = E_INVALIDARG;
> +        return;
> +    }
I think a helper for setting an error on the context would be helpful.
If I understood the way it's supposed to work correctly, we shouldn't
overwrite any existing errors, and copy the current tags when we do
set an error code. I think d2d_device_context_FillGeometry() is the
only place that actually does that, so this patch isn't making things
all that much worse, but it seems like a good thing to improve.



More information about the wine-devel mailing list