Qt 4.8
Public Types | Public Functions | Static Public Functions | Static Public Variables | Static Private Functions | Static Private Attributes | List of all members
QMeeGoGraphicsSystem Class Reference

#include <qmeegographicssystem.h>

Inheritance diagram for QMeeGoGraphicsSystem:
QGraphicsSystem

Public Types

enum  SwitchPolicy { AutomaticSwitch, ManualSwitch, NoSwitch }
 

Public Functions

virtual QPixmapDatacreatePixmapData (QPixmapData::PixelType) const
 
virtual QPixmapDatacreatePixmapData (QPixmapData *origin)
 
virtual QWindowSurfacecreateWindowSurface (QWidget *widget) const
 
 QMeeGoGraphicsSystem ()
 
 ~QMeeGoGraphicsSystem ()
 
- Public Functions inherited from QGraphicsSystem
virtual QGraphicsSystemExplatformExtension ()
 
virtual ~QGraphicsSystem ()
 

Static Public Functions

static void * createFenceSync ()
 
static void destroyFenceSync (void *fenceSync)
 
static Qt::HANDLE getLiveTextureHandle (QPixmap *pixmap)
 
static QImagelockLiveTexture (QPixmap *pixmap, void *fenceSync)
 
static QPixmapDatapixmapDataFromEGLImage (Qt::HANDLE handle)
 
static QPixmapDatapixmapDataFromEGLSharedImage (Qt::HANDLE handle, const QImage &softImage)
 
static QPixmapDatapixmapDataFromLiveTextureHandle (Qt::HANDLE handle)
 
static QPixmapDatapixmapDataWithGLTexture (int w, int h)
 
static QPixmapDatapixmapDataWithNewLiveTexture (int w, int h, QImage::Format format)
 
static void registerSwitchCallback (QMeeGoSwitchCallback callback)
 
static bool releaseLiveTexture (QPixmap *pixmap, QImage *image)
 
static QString runningGraphicsSystemName ()
 
static void setSurfaceFixedSize (int width, int height)
 
static void setSurfaceScaling (int x, int y, int width, int height)
 
static void setTranslucent (bool translucent)
 
static void switchToMeeGo ()
 
static void switchToRaster ()
 
static void updateEGLSharedImagePixmap (QPixmap *pixmap)
 
static QPixmapDatawrapPixmapData (QPixmapData *pmd)
 
- Static Public Functions inherited from QGraphicsSystem
static QPixmapDatacreateDefaultPixmapData (QPixmapData::PixelType type)
 

Static Public Variables

static SwitchPolicy switchPolicy = QMeeGoGraphicsSystem::AutomaticSwitch
 

Static Private Functions

static void destroySurfaceForLiveTexturePixmap (QPixmapData *pmd)
 
static EGLSurface getSurfaceForLiveTexturePixmap (QPixmap *pixmap)
 
static bool meeGoRunning ()
 
static void triggerSwitchCallbacks (int type, const char *name)
 

Static Private Attributes

static QHash< Qt::HANDLE, QPixmap * > liveTexturePixmaps
 
static bool surfaceWasCreated = false
 
static QList< QMeeGoSwitchCallbackswitchCallbacks
 

Detailed Description

Definition at line 52 of file qmeegographicssystem.h.

Enumerations

◆ SwitchPolicy

Constructors and Destructors

◆ QMeeGoGraphicsSystem()

QMeeGoGraphicsSystem::QMeeGoGraphicsSystem ( )

Definition at line 72 of file qmeegographicssystem.cpp.

73 {
74  qDebug("Using the meego graphics system");
75 }
Q_CORE_EXPORT void qDebug(const char *,...)

◆ ~QMeeGoGraphicsSystem()

QMeeGoGraphicsSystem::~QMeeGoGraphicsSystem ( )

Definition at line 77 of file qmeegographicssystem.cpp.

