Module: wine Branch: refs/heads/master Commit: 2fed6479d88369a22b3bbd5853e27bb3bfce22ae URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=2fed6479d88369a22b3bbd58...
Author: Michael Kaufmann hallo@michael-kaufmann.ch Date: Wed Jan 25 13:14:27 2006 +0100
gdi: Fix the EMF bounding box calculation.
---
dlls/gdi/enhmfdrv/init.c | 36 +++++++++++++++++++++++++++--------- 1 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/dlls/gdi/enhmfdrv/init.c b/dlls/gdi/enhmfdrv/init.c index 8fe665c..e4425da 100644 --- a/dlls/gdi/enhmfdrv/init.c +++ b/dlls/gdi/enhmfdrv/init.c @@ -225,16 +225,34 @@ void EMFDRV_UpdateBBox( PHYSDEV dev, REC RECTL vportRect = *rect;
LPtoDP(physDev->hdc, (LPPOINT)&vportRect, 2); + + /* The coordinate systems may be mirrored + (LPtoDP handles points, not rectangles) */ + if (vportRect.left > vportRect.right) + { + LONG temp = vportRect.right; + vportRect.right = vportRect.left; + vportRect.left = temp; + } + if (vportRect.top > vportRect.bottom) + { + LONG temp = vportRect.bottom; + vportRect.bottom = vportRect.top; + vportRect.top = temp; + }
- if(bounds->left > bounds->right) {/* first rect */ - *bounds = vportRect; - return; - } - bounds->left = min(bounds->left, vportRect.left); - bounds->top = min(bounds->top, vportRect.top); - bounds->right = max(bounds->right, vportRect.right); - bounds->bottom = max(bounds->bottom, vportRect.bottom); - return; + if (bounds->left > bounds->right) + { + /* first bounding rectangle */ + *bounds = vportRect; + } + else + { + bounds->left = min(bounds->left, vportRect.left); + bounds->top = min(bounds->top, vportRect.top); + bounds->right = max(bounds->right, vportRect.right); + bounds->bottom = max(bounds->bottom, vportRect.bottom); + } }
/**********************************************************************