don't try to paint hidden windows
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41068 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
801a54412a
commit
14ac4e3a8e
@ -50,7 +50,30 @@ struct wxDfbPaintRequest
|
||||
bool m_eraseBackground;
|
||||
};
|
||||
|
||||
WX_DEFINE_ARRAY_PTR(wxDfbPaintRequest*, wxDfbQueuedPaintRequests);
|
||||
WX_DEFINE_ARRAY_PTR(wxDfbPaintRequest*, wxDfbQueuedPaintRequestsList);
|
||||
|
||||
// Queue of paint requests
|
||||
class wxDfbQueuedPaintRequests
|
||||
{
|
||||
public:
|
||||
~wxDfbQueuedPaintRequests() { Clear(); }
|
||||
|
||||
// Adds paint request to the queue
|
||||
void Add(const wxRect& rect, bool eraseBack)
|
||||
{ m_queue.push_back(new wxDfbPaintRequest(rect, eraseBack)); }
|
||||
|
||||
// Is the queue empty?
|
||||
bool IsEmpty() const { return m_queue.empty(); }
|
||||
|
||||
// Empties the queue
|
||||
void Clear() { WX_CLEAR_ARRAY(m_queue); }
|
||||
|
||||
// Gets requests in the queue
|
||||
const wxDfbQueuedPaintRequestsList& GetRequests() const { return m_queue; }
|
||||
|
||||
private:
|
||||
wxDfbQueuedPaintRequestsList m_queue;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// wxTopLevelWindowDFB
|
||||
@ -159,7 +182,6 @@ wxTopLevelWindowDFB::~wxTopLevelWindowDFB()
|
||||
wxTheApp->ExitMainLoop();
|
||||
}
|
||||
|
||||
WX_CLEAR_ARRAY(*m_toPaint);
|
||||
wxDELETE(m_toPaint);
|
||||
|
||||
// remove the TLW from DFBWindowID->wxTLW map:
|
||||
@ -335,18 +357,28 @@ wxIDirectFBSurfacePtr wxTopLevelWindowDFB::ObtainDfbSurface() const
|
||||
|
||||
void wxTopLevelWindowDFB::HandleQueuedPaintRequests()
|
||||
{
|
||||
wxDfbQueuedPaintRequests& toPaint = *m_toPaint;
|
||||
if ( toPaint.empty() )
|
||||
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;
|
||||
|
||||
size_t cnt = toPaint.size();
|
||||
size_t cnt = requests.size();
|
||||
for ( size_t i = 0; i < cnt; ++i )
|
||||
{
|
||||
const wxDfbPaintRequest& request = *toPaint[i];
|
||||
const wxDfbPaintRequest& request = *requests[i];
|
||||
|
||||
wxRect clipped(request.m_rect);
|
||||
|
||||
@ -368,7 +400,7 @@ void wxTopLevelWindowDFB::HandleQueuedPaintRequests()
|
||||
paintedRect.Union(clipped);
|
||||
}
|
||||
|
||||
WX_CLEAR_ARRAY(toPaint);
|
||||
m_toPaint->Clear();
|
||||
|
||||
if ( paintedRect.IsEmpty() )
|
||||
return; // no painting occurred, no need to flip
|
||||
@ -383,8 +415,8 @@ void wxTopLevelWindowDFB::HandleQueuedPaintRequests()
|
||||
|
||||
void wxTopLevelWindowDFB::DoRefreshRect(const wxRect& rect, bool eraseBack)
|
||||
{
|
||||
// defer paiting until idle time or until Update() is called:
|
||||
m_toPaint->push_back(new wxDfbPaintRequest(rect, eraseBack));
|
||||
// defer painting until idle time or until Update() is called:
|
||||
m_toPaint->Add(rect, eraseBack);
|
||||
}
|
||||
|
||||
void wxTopLevelWindowDFB::Update()
|
||||
|
@ -646,11 +646,10 @@ void wxWindowDFB::Thaw()
|
||||
|
||||
void wxWindowDFB::PaintWindow(const wxRect& rect, bool eraseBackground)
|
||||
{
|
||||
if ( IsFrozen() )
|
||||
return; // don't paint anything if the window is frozen
|
||||
wxCHECK_RET( !IsFrozen() && IsShown(), _T("shouldn't be called") );
|
||||
|
||||
wxLogTrace(TRACE_PAINT,
|
||||
_T("%p ('%s'): paiting region [x=%i,y=%i,w=%i,h=%i]"),
|
||||
_T("%p ('%s'): painting region [x=%i,y=%i,w=%i,h=%i]"),
|
||||
this, GetName().c_str(),
|
||||
rect.x, rect.y, rect.width, rect.height);
|
||||
|
||||
@ -694,6 +693,9 @@ void wxWindowDFB::PaintWindow(const wxRect& rect, bool eraseBackground)
|
||||
{
|
||||
wxWindow *child = *i;
|
||||
|
||||
if ( child->IsFrozen() || !child->IsShown() )
|
||||
continue; // don't paint anything if the window is frozen or hidden
|
||||
|
||||
// compute child's area to repaint
|
||||
wxRect childrect(child->GetRect());
|
||||
childrect.Offset(origin);
|
||||
|
Loading…
Reference in New Issue
Block a user