Home · All Classes · Main Classes · Deprecated
Static Public Member Functions

MGraphicsSystemHelper Class Reference

List of all members.

Static Public Member Functions

static void switchToSoftwareRendering (MWindow *window)
static void pixmapFromImage (PixmapCacheEntry *cacheEntry, const QImage &image, const QString &uniqueKey, const QSize &requestedSize)
static QPixmap pixmapFromHandle (const MPixmapHandle &pixmapHandle, void **addr, int *numBytes)
static bool isRunningNativeGraphicssystem ()
static bool isRunningMeegoCompatibleGraphicssystem ()

Detailed Description

Definition at line 27 of file mgraphicssystemhelper.h.


Member Function Documentation

bool MGraphicsSystemHelper::isRunningMeegoCompatibleGraphicssystem (  )  [static]

Definition at line 247 of file mgraphicssystemhelper.cpp.

                                                                   {
#ifdef HAVE_MEEGOGRAPHICSSYSTEM
    if (QMeeGoGraphicsSystemHelper::isRunningRuntime()) {
        if (QMeeGoGraphicsSystemHelper::runningGraphicsSystemName() == QLatin1String("meego") ||
            QMeeGoGraphicsSystemHelper::runningGraphicsSystemName() == QLatin1String("raster")) {
            return true;
        }
    }
    return false;
#else
    return false;
#endif
}

bool MGraphicsSystemHelper::isRunningNativeGraphicssystem (  )  [static]

Returns true when the native graphicssystem is used.

If there is no support for the MeeGo graphicssystem true is always returned.

Definition at line 239 of file mgraphicssystemhelper.cpp.

                                                          {
#ifdef HAVE_MEEGOGRAPHICSSYSTEM
    return QMeeGoGraphicsSystemHelper::runningGraphicsSystemName() == QLatin1String("native");
#else
    return true;
#endif
}

QPixmap MGraphicsSystemHelper::pixmapFromHandle ( const MPixmapHandle pixmapHandle,
void **  addr,
int *  numBytes 
) [static]

Definition at line 205 of file mgraphicssystemhelper.cpp.

                                                                                                             {
#ifndef HAVE_MEEGOGRAPHICSSYSTEM
    Q_UNUSED(addr);
    Q_UNUSED(numBytes);
#else
    if (MGraphicsSystemHelper::isRunningMeegoCompatibleGraphicssystem() && pixmapHandle.eglHandle) {
        int fd = shm_open(qPrintable(pixmapHandle.shmHandle), O_RDONLY, 0444);
        if (fd == -1) {
            qFatal("Failed to open shared memory: %s, %s", strerror(errno), qPrintable(pixmapHandle.shmHandle));
        }

        *addr = mmap(0, pixmapHandle.numBytes, PROT_READ, MAP_SHARED, fd, 0);
        *numBytes = pixmapHandle.numBytes;
        close(fd);
        if (*addr == (void *) -1) {
            qFatal("mmap failed : %s", strerror(errno));
        }

        QImage image((const uchar *)*addr, pixmapHandle.size.width(), pixmapHandle.size.height(), pixmapHandle.format);

        return QMeeGoGraphicsSystemHelper::pixmapFromEGLSharedImage(pixmapHandle.eglHandle, image);

    } else
#endif // HAVE_MEEGOGRAPHICSSYSTEM
    {
        return createXPixmapFromHandle(pixmapHandle);
    }
}

Here is the call graph for this function:

void MGraphicsSystemHelper::pixmapFromImage ( PixmapCacheEntry *  cacheEntry,
const QImage image,
const QString uniqueKey,
const QSize requestedSize 
) [static]

Definition at line 174 of file mgraphicssystemhelper.cpp.

{
#ifndef HAVE_MEEGOGRAPHICSSYSTEM
    Q_UNUSED(uniqueKey);
    Q_UNUSED(requestedSize);
#else
    if (QMeeGoGraphicsSystemHelper::isRunningMeeGo()) {
        QImage imageCopy;
        // the only supported formats are ARGB32_Premultiplied and RGB32 as this are the formats
        // the Qt raster engine can use without a conversion
        // TODO: once the MeeGo graphicssystem allows QImage::Format_RGB32 we can also allow it
        if (image.format() != QImage::Format_ARGB32_Premultiplied /*&& image.format() != QImage::Format_RGB32*/) {
            imageCopy = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
        } else {
            imageCopy = image;
        }

        fillHandleFromImage(&cacheEntry->handle, imageCopy);
        allocateSharedMemory(&cacheEntry->handle, imageCopy, uniqueKey, requestedSize);
    } else if (QMeeGoGraphicsSystemHelper::runningGraphicsSystemName() == QLatin1String("native"))
#endif // HAVE_MEEGO_GRAPHICSSYSTEM
    {
        createXPixmapFromImage(cacheEntry, image);
    }
#ifdef HAVE_MEEGOGRAPHICSSYSTEM
    else {
        qFatal("Only the MeeGo and the native graphicssystem are supported to create shareable pixmaps.");
    }
#endif // HAVE_MEEGO_GRAPHICSSYSTEM
}

Here is the call graph for this function:

void MGraphicsSystemHelper::switchToSoftwareRendering ( MWindow window  )  [static]

Definition at line 112 of file mgraphicssystemhelper.cpp.

{
#ifdef HAVE_MEEGOGRAPHICSSYSTEM
    if (QMeeGoGraphicsSystemHelper::isRunningMeeGo()) {
        mDebug("MGraphicsSystemHelper") << "switching to raster";
        QMeeGoGraphicsSystemHelper::switchToRaster();
    } else
#endif
    {
        window->setViewport(new QWidget());
        mDebug("MGraphicsSystemHelper") << "switching to QWidget";
    }
}


Copyright © 2010 Nokia Corporation Generated on Thu Nov 4 2010 18:14:25 (PDT)
Doxygen 1.7.1
MeeGo Touch