-wxIDirectFBSurfacePtr wxTopLevelWindowDFB::ObtainDfbSurface() const
-{
- return m_dfbwin->GetSurface();
-}
-
-void wxTopLevelWindowDFB::HandleQueuedPaintRequests()
-{
- if ( m_toPaint->IsEmpty() )
- return; // nothing to do
-
- if ( IsFrozen() || !IsShown() )
- {
- // nothing to do if the window is frozen or hidden; clear the queue
- // and return (note that it's OK to clear the queue even if the window
- // is frozen, because Thaw() calls Refresh()):
- m_toPaint->Clear();
- return;
- }
-
- // process queued paint requests:
- wxRect winRect(wxPoint(0, 0), GetSize());
- wxRect paintedRect;
-
- // important note: all DCs created from now until m_isPainting is reset to
- // false will not update the front buffer as this flag indicates that we'll
- // blit the entire back buffer to front soon
- m_isPainting = true;
-
-#ifdef __WXDEBUG__
- int requestsCount = 0;
-#endif
-
- wxRect request;
- while ( m_toPaint->GetNext(request) )
- {
-#ifdef __WXDEBUG__
- requestsCount++;
-#endif
- wxRect clipped(request);
- clipped.Intersect(winRect);
- if ( clipped.IsEmpty() )
- continue; // nothing to refresh
-
- wxLogTrace(TRACE_PAINT,
- _T("%p ('%s'): processing paint request [%i,%i,%i,%i]"),
- this, GetName().c_str(),
- clipped.x, clipped.y, clipped.GetRight(), clipped.GetBottom());
-
- PaintWindow(clipped);
-
- // remember rectangle covering all repainted areas:
- if ( paintedRect.IsEmpty() )
- paintedRect = clipped;
- else
- paintedRect.Union(clipped);
- }
-
- m_isPainting = false;
-
- m_toPaint->Clear();
-
- if ( paintedRect.IsEmpty() )
- return; // no painting occurred, no need to flip
-
- // Flip the surface to make the changes visible. Note that the rectangle we
- // flip is *superset* of the union of repainted rectangles (created as
- // "rectangles union" by wxRect::Union) and so some parts of the back
- // buffer that we didn't touch in this HandleQueuedPaintRequests call will
- // be copied to the front buffer as well. This is safe/correct thing to do
- // *only* because wx always use wxIDirectFBSurface::FlipToFront() and so
- // the back and front buffers contain the same data.
- //
- // Note that we do _not_ split m_toPaint into disjoint rectangles and
- // do FlipToFront() for each of them, because that could result in visible
- // updating of the screen; instead, we prefer to flip everything at once.
-
- DFBRegion r = {paintedRect.GetLeft(), paintedRect.GetTop(),
- paintedRect.GetRight(), paintedRect.GetBottom()};
- DFBRegion *rptr = (winRect == paintedRect) ? NULL : &r;
-
- GetDfbSurface()->FlipToFront(rptr);
-
- wxLogTrace(TRACE_PAINT,
- _T("%p ('%s'): processed %i paint requests, flipped surface: [%i,%i,%i,%i]"),
- this, GetName().c_str(),
- requestsCount,
- paintedRect.x, paintedRect.y,
- paintedRect.GetRight(), paintedRect.GetBottom());
-}
-
-void wxTopLevelWindowDFB::DoRefreshRect(const wxRect& rect)
-{
- // don't overlap outside of the window (NB: 'rect' is in window coords):
- wxRect r(rect);
- r.Intersect(wxRect(GetSize()));
- if ( r.IsEmpty() )
- return;
-
- wxLogTrace(TRACE_PAINT,
- _T("%p ('%s'): [TLW] refresh rect [%i,%i,%i,%i]"),
- this, GetName().c_str(),
- rect.x, rect.y, rect.GetRight(), rect.GetBottom());
-
- // defer painting until idle time or until Update() is called:
- m_toPaint->Add(rect);
-}
-
-void wxTopLevelWindowDFB::Update()