diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2010-09-06 07:54:59 (GMT) |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2010-09-10 10:44:55 (GMT) |
commit | dc61fc45601000626169409443fdeac6a3cd31af (patch) | |
tree | a62e4919e4637f2152be5483b73098cb4e2fe426 /src/plugins/graphicssystems | |
parent | 5d6ceabf3aa9d07f31f0a06d20b76c122973d3b9 (diff) | |
download | Qt-dc61fc45601000626169409443fdeac6a3cd31af.zip Qt-dc61fc45601000626169409443fdeac6a3cd31af.tar.gz Qt-dc61fc45601000626169409443fdeac6a3cd31af.tar.bz2 |
Fixed compilation and API of meego graphics system.
Diffstat (limited to 'src/plugins/graphicssystems')
10 files changed, 153 insertions, 148 deletions
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 <private/qeglcontext_p.h> +#include <private/qpixmapdata_gl_p.h> -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 <EGL/eglext.h> #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> -#include "../private/qgl_p.h" -#include "../private/qeglcontext_p.h" -#include "../private/qpixmapdata_gl_p.h" +#include <private/qgl_p.h> +#include <private/qeglcontext_p.h> +#include <private/qpixmapdata_gl_p.h> /* 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 <QDebug> -#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 <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 "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 <QRasterPixmapData *> (origin); void *rawResource = static_cast <void *> (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<QImage &>(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 <private/qgraphicssystem_p.h> -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 <QDebug> -#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 <private/qgraphicssystemplugin_p.h> -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 <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> static EGLint preserved_image_attribs[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE }; -QHash <void*, MImageInfo*> MPixmapData::sharedImagesMap; +QHash <void*, QMeeGoImageInfo*> 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 <void *> (((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<QImage &>(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 <void*, MImageInfo*> i(sharedImagesMap); + QMutableHashIterator <void*, QMeeGoImageInfo*> 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 <void *> (((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 <private/qpixmapdata_gl_p.h> -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 <void*, MImageInfo*> sharedImagesMap; - + + static QHash <void*, QMeeGoImageInfo*> sharedImagesMap; + static Qt::HANDLE imageToEGLSharedImage(const QImage &image); static bool destroyEGLSharedImage(Qt::HANDLE h); static void registerSharedImage(Qt::HANDLE handle, const QImage &si); |