diff options
author | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-07-29 14:58:54 +0200 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-08-28 13:09:41 +0200 |
commit | a327ca8d8a1f6e0a44a3aa6bd4dac716911c434e (patch) | |
tree | ae4c432c495a7baee8f97737160836cbb2e38476 /src/compositor/compositor_api/qwaylandbufferref.h | |
parent | 6c9c54587c6cd1059d5de652d06e248456832ab6 (diff) |
Move the texture ownership from the QWaylandSurface
to the respective QWaylandSurfaceView. For all GL applications this will have no
significant impact, but will cause a memory regression for shm surfaces
with multiple views.
This is done to simplify the creation and destruction of textures,
especially in multi-threaded environments.
Also the same patch removes the y_inverted property and replaces it with
a origin property. Its done in the same patch as a lot of the code was
overlapping.
Change-Id: I4bce50c614c9ac3ba0580e0560339476eac03433
Diffstat (limited to 'src/compositor/compositor_api/qwaylandbufferref.h')
-rw-r--r-- | src/compositor/compositor_api/qwaylandbufferref.h | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/compositor/compositor_api/qwaylandbufferref.h b/src/compositor/compositor_api/qwaylandbufferref.h index b397116a2..fa978fe80 100644 --- a/src/compositor/compositor_api/qwaylandbufferref.h +++ b/src/compositor/compositor_api/qwaylandbufferref.h @@ -43,8 +43,11 @@ #include <QtGui/qopengl.h> #endif +#include <QtCompositor/QWaylandSurface> #include <QtCompositor/qwaylandexport.h> +struct wl_resource; + QT_BEGIN_NAMESPACE namespace QtWayland @@ -61,20 +64,22 @@ public: ~QWaylandBufferRef(); QWaylandBufferRef &operator=(const QWaylandBufferRef &ref); - operator bool() const; - bool isShm() const; + bool isNull() const; + bool hasBuffer() const; + bool operator==(const QWaylandBufferRef &ref); + bool operator!=(const QWaylandBufferRef &ref); + + wl_resource *wl_buffer() const; + QSize size() const; + QWaylandSurface::Origin origin() const; + + bool isShm() const; QImage image() const; -#ifdef QT_COMPOSITOR_WAYLAND_GL - /** - * There must be a GL context bound when calling this function. - * The texture will be automatically destroyed when the last QWaylandBufferRef - * referring to the same underlying buffer will be destroyed or reset. - */ - GLuint createTexture(); - void destroyTexture(); + + void bindToTexture() const; + void *nativeBuffer() const; -#endif private: class QWaylandBufferRefPrivate *const d; |