+//-----------------------------------------------------------------------------
+// helpers
+//-----------------------------------------------------------------------------
+
+// Returns subrect of the window that is not outside of its parent's
+// boundaries ("hidden behind its borders"), recursively:
+static wxRect GetUncoveredWindowArea(wxWindow *win)
+{
+ wxRect r(win->GetSize());
+
+ if ( win->IsTopLevel() )
+ return r;
+
+ wxWindow *parent = win->GetParent();
+ if ( !parent )
+ return r;
+
+ // intersect with parent's uncovered area, after offsetting it into win's
+ // coordinates; this will remove parts of 'r' that are outside of the
+ // parent's area:
+ wxRect rp(GetUncoveredWindowArea(parent));
+ rp.Offset(-win->GetPosition());
+ rp.Offset(-parent->GetClientAreaOrigin());
+ r.Intersect(rp);
+
+ return r;
+}
+
+// creates a dummy surface that has the same format as the real window's
+// surface, but is not visible and so can be painted on even if the window
+// is hidden
+static
+wxIDirectFBSurfacePtr CreateDummySurface(wxWindow *win, const wxRect *rect)
+{
+ wxLogTrace(TRACE_PAINT, _T("%p ('%s'): creating dummy DC surface"),
+ win, win->GetName().c_str());
+ wxSize size(rect ? rect->GetSize() : win->GetSize());
+ return win->GetDfbSurface()->CreateCompatible
+ (
+ size,
+ wxIDirectFBSurface::CreateCompatible_NoBackBuffer
+ );
+}
+