[PATCH] gdiplus: implement GdipTransformPoints

Vincent Povirk vincent at codeweavers.com
Mon Mar 23 16:34:12 CDT 2009


It's a strange way to check enumeration with integer comparison, isn't it?
And not clear in this particular case.

> +    if (stat == Ok)
> +    {
> +        unitscale = convert_unit(graphics->hdc, graphics->unit);
> +
> +        if(graphics->unit != UnitDisplay)
> +            unitscale *= graphics->scale;
> +
> +        if (src_space <= CoordinateSpaceWorld && dst_space >= CoordinateSpacePage)
> +            GdipMultiplyMatrix(matrix, graphics->worldtrans, MatrixOrderAppend);
> +        if (src_space <= CoordinateSpacePage && dst_space >= CoordinateSpaceDevice)
> +            GdipScaleMatrix(matrix, unitscale, unitscale, MatrixOrderAppend);
> +
> +        if (dst_space <= CoordinateSpacePage && src_space >= CoordinateSpaceDevice)
> +            GdipScaleMatrix(matrix, 1.0/unitscale, 1.0/unitscale, MatrixOrderAppend);
> +        if (dst_space <= CoordinateSpaceWorld && src_space >= CoordinateSpacePage)
> +        {
> +            GpMatrix *inverted_transform;
> +            stat = GdipCloneMatrix(graphics->worldtrans, &inverted_transform);
> +            if (stat == Ok)
> +            {
> +                GdipInvertMatrix(inverted_transform);
> +                GdipMultiplyMatrix(matrix, inverted_transform, MatrixOrderAppend);
> +                GdipDeleteMatrix(inverted_transform);
> +            }
> +      
Maybe it's better to use 'switch' for source coords with falling and ifs 
inside cases for destination.

<= CoordinateSpaceWorld is just CoordinateSpaceWorld
 >= CoordinateSpaceDevice - is CoordinateSpaceDevice.




More information about the wine-devel mailing list