+ // obtain the surface used for painting:
+ wxIDirectFBSurfacePtr surface;
+ if ( !rect )
+ {
+ wxCHECK_RET( win->GetSize().x > 0 && win->GetSize().y > 0,
+ _T("window has invalid size") );
+
+ surface = win->GetDfbSurface();
+ }
+ else
+ {
+ wxCHECK_RET( !rect || !rect->IsEmpty(), _T("invalid rectangle") );
+
+ DFBRectangle dfbrect = { rect->x, rect->y, rect->width, rect->height };
+ surface = win->GetDfbSurface()->GetSubSurface(&dfbrect);
+ }
+
+ if ( !surface )
+ return;
+
+ Init(surface);