78 {
79  qDebug("Meego graphics system destroyed");
81 }
Q_CORE_EXPORT void qDebug(const char *,...)
void qt_destroy_gl_share_widget()

Functions

◆ createFenceSync()

void * QMeeGoGraphicsSystem::createFenceSync ( )
static

Definition at line 363 of file qmeegographicssystem.cpp.

Referenced by qt_meego_create_fence_sync().

364 {
368 }
Q_OPENGL_EXPORT QGLWidget * qt_gl_share_widget()
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
static EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
#define EGL_SYNC_FENCE_KHR
static void ensureInitialized()
#define ctx
Definition: qgl.cpp:6094

◆ createPixmapData() [1/2]

QPixmapData * QMeeGoGraphicsSystem::createPixmapData ( QPixmapData::PixelType  type) const
virtual

Implements QGraphicsSystem.

Definition at line 217 of file qmeegographicssystem.cpp.

218 {
219  return new QRasterPixmapData(type);
220 }
int type
Definition: qmetatype.cpp:239

◆ createPixmapData() [2/2]

QPixmapData * QMeeGoGraphicsSystem::createPixmapData ( QPixmapData origin)
virtual

Reimplemented from QGraphicsSystem.

Definition at line 222 of file qmeegographicssystem.cpp.

223 {
224  // If the pixmap is a raster type...
225  // and if the pixmap pointer matches our mapping...
226  // create a shared image instead with the given handle.
227 
228  if (!origin->isNull() && origin->classId() == QPixmapData::RasterClass) {
229  QRasterPixmapData *rasterClass = static_cast <QRasterPixmapData *> (origin);
230  void *rawResource = static_cast <void *> (rasterClass->buffer()->data_ptr()->data);
231 
232  if (QMeeGoPixmapData::sharedImagesMap.contains(rawResource))
233  return new QMeeGoPixmapData();
234  }
235 
236  return new QRasterPixmapData(origin->pixelType());
237 }
PixelType pixelType() const
static QHash< void *, QMeeGoImageInfo * > sharedImagesMap
ClassId classId() const
DataPtr & data_ptr()
Definition: qimage.h:346
uchar * data
Definition: qimage_p.h:81
bool isNull() const

◆ createWindowSurface()

QWindowSurface * QMeeGoGraphicsSystem::createWindowSurface ( QWidget widget) const
virtual

Implements QGraphicsSystem.

Definition at line 200 of file qmeegographicssystem.cpp.

201 {
202  QGLWidget *shareWidget = qt_gl_share_widget();
203 
204  if (!shareWidget)
205  return new QRasterWindowSurface(widget);
206 
207  QGLShareContextScope ctx(shareWidget->context());
208 
210  switch_handler()->addWidget(widget);
211 
213  QWindowSurface *surface = new QGLWindowSurface(widget);
214  return surface;
215 }
Q_OPENGL_EXPORT QGLWidget * qt_gl_share_widget()
const QGLContext * context() const
Returns the context of this widget.
Definition: qgl.cpp:5303
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static QApplicationPrivate * instance()
static QString graphics_system_name
The QWindowSurface class provides the drawing area for top-level windows.
The QGLWidget class is a widget for rendering OpenGL graphics.
Definition: qgl.h:474
#define ctx
Definition: qgl.cpp:6094

◆ destroyFenceSync()

void QMeeGoGraphicsSystem::destroyFenceSync ( void *  fenceSync)
static

Definition at line 370 of file qmeegographicssystem.cpp.

Referenced by qt_meego_destroy_fence_sync().

371 {
375 }
Q_OPENGL_EXPORT QGLWidget * qt_gl_share_widget()
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
static void ensureInitialized()
static bool eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
#define ctx
Definition: qgl.cpp:6094

◆ destroySurfaceForLiveTexturePixmap()

static void QMeeGoGraphicsSystem::destroySurfaceForLiveTexturePixmap ( QPixmapData pmd)
staticprivate

