From bc644f3d19d48f87cde0216a56560e46ddea1e5a Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Tue, 10 Feb 2009 15:10:07 -0800 Subject: [PATCH] b=477727; remove calls to GetViewportOrgEx; r=stuart --- gfx/thebes/src/gfxWindowsNativeDrawing.cpp | 4 +++ widget/src/windows/nsNativeThemeWin.cpp | 30 +++++++++++++++------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/gfx/thebes/src/gfxWindowsNativeDrawing.cpp b/gfx/thebes/src/gfxWindowsNativeDrawing.cpp index ce6587d9b399..2b076c8fb64f 100644 --- a/gfx/thebes/src/gfxWindowsNativeDrawing.cpp +++ b/gfx/thebes/src/gfxWindowsNativeDrawing.cpp @@ -164,7 +164,11 @@ gfxWindowsNativeDrawing::BeginNativeDrawing() SetWorldTransform(mDC, &mWorldTransform); } +#ifdef WINCE + SetViewportOrgEx(mDC, 0, 0, &mOrigViewportOrigin); +#else GetViewportOrgEx(mDC, &mOrigViewportOrigin); +#endif SetViewportOrgEx(mDC, mOrigViewportOrigin.x + (int)mDeviceOffset.x, mOrigViewportOrigin.y + (int)mDeviceOffset.y, diff --git a/widget/src/windows/nsNativeThemeWin.cpp b/widget/src/windows/nsNativeThemeWin.cpp index 8b0b4a142b4b..3b2aaca5df01 100644 --- a/widget/src/windows/nsNativeThemeWin.cpp +++ b/widget/src/windows/nsNativeThemeWin.cpp @@ -73,6 +73,14 @@ NS_IMPL_ISUPPORTS1(nsNativeThemeWin, nsITheme) #ifdef WINCE + +/* These functions might or might not be present; FrameRect probably isn't, + * but GetViewportOrgEx might be -- so #define them to avoid name collisions. + */ + +#define FrameRect moz_FrameRect +#define GetViewportOrgEx moz_GetViewportOrgEx + static int FrameRect(HDC inDC, CONST RECT *inRect, HBRUSH inBrush) { HBRUSH oldBrush = (HBRUSH)SelectObject(inDC, inBrush); @@ -81,26 +89,30 @@ static int FrameRect(HDC inDC, CONST RECT *inRect, HBRUSH inBrush) // The width and height of the border are always one // logical unit. - // 1 ----> 2 - // - // | - // v - // - // 4 ----> 3 - + + // move to top-left, and go clockwise. MoveToEx(inDC, myRect.left, myRect.top, (LPPOINT) NULL); - // 1 -> 2 LineTo(inDC, myRect.right, myRect.top); // 2 -> 3 LineTo(inDC, myRect.right, myRect.bottom); // 3 -> 4 LineTo(inDC, myRect.left, myRect.bottom); - + // 4 -> 1 + LineTo(inDC, myRect.left, myRect.top); + SelectObject(inDC, oldBrush); return 1; } +static BOOL +GetViewportOrgEx(HDC hdc, LPPOINT lpPoint) +{ + SetViewportOrgEx(hdc, 0, 0, lpPoint); + if (lpPoint->x != 0 || lpPoint->y != 0) + SetViewportOrgEx(hdc, lpPoint->x, lpPoint->y, NULL); + return TRUE; +} #endif static inline bool IsHTMLContent(nsIFrame *frame)