From dc61fc45601000626169409443fdeac6a3cd31af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 6 Sep 2010 09:54:59 +0200 Subject: Fixed compilation and API of meego graphics system. --- src/gui/egl/qeglcontext_p.h | 3 + src/gui/painting/qgraphicssystem_runtime_p.h | 1 + src/opengl/qpixmapdata_gl_p.h | 1 + src/plugins/graphicssystems/graphicssystems.pro | 4 + src/plugins/graphicssystems/meego/meego.pro | 19 ++-- .../graphicssystems/meego/qmeegoextensions.cpp | 24 ++-- .../graphicssystems/meego/qmeegoextensions.h | 8 +- .../graphicssystems/meego/qmeegographicssystem.cpp | 122 ++++++++++----------- .../graphicssystems/meego/qmeegographicssystem.h | 30 ++--- .../meego/qmeegographicssystemplugin.cpp | 12 +- .../meego/qmeegographicssystemplugin.h | 4 +- .../graphicssystems/meego/qmeegopixmapdata.cpp | 64 +++++------ .../graphicssystems/meego/qmeegopixmapdata.h | 14 +-- 13 files changed, 158 insertions(+), 148 deletions(-) diff --git a/src/gui/egl/qeglcontext_p.h b/src/gui/egl/qeglcontext_p.h index cae8164..5bc8f09 100644 --- a/src/gui/egl/qeglcontext_p.h +++ b/src/gui/egl/qeglcontext_p.h @@ -107,6 +107,9 @@ private: static QEglContext *currentContext(QEgl::API api); static void setCurrentContext(QEgl::API api, QEglContext *context); + + friend class QMeeGoGraphicsSystem; + friend class QMeeGoPixmapData; }; QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystem_runtime_p.h b/src/gui/painting/qgraphicssystem_runtime_p.h index 0232241..421fbeb 100644 --- a/src/gui/painting/qgraphicssystem_runtime_p.h +++ b/src/gui/painting/qgraphicssystem_runtime_p.h @@ -177,6 +177,7 @@ private: friend class QRuntimePixmapData; friend class QRuntimeWindowSurface; + friend class QMeeGoGraphicsSystem; }; QT_END_NAMESPACE diff --git a/src/opengl/qpixmapdata_gl_p.h b/src/opengl/qpixmapdata_gl_p.h index 4cb67b0..f000993 100644 --- a/src/opengl/qpixmapdata_gl_p.h +++ b/src/opengl/qpixmapdata_gl_p.h @@ -168,6 +168,7 @@ private: mutable QGLPixmapGLPaintDevice m_glDevice; friend class QGLPixmapGLPaintDevice; + friend class QMeeGoPixmapData; }; QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/graphicssystems.pro b/src/plugins/graphicssystems/graphicssystems.pro index 0788933..29a1f34 100644 --- a/src/plugins/graphicssystems/graphicssystems.pro +++ b/src/plugins/graphicssystems/graphicssystems.pro @@ -7,3 +7,7 @@ contains(QT_CONFIG, shivavg) { # Only works under X11 at present !win32:!embedded:!mac:SUBDIRS += shivavg } + +!win32:!embedded:!mac:!symbian:CONFIG += x11 + +x11:contains(QT_CONFIG, opengles2):contains(QT_CONFIG, egl):SUBDIRS += meego diff --git a/src/plugins/graphicssystems/meego/meego.pro b/src/plugins/graphicssystems/meego/meego.pro index 80a974e..d750d34 100644 --- a/src/plugins/graphicssystems/meego/meego.pro +++ b/src/plugins/graphicssystems/meego/meego.pro @@ -1,12 +1,13 @@ -TEMPLATE = lib +TARGET = qmeegographicssystem +include(../../qpluginbase.pri) + QT += gui opengl -INCLUDEPATH += '../' -HEADERS = mgraphicssystem.h mpixmapdata.h mextensions.h -SOURCES = mgraphicssystem.cpp mgraphicssystem.h mgraphicssystemplugin.h mgraphicssystemplugin.cpp mpixmapdata.h mpixmapdata.cpp mextensions.h mextensions.cpp -CONFIG += GLESv2 EGL X11 debug plugin -LIBS += -lGLESv2 -TARGET = meegographicssystem -target.path = $$[QT_INSTALL_PLUGINS]/graphicssystems +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + +HEADERS = qmeegographicssystem.h qmeegopixmapdata.h qmeegoextensions.h +SOURCES = qmeegographicssystem.cpp qmeegographicssystem.h qmeegographicssystemplugin.h qmeegographicssystemplugin.cpp qmeegopixmapdata.h qmeegopixmapdata.cpp qmeegoextensions.h qmeegoextensions.cpp + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target -INSTALLS += target diff --git a/src/plugins/graphicssystems/meego/qmeegoextensions.cpp b/src/plugins/graphicssystems/meego/qmeegoextensions.cpp index 814532f..f40fc43 100644 --- a/src/plugins/graphicssystems/meego/qmeegoextensions.cpp +++ b/src/plugins/graphicssystems/meego/qmeegoextensions.cpp @@ -12,13 +12,13 @@ ** ****************************************************************************/ -#include "mextensions.h" -#include "../private/qeglcontext_p.h" -#include "../private/qpixmapdata_gl_p.h" +#include "qmeegoextensions.h" +#include +#include -bool MExtensions::initialized = false; -bool MExtensions::hasImageShared = false; -bool MExtensions::hasSurfaceScaling = false; +bool QMeeGoExtensions::initialized = false; +bool QMeeGoExtensions::hasImageShared = false; +bool QMeeGoExtensions::hasSurfaceScaling = false; /* Extension funcs */ @@ -34,7 +34,7 @@ static eglSetSurfaceScalingNOKFunc _eglSetSurfaceScalingNOK = 0; /* Public */ -void MExtensions::ensureInitialized() +void QMeeGoExtensions::ensureInitialized() { if (!initialized) initialize(); @@ -42,7 +42,7 @@ void MExtensions::ensureInitialized() initialized = true; } -EGLNativeSharedImageTypeNOK MExtensions::eglCreateSharedImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint *props) +EGLNativeSharedImageTypeNOK QMeeGoExtensions::eglCreateSharedImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint *props) { if (! hasImageShared) qFatal("EGL_NOK_image_shared not found but trying to use capability!"); @@ -50,7 +50,7 @@ EGLNativeSharedImageTypeNOK MExtensions::eglCreateSharedImageNOK(EGLDisplay dpy, return _eglCreateSharedImageNOK(dpy, image, props); } -bool MExtensions::eglQueryImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint prop, EGLint *v) +bool QMeeGoExtensions::eglQueryImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint prop, EGLint *v) { if (! hasImageShared) qFatal("EGL_NOK_image_shared not found but trying to use capability!"); @@ -58,7 +58,7 @@ bool MExtensions::eglQueryImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint pro return _eglQueryImageNOK(dpy, image, prop, v); } -bool MExtensions::eglDestroySharedImageNOK(EGLDisplay dpy, EGLNativeSharedImageTypeNOK img) +bool QMeeGoExtensions::eglDestroySharedImageNOK(EGLDisplay dpy, EGLNativeSharedImageTypeNOK img) { if (! hasImageShared) qFatal("EGL_NOK_image_shared not found but trying to use capability!"); @@ -66,7 +66,7 @@ bool MExtensions::eglDestroySharedImageNOK(EGLDisplay dpy, EGLNativeSharedImageT return _eglDestroySharedImageNOK(dpy, img); } -bool MExtensions::eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surface, int x, int y, int width, int height) +bool QMeeGoExtensions::eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surface, int x, int y, int width, int height) { if (! hasSurfaceScaling) qFatal("EGL_NOK_surface_scaling not found but trying to use capability!"); @@ -76,7 +76,7 @@ bool MExtensions::eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surface, in /* Private */ -void MExtensions::initialize() +void QMeeGoExtensions::initialize() { QGLContext *ctx = (QGLContext *) QGLContext::currentContext(); qt_resolve_eglimage_gl_extensions(ctx); diff --git a/src/plugins/graphicssystems/meego/qmeegoextensions.h b/src/plugins/graphicssystems/meego/qmeegoextensions.h index 9506c50..b8e6195 100644 --- a/src/plugins/graphicssystems/meego/qmeegoextensions.h +++ b/src/plugins/graphicssystems/meego/qmeegoextensions.h @@ -19,9 +19,9 @@ #include #include #include -#include "../private/qgl_p.h" -#include "../private/qeglcontext_p.h" -#include "../private/qpixmapdata_gl_p.h" +#include +#include +#include /* Extensions decls */ @@ -41,7 +41,7 @@ typedef void* EGLNativeSharedImageTypeNOK; /* Class */ -class MExtensions +class QMeeGoExtensions { public: static void ensureInitialized(); diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp index e4a8210..e575cf3 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp @@ -13,44 +13,44 @@ ****************************************************************************/ #include -#include "../private/qpixmap_raster_p.h" -#include "../private/qwindowsurface_gl_p.h" -#include "../private/qegl_p.h" -#include "../private/qglextensions_p.h" -#include "../private/qgl_p.h" -#include "../private/qimagepixmapcleanuphooks_p.h" -#include "../private/qapplication_p.h" -#include "../private/qgraphicssystem_runtime_p.h" -#include "../private/qimage_p.h" -#include "../private/qeglproperties_p.h" -#include "../private/qeglcontext_p.h" - -#include "mpixmapdata.h" -#include "mgraphicssystem.h" -#include "mextensions.h" - -bool MGraphicsSystem::surfaceWasCreated = false; - -MGraphicsSystem::MGraphicsSystem() +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "qmeegopixmapdata.h" +#include "qmeegographicssystem.h" +#include "qmeegoextensions.h" + +bool QMeeGoGraphicsSystem::surfaceWasCreated = false; + +QMeeGoGraphicsSystem::QMeeGoGraphicsSystem() { qDebug("Using the meego graphics system"); } -MGraphicsSystem::~MGraphicsSystem() +QMeeGoGraphicsSystem::~QMeeGoGraphicsSystem() { qDebug("Meego graphics system destroyed"); qt_destroy_gl_share_widget(); } -QWindowSurface* MGraphicsSystem::createWindowSurface(QWidget *widget) const +QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const { - MGraphicsSystem::surfaceWasCreated = true; + QMeeGoGraphicsSystem::surfaceWasCreated = true; QWindowSurface *surface = new QGLWindowSurface(widget); surface->window()->setAttribute(Qt::WA_NoSystemBackground); return surface; } -QPixmapData *MGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const { // Long story short: without this it's possible to hit an // unitialized paintDevice due to a Qt bug too complex to even @@ -61,7 +61,7 @@ QPixmapData *MGraphicsSystem::createPixmapData(QPixmapData::PixelType type) cons return new QRasterPixmapData(type); } -QPixmapData *MGraphicsSystem::createPixmapData(QPixmapData *origin) +QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData *origin) { // If the pixmap is a raster type... // and if the pixmap pointer matches our mapping... @@ -71,14 +71,14 @@ QPixmapData *MGraphicsSystem::createPixmapData(QPixmapData *origin) QRasterPixmapData *rasterClass = static_cast (origin); void *rawResource = static_cast (rasterClass->buffer()->data_ptr()->data); - if (MPixmapData::sharedImagesMap.contains(rawResource)) - return new MPixmapData(); + if (QMeeGoPixmapData::sharedImagesMap.contains(rawResource)) + return new QMeeGoPixmapData(); } return new QRasterPixmapData(origin->pixelType()); } -QPixmapData* MGraphicsSystem::wrapPixmapData(QPixmapData *pmd) +QPixmapData* QMeeGoGraphicsSystem::wrapPixmapData(QPixmapData *pmd) { QString name = QApplicationPrivate::instance()->graphics_system_name; if (name == "runtime") { @@ -92,9 +92,9 @@ QPixmapData* MGraphicsSystem::wrapPixmapData(QPixmapData *pmd) return pmd; } -void MGraphicsSystem::setSurfaceFixedSize(int /*width*/, int /*height*/) +void QMeeGoGraphicsSystem::setSurfaceFixedSize(int /*width*/, int /*height*/) { - if (MGraphicsSystem::surfaceWasCreated) + if (QMeeGoGraphicsSystem::surfaceWasCreated) qWarning("Trying to set surface fixed size but surface already created!"); #ifdef QT_WAS_PATCHED @@ -105,20 +105,20 @@ void MGraphicsSystem::setSurfaceFixedSize(int /*width*/, int /*height*/) #endif } -void MGraphicsSystem::setSurfaceScaling(int x, int y, int width, int height) +void QMeeGoGraphicsSystem::setSurfaceScaling(int x, int y, int width, int height) { - MExtensions::ensureInitialized(); - MExtensions::eglSetSurfaceScalingNOK(QEgl::display(), QEglContext::currentContext(QEgl::OpenGL)->currentSurface, x, y, width, height); + QMeeGoExtensions::ensureInitialized(); + QMeeGoExtensions::eglSetSurfaceScalingNOK(QEgl::display(), QEglContext::currentContext(QEgl::OpenGL)->currentSurface, x, y, width, height); } -void MGraphicsSystem::setTranslucent(bool translucent) +void QMeeGoGraphicsSystem::setTranslucent(bool translucent) { QGLWindowSurface::surfaceFormat.setSampleBuffers(false); QGLWindowSurface::surfaceFormat.setSamples(0); QGLWindowSurface::surfaceFormat.setAlpha(translucent); } -QPixmapData *MGraphicsSystem::pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage) +QPixmapData *QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage) { if (softImage.format() != QImage::Format_ARGB32_Premultiplied && softImage.format() != QImage::Format_ARGB32) { @@ -126,10 +126,10 @@ QPixmapData *MGraphicsSystem::pixmapDataFromEGLSharedImage(Qt::HANDLE handle, co return NULL; } - if (MGraphicsSystem::meegoRunning()) { - MPixmapData *pmd = new MPixmapData; + if (QMeeGoGraphicsSystem::meeGoRunning()) { + QMeeGoPixmapData *pmd = new QMeeGoPixmapData; pmd->fromEGLSharedImage(handle, softImage); - return MGraphicsSystem::wrapPixmapData(pmd); + return QMeeGoGraphicsSystem::wrapPixmapData(pmd); } else { QRasterPixmapData *pmd = new QRasterPixmapData(QPixmapData::PixmapType); pmd->fromImage(softImage, Qt::NoOpaqueDetection); @@ -139,30 +139,30 @@ QPixmapData *MGraphicsSystem::pixmapDataFromEGLSharedImage(Qt::HANDLE handle, co const_cast(softImage).data_ptr()->data) qFatal("Iternal misalignment of raster data detected. Prolly a QImage copy fail."); - MPixmapData::registerSharedImage(handle, softImage); - return MGraphicsSystem::wrapPixmapData(pmd); + QMeeGoPixmapData::registerSharedImage(handle, softImage); + return QMeeGoGraphicsSystem::wrapPixmapData(pmd); } } -void MGraphicsSystem::updateEGLSharedImagePixmap(QPixmap *pixmap) +void QMeeGoGraphicsSystem::updateEGLSharedImagePixmap(QPixmap *pixmap) { - MPixmapData *pmd = (MPixmapData *) pixmap->pixmapData(); + QMeeGoPixmapData *pmd = (QMeeGoPixmapData *) pixmap->pixmapData(); - // Basic sanity check to make sure this is really a MPixmapData... + // Basic sanity check to make sure this is really a QMeeGoPixmapData... if (pmd->classId() != QPixmapData::OpenGLClass) qFatal("Trying to updated EGLSharedImage pixmap but it's not really a shared image pixmap!"); pmd->updateFromSoftImage(); } -QPixmapData *MGraphicsSystem::pixmapDataWithGLTexture(int w, int h) +QPixmapData *QMeeGoGraphicsSystem::pixmapDataWithGLTexture(int w, int h) { QGLPixmapData *pmd = new QGLPixmapData(QPixmapData::PixmapType); pmd->resize(w, h); - return MGraphicsSystem::wrapPixmapData(pmd); + return QMeeGoGraphicsSystem::wrapPixmapData(pmd); } -bool MGraphicsSystem::meegoRunning() +bool QMeeGoGraphicsSystem::meeGoRunning() { if (! QApplicationPrivate::instance()) { qWarning("Application not running just yet... hard to know what system running!"); @@ -180,42 +180,42 @@ bool MGraphicsSystem::meegoRunning() /* C API */ -int m_image_to_egl_shared_image(const QImage &image) +int qt_meego_image_to_egl_shared_image(const QImage &image) { - return MPixmapData::imageToEGLSharedImage(image); + return QMeeGoPixmapData::imageToEGLSharedImage(image); } -QPixmapData* m_pixmapdata_from_egl_shared_image(Qt::HANDLE handle, const QImage &softImage) +QPixmapData* qt_meego_pixmapdata_from_egl_shared_image(Qt::HANDLE handle, const QImage &softImage) { - return MGraphicsSystem::pixmapDataFromEGLSharedImage(handle, softImage); + return QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(handle, softImage); } -QPixmapData* m_pixmapdata_with_gl_texture(int w, int h) +QPixmapData* qt_meego_pixmapdata_with_gl_texture(int w, int h) { - return MGraphicsSystem::pixmapDataWithGLTexture(w, h); + return QMeeGoGraphicsSystem::pixmapDataWithGLTexture(w, h); } -bool m_destroy_egl_shared_image(Qt::HANDLE handle) +bool qt_meego_destroy_egl_shared_image(Qt::HANDLE handle) { - return MPixmapData::destroyEGLSharedImage(handle); + return QMeeGoPixmapData::destroyEGLSharedImage(handle); } -void m_set_surface_fixed_size(int width, int height) +void qt_meego_set_surface_fixed_size(int width, int height) { - MGraphicsSystem::setSurfaceFixedSize(width, height); + QMeeGoGraphicsSystem::setSurfaceFixedSize(width, height); } -void m_set_surface_scaling(int x, int y, int width, int height) +void qt_meego_set_surface_scaling(int x, int y, int width, int height) { - MGraphicsSystem::setSurfaceScaling(x, y, width, height); + QMeeGoGraphicsSystem::setSurfaceScaling(x, y, width, height); } -void m_set_translucent(bool translucent) +void qt_meego_set_translucent(bool translucent) { - MGraphicsSystem::setTranslucent(translucent); + QMeeGoGraphicsSystem::setTranslucent(translucent); } -void m_update_egl_shared_image_pixmap(QPixmap *pixmap) +void qt_meego_update_egl_shared_image_pixmap(QPixmap *pixmap) { - MGraphicsSystem::updateEGLSharedImagePixmap(pixmap); + QMeeGoGraphicsSystem::updateEGLSharedImagePixmap(pixmap); } diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.h b/src/plugins/graphicssystems/meego/qmeegographicssystem.h index c95d7ae..8dc4f23 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.h +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.h @@ -15,14 +15,14 @@ #ifndef MGRAPHICSSYSTEM_H #define MGRAPHICSSYSTEM_H -#include "../private/qgraphicssystem_p.h" +#include -class MGraphicsSystem : public QGraphicsSystem +class QMeeGoGraphicsSystem : public QGraphicsSystem { public: - MGraphicsSystem(); - ~MGraphicsSystem(); - + QMeeGoGraphicsSystem(); + ~QMeeGoGraphicsSystem(); + virtual QWindowSurface *createWindowSurface(QWidget *widget) const; virtual QPixmapData *createPixmapData(QPixmapData::PixelType) const; virtual QPixmapData *createPixmapData(QPixmapData *origin); @@ -37,22 +37,22 @@ public: static void updateEGLSharedImagePixmap(QPixmap *pixmap); private: - static bool meegoRunning(); - + static bool meeGoRunning(); + static bool surfaceWasCreated; }; /* C api */ extern "C" { - int m_image_to_egl_shared_image(const QImage &image); - QPixmapData* m_pixmapdata_from_egl_shared_image(Qt::HANDLE handle, const QImage &softImage); - QPixmapData* m_pixmapdata_with_gl_texture(int w, int h); - void m_update_egl_shared_image_pixmap(QPixmap *pixmap); - bool m_destroy_egl_shared_image(Qt::HANDLE handle); - void m_set_surface_fixed_size(int width, int height); - void m_set_surface_scaling(int x, int y, int width, int height); - void m_set_translucent(bool translucent); + int qt_meego_image_to_egl_shared_image(const QImage &image); + QPixmapData* qt_meego_pixmapdata_from_egl_shared_image(Qt::HANDLE handle, const QImage &softImage); + QPixmapData* qt_meego_pixmapdata_with_gl_texture(int w, int h); + void qt_meego_update_egl_shared_image_pixmap(QPixmap *pixmap); + bool qt_meego_destroy_egl_shared_image(Qt::HANDLE handle); + void qt_meego_set_surface_fixed_size(int width, int height); + void qt_meego_set_surface_scaling(int x, int y, int width, int height); + void qt_meego_set_translucent(bool translucent); } #endif diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.cpp index 3bb7ffb..15c74a0 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.cpp +++ b/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.cpp @@ -13,19 +13,19 @@ ****************************************************************************/ #include -#include "mgraphicssystemplugin.h" -#include "mgraphicssystem.h" +#include "qmeegographicssystemplugin.h" +#include "qmeegographicssystem.h" -QStringList MGraphicsSystemPlugin::keys() const +QStringList QMeeGoGraphicsSystemPlugin::keys() const { QStringList list; list << "meego"; return list; } -QGraphicsSystem *MGraphicsSystemPlugin::create(const QString&) +QGraphicsSystem *QMeeGoGraphicsSystemPlugin::create(const QString&) { - return new MGraphicsSystem; + return new QMeeGoGraphicsSystem; } -Q_EXPORT_PLUGIN2(meego, MGraphicsSystemPlugin) +Q_EXPORT_PLUGIN2(meego, QMeeGoGraphicsSystemPlugin) diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.h b/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.h index 84d4427..76e180a 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.h +++ b/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.h @@ -15,9 +15,9 @@ #ifndef MGRAPHICSSYSTEMPLUGIN_H #define MGRAPHICSSYSTEMPLUGIN_H -#include "../private/qgraphicssystemplugin_p.h" +#include -class MGraphicsSystemPlugin : public QGraphicsSystemPlugin +class QMeeGoGraphicsSystemPlugin : public QGraphicsSystemPlugin { public: virtual QStringList keys() const; diff --git a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp index b17adf3..b029761 100644 --- a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp +++ b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp @@ -12,25 +12,25 @@ ** ****************************************************************************/ -#include "mpixmapdata.h" -#include "mextensions.h" -#include "../private/qimage_p.h" -#include "../private/qwindowsurface_gl_p.h" -#include "../private/qeglcontext_p.h" -#include "../private/qapplication_p.h" -#include "../private/qgraphicssystem_runtime_p.h" +#include "qmeegopixmapdata.h" +#include "qmeegoextensions.h" +#include +#include +#include +#include +#include static EGLint preserved_image_attribs[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE }; -QHash MPixmapData::sharedImagesMap; +QHash QMeeGoPixmapData::sharedImagesMap; /* Public */ -MPixmapData::MPixmapData() : QGLPixmapData(QPixmapData::PixmapType) +QMeeGoPixmapData::QMeeGoPixmapData() : QGLPixmapData(QPixmapData::PixmapType) { } -void MPixmapData::fromTexture(GLuint textureId, int w, int h, bool alpha) +void QMeeGoPixmapData::fromTexture(GLuint textureId, int w, int h, bool alpha) { resize(w, h); texture()->id = textureId; @@ -38,36 +38,36 @@ void MPixmapData::fromTexture(GLuint textureId, int w, int h, bool alpha) softImage = QImage(); } -QImage MPixmapData::toImage() const +QImage QMeeGoPixmapData::toImage() const { return softImage; } -void MPixmapData::fromImage(const QImage &image, - Qt::ImageConversionFlags flags) +void QMeeGoPixmapData::fromImage(const QImage &image, + Qt::ImageConversionFlags flags) { void *rawResource = static_cast (((QImage &) image).data_ptr()->data); if (sharedImagesMap.contains(rawResource)) { - MImageInfo *info = sharedImagesMap.value(rawResource); + QMeeGoImageInfo *info = sharedImagesMap.value(rawResource); fromEGLSharedImage(info->handle, image); } else { // This should *never* happen since the graphics system should never - // create a MPixmapData for an origin that doesn't contain a raster + // create a QMeeGoPixmapData for an origin that doesn't contain a raster // image we know about. But... - qWarning("MPixmapData::fromImage called on non-know resource. Falling back..."); + qWarning("QMeeGoPixmapData::fromImage called on non-know resource. Falling back..."); QGLPixmapData::fromImage(image, flags); } } -void MPixmapData::fromEGLSharedImage(Qt::HANDLE handle, const QImage &si) +void QMeeGoPixmapData::fromEGLSharedImage(Qt::HANDLE handle, const QImage &si) { if (si.isNull()) qFatal("Trying to build pixmap with an empty/null softimage!"); QGLShareContextScope ctx(qt_gl_share_widget()->context()); - MExtensions::ensureInitialized(); + QMeeGoExtensions::ensureInitialized(); bool textureIsBound = false; GLuint newTextureId; @@ -87,8 +87,8 @@ void MPixmapData::fromEGLSharedImage(Qt::HANDLE handle, const QImage &si) if (err == GL_NO_ERROR) textureIsBound = true; - MExtensions::eglQueryImageNOK(QEgl::display(), image, EGL_WIDTH, &newWidth); - MExtensions::eglQueryImageNOK(QEgl::display(), image, EGL_HEIGHT, &newHeight); + QMeeGoExtensions::eglQueryImageNOK(QEgl::display(), image, EGL_WIDTH, &newWidth); + QMeeGoExtensions::eglQueryImageNOK(QEgl::display(), image, EGL_HEIGHT, &newHeight); QEgl::eglDestroyImageKHR(QEgl::display(), image); glFinish(); @@ -100,18 +100,18 @@ void MPixmapData::fromEGLSharedImage(Qt::HANDLE handle, const QImage &si) fromTexture(newTextureId, newWidth, newHeight, (si.hasAlphaChannel() && const_cast(si).data_ptr()->checkForAlphaPixels())); softImage = si; - MPixmapData::registerSharedImage(handle, softImage); + QMeeGoPixmapData::registerSharedImage(handle, softImage); } else { qWarning("Failed to create a texture from a shared image!"); glDeleteTextures(1, &newTextureId); } } -Qt::HANDLE MPixmapData::imageToEGLSharedImage(const QImage &image) +Qt::HANDLE QMeeGoPixmapData::imageToEGLSharedImage(const QImage &image) { QGLShareContextScope ctx(qt_gl_share_widget()->context()); - MExtensions::ensureInitialized(); + QMeeGoExtensions::ensureInitialized(); glFinish(); QGLPixmapData pixmapData(QPixmapData::PixmapType); @@ -126,7 +126,7 @@ Qt::HANDLE MPixmapData::imageToEGLSharedImage(const QImage &image) glFinish(); if (eglimage) { - EGLNativeSharedImageTypeNOK handle = MExtensions::eglCreateSharedImageNOK(QEgl::display(), eglimage, NULL); + EGLNativeSharedImageTypeNOK handle = QMeeGoExtensions::eglCreateSharedImageNOK(QEgl::display(), eglimage, NULL); QEgl::eglDestroyImageKHR(QEgl::display(), eglimage); glFinish(); return (Qt::HANDLE) handle; @@ -136,7 +136,7 @@ Qt::HANDLE MPixmapData::imageToEGLSharedImage(const QImage &image) } } -void MPixmapData::updateFromSoftImage() +void QMeeGoPixmapData::updateFromSoftImage() { m_dirty = true; m_source = softImage; @@ -146,28 +146,28 @@ void MPixmapData::updateFromSoftImage() qWarning("Ooops, looks like softImage changed dimensions since last updated! Corruption ahead?!"); } -bool MPixmapData::destroyEGLSharedImage(Qt::HANDLE h) +bool QMeeGoPixmapData::destroyEGLSharedImage(Qt::HANDLE h) { QGLShareContextScope ctx(qt_gl_share_widget()->context()); - MExtensions::ensureInitialized(); + QMeeGoExtensions::ensureInitialized(); - QMutableHashIterator i(sharedImagesMap); + QMutableHashIterator i(sharedImagesMap); while (i.hasNext()) { i.next(); if (i.value()->handle == h) i.remove(); } - return MExtensions::eglDestroySharedImageNOK(QEgl::display(), (EGLNativeSharedImageTypeNOK) h); + return QMeeGoExtensions::eglDestroySharedImageNOK(QEgl::display(), (EGLNativeSharedImageTypeNOK) h); } -void MPixmapData::registerSharedImage(Qt::HANDLE handle, const QImage &si) +void QMeeGoPixmapData::registerSharedImage(Qt::HANDLE handle, const QImage &si) { void *raw = static_cast (((QImage) si).data_ptr()->data); - MImageInfo *info; + QMeeGoImageInfo *info; if (! sharedImagesMap.contains(raw)) { - info = new MImageInfo; + info = new QMeeGoImageInfo; info->handle = handle; info->rawFormat = si.format(); sharedImagesMap.insert(raw, info); diff --git a/src/plugins/graphicssystems/meego/qmeegopixmapdata.h b/src/plugins/graphicssystems/meego/qmeegopixmapdata.h index ae4ed6b..5fb7f9f 100644 --- a/src/plugins/graphicssystems/meego/qmeegopixmapdata.h +++ b/src/plugins/graphicssystems/meego/qmeegopixmapdata.h @@ -15,18 +15,18 @@ #ifndef MPIXMAPDATA_H #define MPIXMAPDATA_H -#include "../private/qpixmapdata_gl_p.h" +#include -struct MImageInfo +struct QMeeGoImageInfo { Qt::HANDLE handle; QImage::Format rawFormat; }; -class MPixmapData : public QGLPixmapData +class QMeeGoPixmapData : public QGLPixmapData { public: - MPixmapData(); + QMeeGoPixmapData(); void fromTexture(GLuint textureId, int w, int h, bool alpha); virtual void fromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage); @@ -35,9 +35,9 @@ public: virtual void updateFromSoftImage(); QImage softImage; - - static QHash sharedImagesMap; - + + static QHash sharedImagesMap; + static Qt::HANDLE imageToEGLSharedImage(const QImage &image); static bool destroyEGLSharedImage(Qt::HANDLE h); static void registerSharedImage(Qt::HANDLE handle, const QImage &si); -- cgit v0.12