diff --git a/include/wx/qt/dc.h b/include/wx/qt/dc.h index 5a4ece366c..94623e4201 100644 --- a/include/wx/qt/dc.h +++ b/include/wx/qt/dc.h @@ -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; diff --git a/include/wx/qt/dcclient.h b/include/wx/qt/dcclient.h index 12f922029b..23d6d8ce69 100644 --- a/include/wx/qt/dcclient.h +++ b/include/wx/qt/dcclient.h @@ -20,9 +20,6 @@ public: protected: wxWindow *m_window; - -private: - }; diff --git a/include/wx/qt/dcmemory.h b/include/wx/qt/dcmemory.h index 0289e23c20..8ed5773a89 100644 --- a/include/wx/qt/dcmemory.h +++ b/include/wx/qt/dcmemory.h @@ -24,8 +24,6 @@ public: virtual const wxBitmap& GetSelectedBitmap() const; virtual wxBitmap& GetSelectedBitmap(); -protected: - private: wxBitmap m_selected; }; diff --git a/include/wx/qt/dcscreen.h b/include/wx/qt/dcscreen.h index baa996ff46..371ac49586 100644 --- a/include/wx/qt/dcscreen.h +++ b/include/wx/qt/dcscreen.h @@ -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); }; diff --git a/src/qt/dc.cpp b/src/qt/dc.cpp index 255ce0487a..839e9e395d 100644 --- a/src/qt/dc.cpp +++ b/src/qt/dc.cpp @@ -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 ) diff --git a/src/qt/dcclient.cpp b/src/qt/dcclient.cpp index eea8088a42..696b69e2d4 100644 --- a/src/qt/dcclient.cpp +++ b/src/qt/dcclient.cpp @@ -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; diff --git a/src/qt/dcmemory.cpp b/src/qt/dcmemory.cpp index dfa743ee13..14c68965e8 100644 --- a/src/qt/dcmemory.cpp +++ b/src/qt/dcmemory.cpp @@ -35,6 +35,7 @@ wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxDC *WXUNUSED(dc) ) { m_qtImage = NULL; m_ok = false; + m_qtPainter = new QPainter(); } wxMemoryDCImpl::~wxMemoryDCImpl() diff --git a/src/qt/dcscreen.cpp b/src/qt/dcscreen.cpp index b6e2adfc0f..dcdbff8261 100644 --- a/src/qt/dcscreen.cpp +++ b/src/qt/dcscreen.cpp @@ -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(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; +}