-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;
- }
-
- const wxDfbQueuedPaintRequestsList& requests = m_toPaint->GetRequests();
-
- // 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;
-
- size_t cnt = requests.size();
- wxLogTrace(TRACE_PAINT, _T("%p ('%s'): processing %i paint requests"),
- this, GetName().c_str(), cnt);
-
- for ( size_t i = 0; i < cnt; ++i )
- {
- const wxDfbPaintRequest& request = *requests[i];
-
- wxRect clipped(request.m_rect);
- 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'): flipped surface: [%i,%i,%i,%i]"),
- this, GetName().c_str(),
- paintedRect.x, paintedRect.y,
- paintedRect.GetRight(), paintedRect.GetBottom());
-}
-
-void wxTopLevelWindowDFB::DoRefreshRect(const wxRect& rect)