corrected painting implementation for wxDFB

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41185 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2006-09-13 09:50:02 +00:00
parent 47e5915415
commit 20671963ef
9 changed files with 231 additions and 120 deletions

View File

@@ -22,39 +22,31 @@ class WXDLLIMPEXP_CORE wxWindow;
class WXDLLIMPEXP_CORE wxWindowDC : public wxDC
{
public:
wxWindowDC() {}
wxWindowDC() : m_win(NULL) {}
wxWindowDC(wxWindow *win);
virtual ~wxWindowDC();
protected:
// initializes the DC for painting on given window; if rect!=NULL, then
// for painting only on the given region of the window
void InitForWin(wxWindow *win, const wxRect *rect);
private:
wxWindow *m_win; // the window the DC paints on
DECLARE_DYNAMIC_CLASS(wxWindowDC)
DECLARE_NO_COPY_CLASS(wxWindowDC)
};
//-----------------------------------------------------------------------------
// base class for wxClientDC and wxPaintDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxClientDCBase : public wxWindowDC
{
public:
wxClientDCBase() {}
wxClientDCBase(wxWindow *win);
};
//-----------------------------------------------------------------------------
// wxClientDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxClientDC : public wxClientDCBase
class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC
{
public:
wxClientDC() {}
wxClientDC(wxWindow *win) : wxClientDCBase(win) {}
~wxClientDC();
wxClientDC(wxWindow *win);
DECLARE_DYNAMIC_CLASS(wxClientDC)
DECLARE_NO_COPY_CLASS(wxClientDC)
@@ -65,12 +57,11 @@ public:
// wxPaintDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDCBase
class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC
{
public:
wxPaintDC() {}
wxPaintDC(wxWindow *win) : wxClientDCBase(win) {}
~wxPaintDC();
wxPaintDC(wxWindow *win) : wxClientDC(win) {}
DECLARE_DYNAMIC_CLASS(wxPaintDC)
DECLARE_NO_COPY_CLASS(wxPaintDC)

View File

@@ -77,6 +77,10 @@ public:
wxIDirectFBWindowPtr GetDirectFBWindow() const { return m_dfbwin; }
// Returns true if some invalidated area of the TLW is currently being
// painted
bool IsPainting() const { return m_isPainting; }
protected:
// common part of all ctors
void Init();
@@ -88,7 +92,7 @@ protected:
virtual void DoGetSize(int *width, int *height) const;
virtual void DoMoveWindow(int x, int y, int width, int height);
virtual void DoRefreshRect(const wxRect& rect, bool eraseBack = true);
virtual void DoRefreshRect(const wxRect& rect);
private:
// do queued painting in idle time
@@ -119,7 +123,10 @@ protected:
wxIDirectFBWindowPtr m_dfbwin;
private:
// invalidated areas of the TLW that need repainting
wxDfbQueuedPaintRequests *m_toPaint;
// are we currently painting some area of this TLW?
bool m_isPainting;
friend class wxEventLoop; // for HandleDFBWindowEvent
};

View File

@@ -140,11 +140,12 @@ protected:
void InvalidateDfbSurface();
// called by parent to render (part of) the window
void PaintWindow(const wxRect& rect, bool eraseBackground);
void PaintWindow(const wxRect& rect);
// implementation of Refresh()
void DoRefreshWindow(bool eraseBack = true);
virtual void DoRefreshRect(const wxRect& rect, bool eraseBack = true);
// refreshes the entire window (including non-client areas)
void DoRefreshWindow();
// refreshes given rectangle of the window (in window, _not_ client coords)
virtual void DoRefreshRect(const wxRect& rect);
// DirectFB events handling
void HandleKeyEvent(const wxDFBWindowEvent& event_);
@@ -177,5 +178,4 @@ private:
DECLARE_EVENT_TABLE()
};
#endif // _WX_DFB_WINDOW_H_

View File

@@ -231,10 +231,11 @@ struct wxIDirectFBSurface : public wxDfbWrapper<IDirectFBSurface>
(DFBSurfaceTextFlags)flags));
}
bool Flip(const DFBRegion *region, int flags)
{
return Check(m_ptr->Flip(m_ptr, region, (DFBSurfaceFlipFlags)flags));
}
/**
Updates the front buffer from the back buffer. If @a region is not
NULL, only given rectangle is updated.
*/
bool FlipToFront(const DFBRegion *region = NULL);
wxIDirectFBSurfacePtr GetSubSurface(const DFBRectangle *rect)
{
@@ -293,6 +294,10 @@ struct wxIDirectFBSurface : public wxDfbWrapper<IDirectFBSurface>
size of this surface.
*/
wxIDirectFBSurfacePtr CreateCompatible(const wxSize& size = wxDefaultSize);
private:
// this is private because we want user code to use FlipToFront()
bool Flip(const DFBRegion *region, int flags);
};