◆ getLiveTextureHandle()

Qt::HANDLE QMeeGoGraphicsSystem::getLiveTextureHandle ( QPixmap pixmap)
static

Definition at line 357 of file qmeegographicssystem.cpp.

Referenced by qt_meego_live_texture_get_handle().

358 {
359  QMeeGoLivePixmapData *pixmapData = static_cast<QMeeGoLivePixmapData*>(pixmap->data_ptr().data());
360  return pixmapData->handle();
361 }
DataPtr & data_ptr()
Definition: qpixmap.h:297
T * data() const
Returns a pointer to the shared data object.
Definition: qshareddata.h:145

◆ getSurfaceForLiveTexturePixmap()

static EGLSurface QMeeGoGraphicsSystem::getSurfaceForLiveTexturePixmap ( QPixmap pixmap)
staticprivate

◆ lockLiveTexture()

QImage * QMeeGoGraphicsSystem::lockLiveTexture ( QPixmap pixmap,
void *  fenceSync 
)
static

Definition at line 345 of file qmeegographicssystem.cpp.

Referenced by qt_meego_live_texture_lock().

346 {
347  QMeeGoLivePixmapData *pixmapData = static_cast<QMeeGoLivePixmapData*>(pixmap->data_ptr().data());
348  return pixmapData->lock(fenceSync);
349 }
DataPtr & data_ptr()
Definition: qpixmap.h:297
QImage * lock(EGLSyncKHR fenceSync)
T * data() const
Returns a pointer to the shared data object.
Definition: qshareddata.h:145

◆ meeGoRunning()

bool QMeeGoGraphicsSystem::meeGoRunning ( )
staticprivate

Definition at line 330 of file qmeegographicssystem.cpp.

Referenced by pixmapDataFromEGLSharedImage(), and switchToMeeGo().

331 {
332  return runningGraphicsSystemName() == "meego";
333 }
static QString runningGraphicsSystemName()

◆ pixmapDataFromEGLImage()

static QPixmapData* QMeeGoGraphicsSystem::pixmapDataFromEGLImage ( Qt::HANDLE  handle)
static

◆ pixmapDataFromEGLSharedImage()

QPixmapData * QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage ( Qt::HANDLE  handle,
const QImage softImage 
)
static

Definition at line 286 of file qmeegographicssystem.cpp.

Referenced by qt_meego_pixmapdata_from_egl_shared_image().

287 {
288  if (softImage.format() != QImage::Format_ARGB32_Premultiplied &&
289  softImage.format() != QImage::Format_RGB32) {
290  qFatal("For egl shared images, the soft image has to be ARGB32_Premultiplied or RGB32");
291  return NULL;
292  }
293 
296  pmd->fromEGLSharedImage(handle, softImage);
298  } else {
300  pmd->fromImage(softImage, Qt::NoFormatConversion);
301 
302  // Make sure that the image was not converted in any way
303  if (pmd->buffer()->data_ptr()->data !=
304  const_cast<QImage &>(softImage).data_ptr()->data)
305  qFatal("Iternal misalignment of raster data detected. Prolly a QImage copy fail.");
306 
307  QMeeGoPixmapData::registerSharedImage(handle, softImage);
309  }
310 }
static void registerSharedImage(Qt::HANDLE handle, const QImage &si)
Format format() const
Returns the format of the image.
Definition: qimage.cpp:2305
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
DataPtr & data_ptr()
Definition: qimage.h:346
Q_CORE_EXPORT void qFatal(const char *,...)
void * data_ptr(const QTransform &t)
Definition: qpainter_p.h:81
uchar * data
Definition: qimage_p.h:81
virtual void fromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage)
static QPixmapData * wrapPixmapData(QPixmapData *pmd)
void fromImage(const QImage &image, Qt::ImageConversionFlags flags)

◆ pixmapDataFromLiveTextureHandle()

