summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2016-07-01 09:44:46 +0200
committerJohan Helsing <johan.helsing@qt.io>2016-07-11 12:13:30 +0000
commit48e241740974ca1b8ba7d654958c423ca9ec9e0e (patch)
treebaa3a2a0aac05ff3a8a8b54be8a22f1e7d943a80
parent839f40ccf522bef3ed4b499899a23393a9a8a1aa (diff)
Compositor: Rename shm to sharedMemory
sharedMemory is much clearer and will increase the readability of the code and API. Change-Id: Ibb6d7424fa8d44a94a0f4ddf476a564eb235323f Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@hawaiios.org>
-rw-r--r--examples/wayland/qwindow-compositor/windowcompositor.cpp4
-rw-r--r--src/client/qwaylandshm.cpp6
-rw-r--r--src/compositor/compositor.pro2
-rw-r--r--src/compositor/compositor_api/qwaylandbufferref.cpp10
-rw-r--r--src/compositor/compositor_api/qwaylandbufferref.h4
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.cpp8
-rw-r--r--src/compositor/compositor_api/qwaylandquickcompositor.cpp2
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp4
-rw-r--r--src/compositor/compositor_api/qwaylandsurfacegrabber.cpp3
-rw-r--r--src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp8
-rw-r--r--src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h2
-rw-r--r--src/shared/qwaylandsharedmemoryformathelper_p.h (renamed from src/shared/qwaylandshmformathelper_p.h)14
-rw-r--r--tests/auto/compositor/tst_compositor.cpp2
13 files changed, 35 insertions, 34 deletions
diff --git a/examples/wayland/qwindow-compositor/windowcompositor.cpp b/examples/wayland/qwindow-compositor/windowcompositor.cpp
index ebbb5e470..4c1fae23c 100644
--- a/examples/wayland/qwindow-compositor/windowcompositor.cpp
+++ b/examples/wayland/qwindow-compositor/windowcompositor.cpp
@@ -72,7 +72,7 @@ GLuint WindowCompositorView::getTexture(GLenum *target)
if (streamingTexture)
m_texture = streamingTexture;
- if (!buf.isShm() && buf.bufferFormatEgl() == QWaylandBufferRef::BufferFormatEgl_EXTERNAL_OES)
+ if (!buf.isSharedMemory() && buf.bufferFormatEgl() == QWaylandBufferRef::BufferFormatEgl_EXTERNAL_OES)
m_textureTarget = GL_TEXTURE_EXTERNAL_OES;
if (advance()) {
@@ -81,7 +81,7 @@ GLuint WindowCompositorView::getTexture(GLenum *target)
glGenTextures(1, &m_texture);
glBindTexture(m_textureTarget, m_texture);
- if (buf.isShm())
+ if (buf.isSharedMemory())
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
buf.bindToTexture();
}
diff --git a/src/client/qwaylandshm.cpp b/src/client/qwaylandshm.cpp
index 790a0e1b9..e94357bb5 100644
--- a/src/client/qwaylandshm.cpp
+++ b/src/client/qwaylandshm.cpp
@@ -39,7 +39,7 @@
#include <QtWaylandClient/private/qwaylandshm_p.h>
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-#include "qwaylandshmformathelper_p.h"
+#include "qwaylandsharedmemoryformathelper_p.h"
QT_BEGIN_NAMESPACE
@@ -73,12 +73,12 @@ bool QWaylandShm::formatSupported(QImage::Format format) const
wl_shm_format QWaylandShm::formatFrom(QImage::Format format)
{
- return QWaylandShmFormatHelper::fromQImageFormat(format);
+ return QWaylandSharedMemoryFormatHelper::fromQImageFormat(format);
}
QImage::Format QWaylandShm::formatFrom(wl_shm_format format)
{
- return QWaylandShmFormatHelper::fromWaylandShmFormat(format);
+ return QWaylandSharedMemoryFormatHelper::fromWaylandShmFormat(format);
}
}
diff --git a/src/compositor/compositor.pro b/src/compositor/compositor.pro
index a83223c05..251d757e2 100644
--- a/src/compositor/compositor.pro
+++ b/src/compositor/compositor.pro
@@ -23,7 +23,7 @@ INCLUDEPATH += ../shared
HEADERS += ../shared/qwaylandmimehelper_p.h \
../shared/qwaylandinputmethodeventbuilder_p.h \
- ../shared/qwaylandshmformathelper_p.h
+ ../shared/qwaylandsharedmemoryformathelper_p.h
SOURCES += ../shared/qwaylandmimehelper.cpp \
../shared/qwaylandinputmethodeventbuilder.cpp
diff --git a/src/compositor/compositor_api/qwaylandbufferref.cpp b/src/compositor/compositor_api/qwaylandbufferref.cpp
index 209117ed2..9bdac5dbb 100644
--- a/src/compositor/compositor_api/qwaylandbufferref.cpp
+++ b/src/compositor/compositor_api/qwaylandbufferref.cpp
@@ -205,8 +205,8 @@ QWaylandBufferRef::BufferType QWaylandBufferRef::bufferType() const
if (d->nullOrDestroyed())
return BufferType_Null;
- if (isShm())
- return BufferType_Shm;
+ if (isSharedMemory())
+ return BufferType_SharedMemory;
return BufferType_Egl;
}
@@ -222,12 +222,12 @@ QWaylandBufferRef::BufferFormatEgl QWaylandBufferRef::bufferFormatEgl() const
/*!
* Returns true if the buffer is a shared memory buffer. Otherwise returns false.
*/
-bool QWaylandBufferRef::isShm() const
+bool QWaylandBufferRef::isSharedMemory() const
{
if (d->nullOrDestroyed())
return false;
- return d->buffer->isShm();
+ return d->buffer->isSharedMemory();
}
/*!
@@ -267,7 +267,7 @@ void QWaylandBufferRef::bindToTexture() const
void QWaylandBufferRef::updateTexture() const
{
- if (d->nullOrDestroyed() || d->buffer->isShm())
+ if (d->nullOrDestroyed() || d->buffer->isSharedMemory())
return;
d->buffer->updateTexture();
diff --git a/src/compositor/compositor_api/qwaylandbufferref.h b/src/compositor/compositor_api/qwaylandbufferref.h
index c3953b440..bca42df96 100644
--- a/src/compositor/compositor_api/qwaylandbufferref.h
+++ b/src/compositor/compositor_api/qwaylandbufferref.h
@@ -77,7 +77,7 @@ public:
enum BufferType {
BufferType_Null,
- BufferType_Shm,
+ BufferType_SharedMemory,
BufferType_Egl
};
@@ -94,7 +94,7 @@ public:
BufferType bufferType() const;
BufferFormatEgl bufferFormatEgl() const;
- bool isShm() const;
+ bool isSharedMemory() const;
QImage image() const;
#ifdef QT_WAYLAND_COMPOSITOR_GL
GLuint textureForPlane(int plane) const;
diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp
index 7d09fa783..c2693a2d6 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandcompositor.cpp
@@ -63,7 +63,7 @@
#include "extensions/qwaylandqtwindowmanager.h"
#include "qwaylandxkb_p.h"
-#include "qwaylandshmformathelper_p.h"
+#include "qwaylandsharedmemoryformathelper_p.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QStringList>
@@ -174,7 +174,7 @@ void QWaylandCompositorPrivate::init()
data_device_manager = new QtWayland::DataDeviceManager(q);
wl_display_init_shm(display);
- QVector<wl_shm_format> formats = QWaylandShmFormatHelper::supportedWaylandFormats();
+ QVector<wl_shm_format> formats = QWaylandSharedMemoryFormatHelper::supportedWaylandFormats();
foreach (wl_shm_format format, formats)
wl_display_add_shm_format(display, format);
@@ -836,13 +836,13 @@ void QWaylandCompositor::setUseHardwareIntegrationExtension(bool use)
* The default implementation requires a OpenGL context to be bound to the current thread
* to work. If this is not possible reimplement this function in your compositor subclass
* to implement custom logic.
- * The default implementation only grabs SHM and OpenGL buffers, reimplement this in your
+ * The default implementation only grabs shared memory and OpenGL buffers, reimplement this in your
* compositor subclass to handle more buffer types.
* You should not call this manually, but rather use \a QWaylandSurfaceGrabber.
*/
void QWaylandCompositor::grabSurface(QWaylandSurfaceGrabber *grabber, const QWaylandBufferRef &buffer)
{
- if (buffer.isShm()) {
+ if (buffer.isSharedMemory()) {
emit grabber->success(buffer.image());
} else {
#ifdef QT_WAYLAND_COMPOSITOR_GL
diff --git a/src/compositor/compositor_api/qwaylandquickcompositor.cpp b/src/compositor/compositor_api/qwaylandquickcompositor.cpp
index dc13368f2..75fe35947 100644
--- a/src/compositor/compositor_api/qwaylandquickcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandquickcompositor.cpp
@@ -114,7 +114,7 @@ void QWaylandQuickCompositor::componentComplete()
*/
void QWaylandQuickCompositor::grabSurface(QWaylandSurfaceGrabber *grabber, const QWaylandBufferRef &buffer)
{
- if (buffer.isShm()) {
+ if (buffer.isSharedMemory()) {
QWaylandCompositor::grabSurface(grabber, buffer);
return;
}
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp
index 203b9ac44..f47104d7e 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -296,7 +296,7 @@ public:
delete m_sgTex;
m_sgTex = 0;
if (m_ref.hasBuffer()) {
- if (buffer.isShm()) {
+ if (buffer.isSharedMemory()) {
m_sgTex = surfaceItem->window()->createTextureFromImage(buffer.image());
if (m_sgTex) {
m_sgTex->bind();
@@ -1080,7 +1080,7 @@ QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
const QRectF rect = invertY ? QRectF(0, height(), width(), -height())
: QRectF(0, 0, width(), height());
- if (ref.isShm() || bufferTypes[ref.bufferFormatEgl()].canProvideTexture) {
+ if (ref.isSharedMemory() || bufferTypes[ref.bufferFormatEgl()].canProvideTexture) {
QSGSimpleTextureNode *node = static_cast<QSGSimpleTextureNode *>(oldNode);
if (!node) {
diff --git a/src/compositor/compositor_api/qwaylandsurfacegrabber.cpp b/src/compositor/compositor_api/qwaylandsurfacegrabber.cpp
index 0eb85b0c6..beeea9f98 100644
--- a/src/compositor/compositor_api/qwaylandsurfacegrabber.cpp
+++ b/src/compositor/compositor_api/qwaylandsurfacegrabber.cpp
@@ -51,7 +51,8 @@ QT_BEGIN_NAMESPACE
Sometimes it is needed to get the contents of a surface, for example to provide a screenshot
to the user. The QWaylandSurfaceGrabber class provides a simple method to do so, without
- having to care what type of buffer backs the surface, be it SHM, OpenGL or something else.
+ having to care what type of buffer backs the surface, be it shared memory, OpenGL or something
+ else.
*/
/*!
diff --git a/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp b/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp
index c2441fae1..71ae6e212 100644
--- a/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp
+++ b/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp
@@ -44,7 +44,7 @@
#include <QtCore/QDebug>
#include <wayland-server-protocol.h>
-#include "qwaylandshmformathelper_p.h"
+#include "qwaylandsharedmemoryformathelper_p.h"
#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
@@ -176,7 +176,7 @@ QSize SurfaceBuffer::size() const
QWaylandSurface::Origin SurfaceBuffer::origin() const
{
- if (isShm()) {
+ if (isSharedMemory()) {
return QWaylandSurface::OriginTopLeft;
}
@@ -201,7 +201,7 @@ QImage SurfaceBuffer::image() const
QWaylandBufferRef::BufferFormatEgl SurfaceBuffer::bufferFormatEgl() const
{
- Q_ASSERT(isShm() == false);
+ Q_ASSERT(isSharedMemory() == false);
if (QtWayland::ClientBufferIntegration *clientInt = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration())
return clientInt->bufferFormat(m_buffer);
@@ -212,7 +212,7 @@ QWaylandBufferRef::BufferFormatEgl SurfaceBuffer::bufferFormatEgl() const
void SurfaceBuffer::bindToTexture() const
{
Q_ASSERT(m_compositor);
- if (isShm()) {
+ if (isSharedMemory()) {
QImage image = this->image();
if (image.hasAlphaChannel()) {
if (image.format() != QImage::Format_RGBA8888) {
diff --git a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
index 95e7e8158..609581493 100644
--- a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
+++ b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
@@ -101,7 +101,7 @@ public:
QSize size() const;
QWaylandSurface::Origin origin() const;
- bool isShm() const { return wl_shm_buffer_get(m_buffer); }
+ bool isSharedMemory() const { return wl_shm_buffer_get(m_buffer); }
QImage image() const;
QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const;
diff --git a/src/shared/qwaylandshmformathelper_p.h b/src/shared/qwaylandsharedmemoryformathelper_p.h
index 58db42e26..7f2f77cc3 100644
--- a/src/shared/qwaylandshmformathelper_p.h
+++ b/src/shared/qwaylandsharedmemoryformathelper_p.h
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QWAYLANDSHMFORMATHELPER_H
-#define QWAYLANDSHMFORMATHELPER_H
+#ifndef QWAYLANDSHAREDMEMORYFORMATHELPER_H
+#define QWAYLANDSHAREDMEMORYFORMATHELPER_H
#include <QtGui/QImage>
@@ -47,7 +47,7 @@
QT_BEGIN_NAMESPACE
-class QWaylandShmFormatHelper
+class QWaylandSharedMemoryFormatHelper
{
public:
static inline wl_shm_format fromQImageFormat(QImage::Format format);
@@ -100,7 +100,7 @@ private:
}
};
-wl_shm_format QWaylandShmFormatHelper::fromQImageFormat(QImage::Format format)
+wl_shm_format QWaylandSharedMemoryFormatHelper::fromQImageFormat(QImage::Format format)
{
Array array = getData();
if (array.size <= size_t(format))
@@ -108,7 +108,7 @@ wl_shm_format QWaylandShmFormatHelper::fromQImageFormat(QImage::Format format)
return array.data[format];
}
-QImage::Format QWaylandShmFormatHelper::fromWaylandShmFormat(wl_shm_format format)
+QImage::Format QWaylandSharedMemoryFormatHelper::fromWaylandShmFormat(wl_shm_format format)
{
Array array = getData();
for (size_t i = 0; i < array.size; i++) {
@@ -118,7 +118,7 @@ QImage::Format QWaylandShmFormatHelper::fromWaylandShmFormat(wl_shm_format forma
return QImage::Format_Invalid;
}
-QVector<wl_shm_format> QWaylandShmFormatHelper::supportedWaylandFormats()
+QVector<wl_shm_format> QWaylandSharedMemoryFormatHelper::supportedWaylandFormats()
{
QVector<wl_shm_format> retFormats;
Array array = getData();
@@ -133,4 +133,4 @@ QVector<wl_shm_format> QWaylandShmFormatHelper::supportedWaylandFormats()
QT_END_NAMESPACE
-#endif //QWAYLANDSHMFORMATHELPER_H
+#endif //QWAYLANDSHAREDMEMORYFORMATHELPER_H
diff --git a/tests/auto/compositor/tst_compositor.cpp b/tests/auto/compositor/tst_compositor.cpp
index d3db972b9..bf4d6f261 100644
--- a/tests/auto/compositor/tst_compositor.cpp
+++ b/tests/auto/compositor/tst_compositor.cpp
@@ -261,7 +261,7 @@ void tst_WaylandCompositor::frameCallback()
QImage image() const
{
- if (bufferRef.isNull() || !bufferRef.isShm())
+ if (bufferRef.isNull() || !bufferRef.isSharedMemory())
return QImage();
return bufferRef.image();
}