diff options
author | Liang Qi <liang.qi@qt.io> | 2016-05-10 19:26:21 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-05-10 19:26:21 +0200 |
commit | 08e13bfcdb23eabfbc47bca7499b0b8aadce0ac7 (patch) | |
tree | 406ffa7e3ae0a346a14175ccccb8ac7e596d8f8f /src/plugins/qnx/common/windowgrabber.h | |
parent | fa9fe9ff8c3aba25fbae4f8f32588dd6477d6df8 (diff) | |
parent | f0e0d5d901d4e28fff9f29caf86ada84906b3db4 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
src/plugins/winrt/qwinrtcameracontrol.cpp
Change-Id: I45d3042adf19577a72794610fa1c310cb22e26c4
Diffstat (limited to 'src/plugins/qnx/common/windowgrabber.h')
-rw-r--r-- | src/plugins/qnx/common/windowgrabber.h | 61 |
1 files changed, 40 insertions, 21 deletions
diff --git a/src/plugins/qnx/common/windowgrabber.h b/src/plugins/qnx/common/windowgrabber.h index 424fa35fe..b2d43a27b 100644 --- a/src/plugins/qnx/common/windowgrabber.h +++ b/src/plugins/qnx/common/windowgrabber.h @@ -47,12 +47,41 @@ #include <EGL/eglext.h> #include <QAbstractNativeEventFilter> #include <QObject> +#include <QSize> #include <QTimer> #include <screen/screen.h> QT_BEGIN_NAMESPACE +class WindowGrabberImage : public QObject +{ + Q_OBJECT + +public: + WindowGrabberImage(); + ~WindowGrabberImage(); + + bool initialize(screen_context_t screenContext); + + void destroy(); + + QImage getImage(screen_window_t window, const QSize &size); + GLuint getTexture(screen_window_t window, const QSize &size); + +private: + bool grab(screen_window_t window); + bool resize(const QSize &size); + + QSize m_size; + screen_pixmap_t m_pixmap; + screen_buffer_t m_pixmapBuffer; + EGLImageKHR m_eglImage; + GLuint m_glTexture; + unsigned char *m_bufferAddress; + int m_bufferStride; +}; + class WindowGrabber : public QObject, public QAbstractNativeEventFilter { Q_OBJECT @@ -63,8 +92,6 @@ public: void setFrameRate(int frameRate); - void createEglImages(); - void setWindowId(const QByteArray &windowId); void start(); @@ -81,17 +108,19 @@ public: bool eglImageSupported(); void checkForEglImageExtension(); - bool eglImagesInitialized(); + + int getNextTextureId(); + QImage getNextImage(); signals: - void frameGrabbed(const QImage &frame, int); + void updateScene(const QSize &size); private slots: - void grab(); + void triggerUpdate(); private: + bool selectBuffer(); void cleanup(); - void updateFrameSize(); QTimer m_timer; @@ -99,24 +128,14 @@ private: screen_window_t m_window; screen_context_t m_screenContext; - screen_pixmap_t m_screenPixmaps[2]; - screen_buffer_t m_screenPixmapBuffers[2]; - - char *m_screenBuffers[2]; - int m_screenBufferWidth; - int m_screenBufferHeight; - int m_screenBufferStride; + WindowGrabberImage *m_images[2]; + QSize m_size; - bool m_active : 1; - bool m_screenContextInitialized : 1; - bool m_screenPixmapBuffersInitialized : 1; + bool m_active; int m_currentFrame; - EGLImageKHR img[2]; - GLuint imgTextures[2]; - bool m_eglImageSupported : 1; - bool m_eglImagesInitialized : 1; - bool m_eglImageCheck : 1; // We must not send a grabed frame before this is true + bool m_eglImageSupported; + bool m_eglImageCheck; // We must not send a grabed frame before this is true }; QT_END_NAMESPACE |