QPixmapData * QMeeGoGraphicsSystem::pixmapDataFromLiveTextureHandle ( Qt::HANDLE  handle)
static

Definition at line 340 of file qmeegographicssystem.cpp.

Referenced by qt_meego_pixmapdata_from_live_texture_handle().

341 {
342  return new QMeeGoLivePixmapData(handle);
343 }

◆ pixmapDataWithGLTexture()

QPixmapData * QMeeGoGraphicsSystem::pixmapDataWithGLTexture ( int  w,
int  h 
)
static

Definition at line 323 of file qmeegographicssystem.cpp.

Referenced by qt_meego_pixmapdata_with_gl_texture().

324 {
326  pmd->resize(w, h);
328 }
void resize(int width, int height)
static QPixmapData * wrapPixmapData(QPixmapData *pmd)

◆ pixmapDataWithNewLiveTexture()

QPixmapData * QMeeGoGraphicsSystem::pixmapDataWithNewLiveTexture ( int  w,
int  h,
QImage::Format  format 
)
static

Definition at line 335 of file qmeegographicssystem.cpp.

Referenced by qt_meego_pixmapdata_with_new_live_texture().

336 {
337  return new QMeeGoLivePixmapData(w, h, format);
338 }

◆ registerSwitchCallback()

void QMeeGoGraphicsSystem::registerSwitchCallback ( QMeeGoSwitchCallback  callback)
static

Definition at line 429 of file qmeegographicssystem.cpp.

Referenced by qt_meego_register_switch_callback().

430 {
432 }
static void callback(AuServer *, AuEventHandlerRec *, AuEvent *e, AuPointer p)
Definition: qsound_x11.cpp:170
static QList< QMeeGoSwitchCallback > switchCallbacks

◆ releaseLiveTexture()

bool QMeeGoGraphicsSystem::releaseLiveTexture ( QPixmap pixmap,
QImage image 
)
static

Definition at line 351 of file qmeegographicssystem.cpp.

Referenced by qt_meego_live_texture_release().

352 {
353  QMeeGoLivePixmapData *pixmapData = static_cast<QMeeGoLivePixmapData*>(pixmap->data_ptr().data());
354  return pixmapData->release(image);
355 }
DataPtr & data_ptr()
Definition: qpixmap.h:297
T * data() const
Returns a pointer to the shared data object.
Definition: qshareddata.h:145

◆ runningGraphicsSystemName()

QString QMeeGoGraphicsSystem::runningGraphicsSystemName ( )
static

Definition at line 377 of file qmeegographicssystem.cpp.

Referenced by meeGoRunning(), and switchToRaster().

378 {
380  qWarning("Querying graphics system but application not running yet!");
381  return QString();
382  }
383 
385  if (name == QLatin1String("runtime")) {
387  name = rsystem->graphicsSystemName();
388  }
389 
390  return name;
391 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static QApplicationPrivate * instance()
The QString class provides a Unicode character string.
Definition: qstring.h:83
const char * name
Q_CORE_EXPORT void qWarning(const char *,...)
static QString graphics_system_name
static QGraphicsSystem * graphics_system

◆ setSurfaceFixedSize()

void QMeeGoGraphicsSystem::setSurfaceFixedSize ( int  width,
int  height 
)
static

Definition at line 253 of file qmeegographicssystem.cpp.

Referenced by qt_meego_set_surface_fixed_size().

254 {
256  qWarning("Trying to set surface fixed size but surface already created!");
257  return;
258  }
259 
260 #ifdef QT_WAS_PATCHED
262  properties->setValue(EGL_FIXED_WIDTH_NOK, width);
263  properties->setValue(EGL_FIXED_HEIGHT_NOK, height);
265 #endif
266 }
static void setExtraWindowSurfaceCreationProps(QEglProperties *props)
Definition: qgl_egl.cpp:352
void setValue(int name, int value)
Q_CORE_EXPORT void qWarning(const char *,...)
static const QCssKnownValue properties[NumProperties - 1]
Definition: qcssparser.cpp:67
#define EGL_FIXED_HEIGHT_NOK
#define EGL_FIXED_WIDTH_NOK

