The device origin can be set on WinCE, so use it and redefine conversion

macros accordingly.
Also, convert result of calling GetClipBox from logical to
device coordinates since we're dealing with device coordinates at
this point.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33575 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2005-04-13 15:36:06 +00:00
parent f23255165e
commit 1d63de4a45

View File

@ -103,10 +103,10 @@ static const int MM_METRIC = 10;
*/ */
#ifdef __WXWINCE__ #ifdef __WXWINCE__
#define XLOG2DEV(x) ((x-m_logicalOriginX)*m_signX+m_deviceOriginX) #define XLOG2DEV(x) ((x-m_logicalOriginX)*m_signX)
#define YLOG2DEV(y) ((y-m_logicalOriginY)*m_signY+m_deviceOriginY) #define YLOG2DEV(y) ((y-m_logicalOriginY)*m_signY)
#define XDEV2LOG(x) ((x-m_deviceOriginX)*m_signX+m_logicalOriginX) #define XDEV2LOG(x) ((x)*m_signX+m_logicalOriginX)
#define YDEV2LOG(y) ((y-m_deviceOriginY)*m_signY+m_logicalOriginY) #define YDEV2LOG(y) ((y)*m_signY+m_logicalOriginY)
#else #else
#define XLOG2DEV(x) (x) #define XLOG2DEV(x) (x)
#define YLOG2DEV(y) (y) #define YLOG2DEV(y) (y)
@ -407,6 +407,12 @@ void wxDC::SetClippingHrgn(WXHRGN hrgn)
if ( !::GetClipBox(GetHdc(), &rectClip) ) if ( !::GetClipBox(GetHdc(), &rectClip) )
return; return;
// GetClipBox returns logical coordinates, so transform to device
rectClip.left = LogicalToDeviceX(rectClip.left);
rectClip.top = LogicalToDeviceY(rectClip.top);
rectClip.right = LogicalToDeviceX(rectClip.right);
rectClip.bottom = LogicalToDeviceY(rectClip.bottom);
HRGN hrgnDest = ::CreateRectRgn(0, 0, 0, 0); HRGN hrgnDest = ::CreateRectRgn(0, 0, 0, 0);
HRGN hrgnClipOld = ::CreateRectRgn(rectClip.left, rectClip.top, HRGN hrgnClipOld = ::CreateRectRgn(rectClip.left, rectClip.top,
rectClip.right, rectClip.bottom); rectClip.right, rectClip.bottom);
@ -1835,9 +1841,7 @@ void wxDC::SetDeviceOrigin(wxCoord x, wxCoord y)
m_deviceOriginX = x; m_deviceOriginX = x;
m_deviceOriginY = y; m_deviceOriginY = y;
#ifndef __WXWINCE__
::SetViewportOrgEx(GetHdc(), (int)m_deviceOriginX, (int)m_deviceOriginY, NULL); ::SetViewportOrgEx(GetHdc(), (int)m_deviceOriginX, (int)m_deviceOriginY, NULL);
#endif
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------