Vincent Povirk madewokherd@gmail.com wrote:
I still don't understand this patch.
Your subject implies that device units and pixels are not the same thing, but my understanding is that except for metafile HDCs (which we don't handle correctly anyway, and I suspect native doesn't either), they are.
Device units in gdiplus are the units specified in the call to GdipSetPageUnit. Since gdiplus doesn't change DC mapping mode to anything other than MM_TEXT, then the units accepted and returned by gdi32 are pixels. According to the tests GdipMeasureString receives and returns bounding and clipping rectangles in device units, so it needs to convert them before and after interacting with gdi32.
You're scaling sizes based on graphics->unit. Yet the conversion in get_graphics_transform (which we were already using in GdipMeasureString to convert between world and device units, indirectly through GdipTransformPoints) already takes graphics->unit into account.
Transforms performed by get_graphics_transform() and GdipTransformPoints have nothing to do with my patch.