◆ setSurfaceScaling()

void QMeeGoGraphicsSystem::setSurfaceScaling ( int  x,
int  y,
int  width,
int  height 
)
static

Definition at line 268 of file qmeegographicssystem.cpp.

Referenced by qt_meego_set_surface_scaling().

269 {
272 }
static bool eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surface, int x, int y, int width, int height)
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
static QEglContext * currentContext(QEgl::API api)
Definition: qegl.cpp:799
static void ensureInitialized()

◆ setTranslucent()

void QMeeGoGraphicsSystem::setTranslucent ( bool  translucent)
static

Definition at line 274 of file qmeegographicssystem.cpp.

Referenced by qt_meego_set_translucent().

275 {
277  qWarning("Trying to set translucency but surface already created!");
278  return;
279  }
280 
284 }
void setSamples(int numSamples)
Set the preferred number of samples per pixel when multisampling is enabled to numSamples.
Definition: qgl.cpp:836
void setAlpha(bool enable)
If enable is true enables the alpha buffer; otherwise disables the alpha buffer.
Definition: qgl.cpp:664
void setSampleBuffers(bool enable)
If enable is true, a GL context with multisample buffer support is picked; otherwise ignored...
Definition: qgl.cpp:812
static QGLFormat surfaceFormat
Q_CORE_EXPORT void qWarning(const char *,...)

◆ switchToMeeGo()

void QMeeGoGraphicsSystem::switchToMeeGo ( )
static

Definition at line 393 of file qmeegographicssystem.cpp.

Referenced by QMeeGoGraphicsSystemSwitchHandler::eventFilter(), QMeeGoGraphicsSystemSwitchHandler::handleMapNotify(), qt_meego_switch_to_meego(), and QMeeGoGraphicsSystemSwitchHandler::switchToMeeGo().

394 {
395  if (switchPolicy == NoSwitch || meeGoRunning())
396  return;
397 
398  if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime"))
399  qWarning("Can't switch to meego - switching only supported with 'runtime' graphics system.");
400  else {
401  triggerSwitchCallbacks(0, "meego");
402 
403  QApplication *app = static_cast<QApplication *>(QCoreApplication::instance());
404  app->setGraphicsSystem(QLatin1String("meego"));
405 
406  triggerSwitchCallbacks(1, "meego");
407  }
408 }
static void triggerSwitchCallbacks(int type, const char *name)
The QApplication class manages the GUI application&#39;s control flow and main settings.
Definition: qapplication.h:99
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static QApplicationPrivate * instance()
static SwitchPolicy switchPolicy
Q_CORE_EXPORT void qWarning(const char *,...)
static void setGraphicsSystem(const QString &)
Sets the default graphics backend to system, which will be used for on-screen widgets and QPixmaps...
static QCoreApplication * instance()
Returns a pointer to the application&#39;s QCoreApplication (or QApplication) instance.

◆ switchToRaster()

void QMeeGoGraphicsSystem::switchToRaster ( )
static

Definition at line 410 of file qmeegographicssystem.cpp.

Referenced by QMeeGoGraphicsSystemSwitchHandler::eventFilter(), qt_meego_switch_to_raster(), QMeeGoGraphicsSystemSwitchHandler::removeWidget(), and QMeeGoGraphicsSystemSwitchHandler::switchToRaster().

