X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c4218a74033e3091a3566c9c6619809a00b53744..cbf656555e872684a74eb0badffe1aa33bedf95d:/src/msw/dc.cpp?ds=sidebyside diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index faa71428b5..0887188c47 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -264,16 +264,15 @@ void wxDC::SelectOldObjects(WXHDC dc) // clipping // --------------------------------------------------------------------------- -#define DO_SET_CLIPPING_BOX() \ -{ \ - RECT rect; \ - \ - GetClipBox(GetHdc(), &rect); \ - \ - m_clipX1 = (wxCoord) XDEV2LOG(rect.left); \ - m_clipY1 = (wxCoord) YDEV2LOG(rect.top); \ - m_clipX2 = (wxCoord) XDEV2LOG(rect.right); \ - m_clipY2 = (wxCoord) YDEV2LOG(rect.bottom); \ +void wxDC::UpdateClipBox() +{ + RECT rect; + GetClipBox(GetHdc(), &rect); + + m_clipX1 = (wxCoord) XDEV2LOG(rect.left); + m_clipY1 = (wxCoord) YDEV2LOG(rect.top); + m_clipX2 = (wxCoord) XDEV2LOG(rect.right); + m_clipY2 = (wxCoord) YDEV2LOG(rect.bottom); } void wxDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h) @@ -282,6 +281,8 @@ void wxDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h) // the region coords are always the device ones, so do the translation // manually + // + // FIXME: possible +/-1 error here, to check! HRGN hrgn = ::CreateRectRgn(LogicalToDeviceX(x), LogicalToDeviceY(y), LogicalToDeviceX(x + w), @@ -297,23 +298,23 @@ void wxDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h) wxLogLastError(_T("SelectClipRgn")); } - DO_SET_CLIPPING_BOX() + UpdateClipBox(); } } void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region) { - wxCHECK_RET( region.GetHRGN(), wxT("invalid clipping region") ); + wxCHECK_RET( GetHrgnOf(region), wxT("invalid clipping region") ); m_clipping = TRUE; #ifdef __WIN16__ - SelectClipRgn(GetHdc(), (HRGN) region.GetHRGN()); -#else - ExtSelectClipRgn(GetHdc(), (HRGN) region.GetHRGN(), RGN_AND); -#endif + SelectClipRgn(GetHdc(), GetHrgnOf(region)); +#else // Win32 + ExtSelectClipRgn(GetHdc(), GetHrgnOf(region), RGN_AND); +#endif // Win16/32 - DO_SET_CLIPPING_BOX() + UpdateClipBox(); } void wxDC::DestroyClippingRegion() @@ -327,6 +328,7 @@ void wxDC::DestroyClippingRegion() SelectClipRgn(GetHdc(), rgn); DeleteObject(rgn); } + m_clipping = FALSE; } @@ -341,10 +343,15 @@ bool wxDC::CanDrawBitmap() const bool wxDC::CanGetTextExtent() const { +#ifdef __WXMICROWIN__ + // TODO Extend MicroWindows' GetDeviceCaps function + return TRUE; +#else // What sort of display is it? int technology = ::GetDeviceCaps(GetHdc(), TECHNOLOGY); return (technology == DT_RASDISPLAY) || (technology == DT_RASPRINTER); +#endif } int wxDC::GetDepth() const @@ -514,7 +521,7 @@ void wxDC::DoDrawCheckMark(wxCoord x1, wxCoord y1, wxCoord x2 = x1 + width, y2 = y1 + height; -#if defined(__WIN32__) && !defined(__SC__) +#if defined(__WIN32__) && !defined(__SC__) && !defined(__WXMICROWIN__) RECT rect; rect.left = x1; rect.top = y1; @@ -899,6 +906,7 @@ void wxDC::DoDrawRotatedText(const wxString& text, { DoDrawText(text, x, y); } +#ifndef __WXMICROWIN__ else { // NB: don't take DEFAULT_GUI_FONT because it's not TrueType and so @@ -949,6 +957,7 @@ void wxDC::DoDrawRotatedText(const wxString& text, CalcBoundingBox(x, y); CalcBoundingBox(x + h*sin(rad), y + h*cos(rad)); } +#endif } // ---------------------------------------------------------------------------