From f547e9bb27ed4fb6a05148c88dd4da43aed310dd Mon Sep 17 00:00:00 2001 From: Ron Lee Date: Mon, 6 Mar 2000 04:40:01 +0000 Subject: [PATCH] set m_clipXX so dc.GetClippingBox returns real bounding box git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6469 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/dc.h | 1 - src/msw/dc.cpp | 36 ++++++++++++++++-------------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/include/wx/msw/dc.h b/include/wx/msw/dc.h index 2bf3643789..4cd330f22e 100644 --- a/include/wx/msw/dc.h +++ b/include/wx/msw/dc.h @@ -125,7 +125,6 @@ public: // -------------------------- virtual void SetRop(WXHDC cdc); - virtual void DoClipping(WXHDC cdc); virtual void SelectOldObjects(WXHDC dc); wxWindow *GetWindow() const { return m_canvas; } diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 354c617418..13abf419bc 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -175,43 +175,39 @@ 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::DoSetClippingRegion(wxCoord cx, wxCoord cy, wxCoord cw, wxCoord ch) { m_clipping = TRUE; - m_clipX1 = (int)cx; - m_clipY1 = (int)cy; - m_clipX2 = (int)(cx + cw); - m_clipY2 = (int)(cy + ch); - - DoClipping((WXHDC) m_hDC); + IntersectClipRect(GetHdc(), XLOG2DEV(cx), YLOG2DEV(cy), + XLOG2DEV(cx + cw), YLOG2DEV(cy + ch)); + DO_SET_CLIPPING_BOX() } void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region) { wxCHECK_RET( region.GetHRGN(), wxT("invalid clipping region") ); - wxRect box = region.GetBox(); - m_clipping = TRUE; - m_clipX1 = box.x; - m_clipY1 = box.y; - m_clipX2 = box.x + box.width; - m_clipY2 = box.y + box.height; #ifdef __WIN16__ SelectClipRgn(GetHdc(), (HRGN) region.GetHRGN()); #else ExtSelectClipRgn(GetHdc(), (HRGN) region.GetHRGN(), RGN_AND); #endif -} -void wxDC::DoClipping(WXHDC dc) -{ - if (m_clipping && dc) - { - IntersectClipRect((HDC) dc, XLOG2DEV(m_clipX1), YLOG2DEV(m_clipY1), - XLOG2DEV(m_clipX2), YLOG2DEV(m_clipY2)); - } + DO_SET_CLIPPING_BOX() } void wxDC::DestroyClippingRegion() -- 2.45.2