{
m_hDC = dc;
m_bOwnsDC = bOwnsDC;
+
+ // we might have a pre existing clipping region, make sure that we
+ // return it if asked -- but avoid calling ::GetClipBox() right now as
+ // it could be unnecessary wasteful
+ m_clipping = true;
+ m_clipX1 =
+ m_clipX2 = 0;
}
const wxBitmap& GetSelectedBitmap() const { return m_selectedBitmap; }
{
GetClippingBox(x, y, width, height);
}
+ virtual void DoGetClippingBox(wxCoord *x, wxCoord *y,
+ wxCoord *w, wxCoord *h) const;
virtual void DoGetSize(int *width, int *height) const;
virtual void DoGetSizeMM(int* width, int* height) const;
m_clipY2 = (wxCoord) YDEV2LOG(rect.bottom);
}
+void
+wxDC::DoGetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const
+{
+ // check if we should try to retrieve the clipping region possibly not set
+ // by our SetClippingRegion() but preset by Windows:this can only happen
+ // when we're associated with an existing HDC usign SetHDC(), see there
+ if ( m_clipping && !m_clipX1 && !m_clipX2 )
+ {
+ UpdateClipBox();
+
+ if ( !m_clipX1 && !m_clipX2 )
+ m_clipping = false;
+ }
+
+ return wxDCBase::DoGetClippingBox(x, y, w, h);
+}
+
// common part of DoSetClippingRegion() and DoSetClippingRegionAsRegion()
void wxDC::SetClippingHrgn(WXHRGN hrgn)
{
::DeleteObject(rgn);
}
- m_clipping = false;
+ wxDCBase::DestroyClippingRegion();
}
// ---------------------------------------------------------------------------