defer dc screen grab until blit
This commit is contained in:
parent
694decea6e
commit
cc01fbc3c0
@ -111,6 +111,8 @@ public:
|
||||
virtual void* GetHandle() const { return (void*) m_qtPainter; }
|
||||
|
||||
protected:
|
||||
virtual QImage *GetQImage() { return m_qtImage; }
|
||||
|
||||
QPainter *m_qtPainter;
|
||||
QImage *m_qtImage;
|
||||
|
||||
|
@ -20,9 +20,6 @@ public:
|
||||
|
||||
protected:
|
||||
wxWindow *m_window;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -24,8 +24,6 @@ public:
|
||||
virtual const wxBitmap& GetSelectedBitmap() const;
|
||||
virtual wxBitmap& GetSelectedBitmap();
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
wxBitmap m_selected;
|
||||
};
|
||||
|
@ -17,9 +17,11 @@ public:
|
||||
|
||||
~wxScreenDCImpl();
|
||||
|
||||
protected:
|
||||
virtual void DoGetSize(int *width, int *height) const wxOVERRIDE;
|
||||
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
|
||||
|
||||
private:
|
||||
QImage *GetQImage();
|
||||
|
||||
wxDECLARE_ABSTRACT_CLASS(wxScreenDCImpl);
|
||||
};
|
||||
|
@ -745,7 +745,7 @@ bool wxQtDCImpl::DoBlit(wxCoord xdest, wxCoord ydest,
|
||||
{
|
||||
wxQtDCImpl *implSource = (wxQtDCImpl*)source->GetImpl();
|
||||
|
||||
QImage *qtSource = implSource->m_qtImage;
|
||||
QImage *qtSource = implSource->GetQImage();
|
||||
|
||||
// Not a CHECK on purpose
|
||||
if ( !qtSource )
|
||||
|
@ -31,6 +31,7 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner )
|
||||
: wxQtDCImpl( owner )
|
||||
{
|
||||
m_window = NULL;
|
||||
m_qtImage = NULL;
|
||||
m_ok = false;
|
||||
m_qtPainter = new QPainter();
|
||||
}
|
||||
@ -39,6 +40,7 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *win )
|
||||
: wxQtDCImpl( owner )
|
||||
{
|
||||
m_window = win;
|
||||
m_qtImage = NULL;
|
||||
m_qtPainter = m_window->QtGetPainter();
|
||||
// if we're not inside a Paint event, painter will invalid
|
||||
m_ok = m_qtPainter != NULL;
|
||||
|
@ -35,6 +35,7 @@ wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxDC *WXUNUSED(dc) )
|
||||
{
|
||||
m_qtImage = NULL;
|
||||
m_ok = false;
|
||||
m_qtPainter = new QPainter();
|
||||
}
|
||||
|
||||
wxMemoryDCImpl::~wxMemoryDCImpl()
|
||||
|
@ -21,7 +21,7 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl);
|
||||
wxScreenDCImpl::wxScreenDCImpl( wxScreenDC *owner )
|
||||
: wxWindowDCImpl( owner )
|
||||
{
|
||||
m_qtImage = new QImage(QApplication::primaryScreen()->grabWindow(QApplication::desktop()->winId()).toImage());
|
||||
m_qtImage = NULL;
|
||||
}
|
||||
|
||||
wxScreenDCImpl::~wxScreenDCImpl( )
|
||||
@ -33,3 +33,20 @@ void wxScreenDCImpl::DoGetSize(int *width, int *height) const
|
||||
{
|
||||
wxDisplaySize(width, height);
|
||||
}
|
||||
|
||||
bool wxScreenDCImpl::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const
|
||||
{
|
||||
// const_cast<wxScreenDCImpl*>(this)->GetQImage();
|
||||
// return wxQtDCImpl::DoGetPixel(x, y, col);
|
||||
x = y = 0;
|
||||
col = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// defered allocation for blit
|
||||
QImage *wxScreenDCImpl::GetQImage()
|
||||
{
|
||||
if(!m_qtImage)
|
||||
m_qtImage = new QImage(QApplication::primaryScreen()->grabWindow(QApplication::desktop()->winId()).toImage());
|
||||
return m_qtImage;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user