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:
@@ -50,7 +50,30 @@ struct wxDfbPaintRequest
|
|||||||
bool m_eraseBackground;
|
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
|
// wxTopLevelWindowDFB
|
||||||
@@ -159,7 +182,6 @@ wxTopLevelWindowDFB::~wxTopLevelWindowDFB()
|
|||||||
wxTheApp->ExitMainLoop();
|
wxTheApp->ExitMainLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
WX_CLEAR_ARRAY(*m_toPaint);
|
|
||||||
wxDELETE(m_toPaint);
|
wxDELETE(m_toPaint);
|
||||||
|
|
||||||
// remove the TLW from DFBWindowID->wxTLW map:
|
// remove the TLW from DFBWindowID->wxTLW map:
|
||||||
@@ -335,18 +357,28 @@ wxIDirectFBSurfacePtr wxTopLevelWindowDFB::ObtainDfbSurface() const
|
|||||||
|
|
||||||
void wxTopLevelWindowDFB::HandleQueuedPaintRequests()
|
void wxTopLevelWindowDFB::HandleQueuedPaintRequests()
|
||||||
{
|
{
|
||||||
wxDfbQueuedPaintRequests& toPaint = *m_toPaint;
|
if ( m_toPaint->IsEmpty() )
|
||||||
if ( toPaint.empty() )
|
|
||||||
return; // nothing to do
|
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:
|
// process queued paint requests:
|
||||||
wxRect winRect(wxPoint(0, 0), GetSize());
|
wxRect winRect(wxPoint(0, 0), GetSize());
|
||||||
wxRect paintedRect;
|
wxRect paintedRect;
|
||||||
|
|
||||||
size_t cnt = toPaint.size();
|
size_t cnt = requests.size();
|
||||||
for ( size_t i = 0; i < cnt; ++i )
|
for ( size_t i = 0; i < cnt; ++i )
|
||||||
{
|
{
|
||||||
const wxDfbPaintRequest& request = *toPaint[i];
|
const wxDfbPaintRequest& request = *requests[i];
|
||||||
|
|
||||||
wxRect clipped(request.m_rect);
|
wxRect clipped(request.m_rect);
|
||||||
|
|
||||||
@@ -368,7 +400,7 @@ void wxTopLevelWindowDFB::HandleQueuedPaintRequests()
|
|||||||
paintedRect.Union(clipped);
|
paintedRect.Union(clipped);
|
||||||
}
|
}
|
||||||
|
|
||||||
WX_CLEAR_ARRAY(toPaint);
|
m_toPaint->Clear();
|
||||||
|
|
||||||
if ( paintedRect.IsEmpty() )
|
if ( paintedRect.IsEmpty() )
|
||||||
return; // no painting occurred, no need to flip
|
return; // no painting occurred, no need to flip
|
||||||
@@ -383,8 +415,8 @@ void wxTopLevelWindowDFB::HandleQueuedPaintRequests()
|
|||||||
|
|
||||||
void wxTopLevelWindowDFB::DoRefreshRect(const wxRect& rect, bool eraseBack)
|
void wxTopLevelWindowDFB::DoRefreshRect(const wxRect& rect, bool eraseBack)
|
||||||
{
|
{
|
||||||
// defer paiting until idle time or until Update() is called:
|
// defer painting until idle time or until Update() is called:
|
||||||
m_toPaint->push_back(new wxDfbPaintRequest(rect, eraseBack));
|
m_toPaint->Add(rect, eraseBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTopLevelWindowDFB::Update()
|
void wxTopLevelWindowDFB::Update()
|
||||||
|
@@ -646,11 +646,10 @@ void wxWindowDFB::Thaw()
|
|||||||
|
|
||||||
void wxWindowDFB::PaintWindow(const wxRect& rect, bool eraseBackground)
|
void wxWindowDFB::PaintWindow(const wxRect& rect, bool eraseBackground)
|
||||||
{
|
{
|
||||||
if ( IsFrozen() )
|
wxCHECK_RET( !IsFrozen() && IsShown(), _T("shouldn't be called") );
|
||||||
return; // don't paint anything if the window is frozen
|
|
||||||
|
|
||||||
wxLogTrace(TRACE_PAINT,
|
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(),
|
this, GetName().c_str(),
|
||||||
rect.x, rect.y, rect.width, rect.height);
|
rect.x, rect.y, rect.width, rect.height);
|
||||||
|
|
||||||
@@ -694,6 +693,9 @@ void wxWindowDFB::PaintWindow(const wxRect& rect, bool eraseBackground)
|
|||||||
{
|
{
|
||||||
wxWindow *child = *i;
|
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
|
// compute child's area to repaint
|
||||||
wxRect childrect(child->GetRect());
|
wxRect childrect(child->GetRect());
|
||||||
childrect.Offset(origin);
|
childrect.Offset(origin);
|
||||||
|
Reference in New Issue
Block a user