diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/codecs/jp/qjiscodec.cpp | 2 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 4 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | 5 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp | 67 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | 25 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 4 | ||||
-rw-r--r-- | src/plugins/s60/s60pluginbase.pri | 3 |
7 files changed, 65 insertions, 45 deletions
diff --git a/src/plugins/codecs/jp/qjiscodec.cpp b/src/plugins/codecs/jp/qjiscodec.cpp index a495dae..3e4d5a0 100644 --- a/src/plugins/codecs/jp/qjiscodec.cpp +++ b/src/plugins/codecs/jp/qjiscodec.cpp @@ -41,7 +41,7 @@ // Most of the code here was originally written by Serika Kurusugawa, // a.k.a. Junji Takagi, and is included in Qt with the author's permission -// and the grateful thanks of the Trolltech team. +// and the grateful thanks of the Qt team. /*! \class QJisCodec \reentrant diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index eccd1f3..e63a628 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -532,7 +532,7 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image, d->unlock(); bool release; IDirectFBSurface *imgSurface = d->getSurface(image, &release); - d->prepareForBlit(QDirectFBScreen::hasAlpha(imgSurface)); + d->prepareForBlit(QDirectFBScreen::hasAlphaChannel(imgSurface)); CLIPPED_PAINT(d->blit(r, imgSurface, sr)); if (release) { #if (Q_DIRECTFB_VERSION >= 0x010000) @@ -1133,7 +1133,7 @@ IDirectFBSurface *SurfaceCache::getSurface(const uint *buf, int size) clear(); const DFBSurfaceDescription description = QDirectFBScreen::getSurfaceDescription(buf, size); - surface = QDirectFBScreen::instance()->createDFBSurface(description, QDirectFBScreen::TrackSurface); + surface = QDirectFBScreen::instance()->createDFBSurface(description, QDirectFBScreen::TrackSurface, 0); if (!surface) qWarning("QDirectFBPaintEngine: SurfaceCache: Unable to create surface"); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 697885f..7cacdd9 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -403,9 +403,14 @@ QImage * QDirectFBPixmapData::buffer(DFBSurfaceLockFlags lockFlags) void QDirectFBPixmapData::invalidate() { + if (dfbSurface) { + screen->releaseDFBSurface(dfbSurface); + dfbSurface = 0; + } setSerialNumber(0); alpha = false; d = w = h = 0; + is_null = true; format = QImage::Format_Invalid; } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 33fd1b8..bb614a2 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -150,7 +150,7 @@ QDirectFBScreenPrivate::~QDirectFBScreenPrivate() dfb->Release(dfb); } -IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QImage &image, QImage::Format format, SurfaceCreationOptions options) +IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QImage &image, QImage::Format format, SurfaceCreationOptions options, DFBResult *resultPtr) { if (image.isNull()) // assert? return 0; @@ -159,7 +159,7 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QImage &image, QImage: format = QDirectFBPixmapData::hasAlphaChannel(image) ? d_ptr->alphaPixmapFormat : pixelFormat(); } if (image.format() != format) { - return createDFBSurface(image.convertToFormat(format), format, options | NoPreallocated); + return createDFBSurface(image.convertToFormat(format), format, options | NoPreallocated, resultPtr); } DFBSurfaceDescription description; @@ -179,23 +179,27 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QImage &image, QImage: description.preallocated[1].pitch = 0; } #endif - IDirectFBSurface *surface = createDFBSurface(description, options); + DFBResult result; + IDirectFBSurface *surface = createDFBSurface(description, options, &result); + if (resultPtr) + *resultPtr = result; if (!surface) { - qWarning("Couldn't create surface createDFBSurface(QImage, QImage::Format, SurfaceCreationOptions): error 1"); + DirectFBError("Couldn't create surface createDFBSurface(QImage, QImage::Format, SurfaceCreationOptions)", result); return 0; } if (doMemCopy) { - int bpl; - uchar *mem = QDirectFBScreen::lockSurface(surface, DSLF_WRITE, &bpl); + int bplDFB; + uchar *mem = QDirectFBScreen::lockSurface(surface, DSLF_WRITE, &bplDFB); if (mem) { - const int h = image.height(); - const int w = image.bytesPerLine(); - // ### Could probably do a single memcpy here since I know - // ### image.bytesPerLine() == bpl == (image.width() * - // ### image.depth() / 8) - for (int i = 0; i < h; ++i) { - memcpy(mem, image.scanLine(i), w); - mem += bpl; + const int height = image.height(); + const int bplQt = image.bytesPerLine(); + if (bplQt == bplDFB && bplQt == (image.width() * image.depth() / 8)) { + memcpy(mem, image.bits(), image.numBytes()); + } else { + for (int i=0; i<height; ++i) { + memcpy(mem, image.scanLine(i), bplQt); + mem += bplDFB; + } } surface->Unlock(surface); } @@ -209,15 +213,14 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QImage &image, QImage: IDirectFBSurface *QDirectFBScreen::copyDFBSurface(IDirectFBSurface *src, QImage::Format format, - SurfaceCreationOptions options) + SurfaceCreationOptions options, + DFBResult *result) { Q_ASSERT(src); QSize size; src->GetSize(src, &size.rwidth(), &size.rheight()); - IDirectFBSurface *surface = createDFBSurface(size, format, options); - DFBSurfacePixelFormat dspf; - src->GetPixelFormat(src, &dspf); - DFBSurfaceBlittingFlags flags = QDirectFBScreen::hasAlpha(dspf) + IDirectFBSurface *surface = createDFBSurface(size, format, options, result); + DFBSurfaceBlittingFlags flags = QDirectFBScreen::hasAlphaChannel(surface) ? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX; if (flags & DSBLIT_BLEND_ALPHACHANNEL) @@ -233,7 +236,8 @@ IDirectFBSurface *QDirectFBScreen::copyDFBSurface(IDirectFBSurface *src, IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QSize &size, QImage::Format format, - SurfaceCreationOptions options) + SurfaceCreationOptions options, + DFBResult *result) { DFBSurfaceDescription desc; memset(&desc, 0, sizeof(DFBSurfaceDescription)); @@ -242,12 +246,14 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QSize &size, return 0; desc.width = size.width(); desc.height = size.height(); - return createDFBSurface(desc, options); + return createDFBSurface(desc, options, result); } -IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc, SurfaceCreationOptions options) +IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc, SurfaceCreationOptions options, DFBResult *resultPtr) { - DFBResult result = DFB_OK; + DFBResult tmp; + DFBResult &result = (resultPtr ? *resultPtr : tmp); + result = DFB_OK; IDirectFBSurface *newSurface = 0; if (!d_ptr->dfb) { @@ -570,13 +576,14 @@ void QDirectFBScreenCursor::set(const QImage &image, int hotx, int hoty) cursor = image.convertToFormat(screen->alphaPixmapFormat()); size = cursor.size(); hotspot = QPoint(hotx, hoty); + DFBResult result = DFB_OK; IDirectFBSurface *surface = screen->createDFBSurface(cursor, screen->alphaPixmapFormat(), - QDirectFBScreen::DontTrackSurface); + QDirectFBScreen::DontTrackSurface, &result); if (!surface) { - qWarning("QDirectFBScreenCursor::set: Unable to create surface"); + DirectFBError("QDirectFBScreenCursor::set: Unable to create surface", result); return; } - DFBResult result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); + result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); if (result != DFB_OK) { DirectFBError("QDirectFBScreenCursor::show: " "Unable to set cooperative level", result); @@ -934,7 +941,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec) } // We don't track the primary surface as it's released in disconnect - d_ptr->primarySurface = createDFBSurface(description, DontTrackSurface); + d_ptr->primarySurface = createDFBSurface(description, DontTrackSurface, &result); if (!d_ptr->primarySurface) { DirectFBError("QDirectFBScreen: error creating primary surface", result); @@ -945,7 +952,11 @@ bool QDirectFBScreen::connect(const QString &displaySpec) #else description.flags = DSDESC_WIDTH|DSDESC_HEIGHT; description.width = description.height = 1; - surface = createDFBSurface(description, DontTrackSurface); + surface = createDFBSurface(description, DontTrackSurface, &result); + if (!surface) { + DirectFBError("QDirectFBScreen: error creating surface", result); + return false; + } #endif // Work out what format we're going to use for surfaces with an alpha channel QImage::Format pixelFormat = QDirectFBScreen::getImageFormat(surface); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index b66696e..4cae076 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -74,6 +74,9 @@ QT_MODULE(Gui) #if !defined QT_NO_DIRECTFB_OPAQUE_DETECTION && !defined QT_DIRECTFB_OPAQUE_DETECTION #define QT_DIRECTFB_OPAQUE_DETECTION #endif +#if defined QT_NO_DIRECTFB_LAYER && defined QT_DIRECTFB_WM +#error QT_NO_DIRECTFB_LAYER requires QT_NO_DIRECTFB_WM +#endif #define Q_DIRECTFB_VERSION ((DIRECTFB_MAJOR_VERSION << 16) | (DIRECTFB_MINOR_VERION << 8) | DIRECTFB_MICRO_VERSION) @@ -149,13 +152,16 @@ public: Q_DECLARE_FLAGS(SurfaceCreationOptions, SurfaceCreationOption); IDirectFBSurface *createDFBSurface(const QImage &image, QImage::Format format, - SurfaceCreationOptions options); + SurfaceCreationOptions options, + DFBResult *result = 0); IDirectFBSurface *createDFBSurface(const QSize &size, QImage::Format format, - SurfaceCreationOptions options); + SurfaceCreationOptions options, + DFBResult *result = 0); IDirectFBSurface *copyDFBSurface(IDirectFBSurface *src, QImage::Format format, - SurfaceCreationOptions options); + SurfaceCreationOptions options, + DFBResult *result = 0); void flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags, const QRegion ®ion, const QPoint &offset); void releaseDFBSurface(IDirectFBSurface *surface); @@ -170,8 +176,8 @@ public: static QImage::Format getImageFormat(IDirectFBSurface *surface); static bool initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *description, QImage::Format format); static inline bool isPremultiplied(QImage::Format format); - static inline bool hasAlpha(DFBSurfacePixelFormat format); - static inline bool hasAlpha(IDirectFBSurface *surface); + static inline bool hasAlphaChannel(DFBSurfacePixelFormat format); + static inline bool hasAlphaChannel(IDirectFBSurface *surface); QImage::Format alphaPixmapFormat() const; #ifndef QT_NO_DIRECTFB_PALETTE @@ -182,7 +188,8 @@ public: static uchar *lockSurface(IDirectFBSurface *surface, uint flags, int *bpl = 0); private: IDirectFBSurface *createDFBSurface(DFBSurfaceDescription desc, - SurfaceCreationOptions options); + SurfaceCreationOptions options, + DFBResult *result); QDirectFBScreenPrivate *d_ptr; friend class SurfaceCache; }; @@ -205,7 +212,7 @@ inline bool QDirectFBScreen::isPremultiplied(QImage::Format format) return false; } -inline bool QDirectFBScreen::hasAlpha(DFBSurfacePixelFormat format) +inline bool QDirectFBScreen::hasAlphaChannel(DFBSurfacePixelFormat format) { switch (format) { case DSPF_ARGB1555: @@ -230,12 +237,12 @@ inline bool QDirectFBScreen::hasAlpha(DFBSurfacePixelFormat format) } } -inline bool QDirectFBScreen::hasAlpha(IDirectFBSurface *surface) +inline bool QDirectFBScreen::hasAlphaChannel(IDirectFBSurface *surface) { Q_ASSERT(surface); DFBSurfacePixelFormat format; surface->GetPixelFormat(surface, &format); - return QDirectFBScreen::hasAlpha(format); + return QDirectFBScreen::hasAlphaChannel(format); } QT_END_HEADER diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 7a7a03e..7569a18 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -119,9 +119,6 @@ bool QDirectFBWindowSurface::isValid() const #ifndef QT_NO_DIRECTFB_WM void QDirectFBWindowSurface::createWindow() { -#ifdef QT_NO_DIRECTFB_LAYER -#error QT_NO_DIRECTFB_LAYER requires QT_NO_DIRECTFB_WM -#else IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer(); if (!layer) qFatal("QDirectFBWindowSurface: Unable to get primary display layer!"); @@ -147,7 +144,6 @@ void QDirectFBWindowSurface::createWindow() dfbSurface->Release(dfbSurface); dfbWindow->GetSurface(dfbWindow, &dfbSurface); -#endif } #endif // QT_NO_DIRECTFB_WM diff --git a/src/plugins/s60/s60pluginbase.pri b/src/plugins/s60/s60pluginbase.pri index 0e11c7e..29e8eb3 100644 --- a/src/plugins/s60/s60pluginbase.pri +++ b/src/plugins/s60/s60pluginbase.pri @@ -3,7 +3,8 @@ include(../../qpluginbase.pri) CONFIG -= plugin -MMP_RULES -= EXPORTUNFROZEN + +MMP_RULES += NOEXPORTLIBRARY defBlock = \ "$${LITERAL_HASH}ifdef WINSCW" \ |