Dmitry Timoshkov : gdiplus: GdipMeasureString operates internally in pixels but in/ out rectangles are in device units.

Dmitry Timoshkov dmitry at baikal.ru
Wed Jul 18 23:44:44 CDT 2012


Vincent Povirk <madewokherd at 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.

-- 
Dmitry.



More information about the wine-devel mailing list