[PATCH 2/2] d2d1: Implement {Get,Set}UnitMode().

Henri Verbeet hverbeet at gmail.com
Wed Apr 13 11:13:05 CDT 2022


On Wed, 13 Apr 2022 at 04:59, Ziqing Hui <zhui at codeweavers.com> wrote:
>  static void STDMETHODCALLTYPE d2d_device_context_SetUnitMode(ID2D1DeviceContext *iface, D2D1_UNIT_MODE unit_mode)
>  {
> -    FIXME("iface %p, unit_mode %#x stub!\n", iface, unit_mode);
> +    struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface);
> +
> +    TRACE("iface %p, unit_mode %#x.\n", iface, unit_mode);
> +
> +    if (unit_mode == D2D1_UNIT_MODE_DIPS || unit_mode == D2D1_UNIT_MODE_PIXELS)
> +    {
> +        context->drawing_state.unitMode = unit_mode;
> +    }
>  }

I think we'd want to print at least a WARN if the application attempts
to set an unrecognised unit mode, instead of silently ignoring it.

>  static D2D1_UNIT_MODE STDMETHODCALLTYPE d2d_device_context_GetUnitMode(ID2D1DeviceContext *iface)
>  {
> -    FIXME("iface %p stub!\n", iface);
> +    struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface);
>
> -    return D2D1_UNIT_MODE_DIPS;
> +    TRACE("iface %p.\n", iface);
> +
> +    return context->drawing_state.unitMode;
>  }

I think there's no real reason d2d_device_context_GetUnitMode() and
d2d_device_context_SetUnitMode() need to be in the patch, so it's
probably best to just send those separately.



More information about the wine-devel mailing list