Vincent Povirk wrote:
From 1de9b2291bf9a5617ca1e3b0cba5f1260889c259 Mon Sep 17 00:00:00 2001
From: Vincent Povirk vincent@codeweavers.com Date: Mon, 23 Mar 2009 16:34:12 -0500 Subject: [PATCH] gdiplus: implement GdipTransformPoints
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.