411 {
413  return;
414 
415  if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime"))
416  qWarning("Can't switch to raster - switching only supported with 'runtime' graphics system.");
417  else {
418  triggerSwitchCallbacks(0, "raster");
419 
420  QApplication *app = static_cast<QApplication *>(QCoreApplication::instance());
421  app->setGraphicsSystem(QLatin1String("raster"));
422 
424 
425  triggerSwitchCallbacks(1, "raster");
426  }
427 }
static void triggerSwitchCallbacks(int type, const char *name)
The QApplication class manages the GUI application&#39;s control flow and main settings.
Definition: qapplication.h:99
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static QApplicationPrivate * instance()
static SwitchPolicy switchPolicy
Q_CORE_EXPORT void qWarning(const char *,...)
static void setGraphicsSystem(const QString &)
Sets the default graphics backend to system, which will be used for on-screen widgets and QPixmaps...
static QCoreApplication * instance()
Returns a pointer to the application&#39;s QCoreApplication (or QApplication) instance.
static QString runningGraphicsSystemName()

◆ triggerSwitchCallbacks()

void QMeeGoGraphicsSystem::triggerSwitchCallbacks ( int  type,
const char *  name 
)
staticprivate

Definition at line 434 of file qmeegographicssystem.cpp.

Referenced by switchToMeeGo(), and switchToRaster().

435 {
436  for (int i = 0; i < switchCallbacks.size(); ++i)
438 }
int type
Definition: qmetatype.cpp:239
const char * name
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
static QList< QMeeGoSwitchCallback > switchCallbacks

◆ updateEGLSharedImagePixmap()

void QMeeGoGraphicsSystem::updateEGLSharedImagePixmap ( QPixmap pixmap)
static

Definition at line 312 of file qmeegographicssystem.cpp.

Referenced by qt_meego_update_egl_shared_image_pixmap().

313 {
314  QMeeGoPixmapData *pmd = (QMeeGoPixmapData *) pixmap->pixmapData();
315 
316  // Basic sanity check to make sure this is really a QMeeGoPixmapData...
317  if (pmd->classId() != QPixmapData::OpenGLClass)
318  qFatal("Trying to updated EGLSharedImage pixmap but it's not really a shared image pixmap!");
319 
320  pmd->updateFromSoftImage();
321 }
ClassId classId() const
Q_CORE_EXPORT void qFatal(const char *,...)
virtual void updateFromSoftImage()
QPixmapData * pixmapData() const
Definition: qpixmap.cpp:2277

◆ wrapPixmapData()

QPixmapData * QMeeGoGraphicsSystem::wrapPixmapData ( QPixmapData pmd)
static

Definition at line 239 of file qmeegographicssystem.cpp.

Referenced by pixmapDataFromEGLSharedImage(), and pixmapDataWithGLTexture().

240 {
242  if (name == "runtime") {
244  QRuntimePixmapData *rt = new QRuntimePixmapData(rsystem, pmd->pixelType());;
245  rt->m_data = pmd;
246  rt->readBackInfo();
247  rsystem->m_pixmapDatas << rt;
248  return rt;
249  } else
250  return pmd;
251 }
static QApplicationPrivate * instance()
The QString class provides a Unicode character string.
Definition: qstring.h:83
PixelType pixelType() const
const char * name
static QString graphics_system_name
QList< QRuntimePixmapData * > m_pixmapDatas
static QGraphicsSystem * graphics_system

Properties

◆ liveTexturePixmaps

QHash< Qt::HANDLE, QPixmap * > QMeeGoGraphicsSystem::liveTexturePixmaps
staticprivate

Definition at line 98 of file qmeegographicssystem.h.

◆ surfaceWasCreated

bool QMeeGoGraphicsSystem::surfaceWasCreated = false
staticprivate

Definition at line 97 of file qmeegographicssystem.h.

Referenced by createWindowSurface(), setSurfaceFixedSize(), and setTranslucent().

◆ switchCallbacks

QList< QMeeGoSwitchCallback > QMeeGoGraphicsSystem::switchCallbacks
staticprivate

Definition at line 99 of file qmeegographicssystem.h.

Referenced by registerSwitchCallback(), and triggerSwitchCallbacks().

◆ switchPolicy


The documentation for this class was generated from the following files: