summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/gfxdrivers/directfb/directfb.pro38
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp4
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp108
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h17
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp103
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp35
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h6
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp109
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h12
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp63
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h3
-rw-r--r--src/plugins/graphicssystems/graphicssystems.pro1
-rw-r--r--src/plugins/graphicssystems/trace/main.cpp69
-rw-r--r--src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp133
-rw-r--r--src/plugins/graphicssystems/trace/qgraphicssystem_trace_p.h71
-rw-r--r--src/plugins/graphicssystems/trace/trace.pro12
-rw-r--r--src/plugins/imageformats/gif/qgifhandler.cpp4
-rw-r--r--src/plugins/qpluginbase.pri2
18 files changed, 601 insertions, 189 deletions
diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro
index c5da3df..d397050 100644
--- a/src/plugins/gfxdrivers/directfb/directfb.pro
+++ b/src/plugins/gfxdrivers/directfb/directfb.pro
@@ -1,47 +1,15 @@
TARGET = qdirectfbscreen
include(../../qpluginbase.pri)
+include($$QT_SOURCE_TREE/src/gui/embedded/directfb.pri)
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers
-# These defines might be necessary if your DirectFB driver doesn't
-# support all of the DirectFB API.
-#
-#DEFINES += QT_DIRECTFB_WINDOW_AS_CURSOR
-#DEFINES += QT_NO_DIRECTFB_IMAGEPROVIDER
-#DEFINES += QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
-#DEFINES += QT_DIRECTFB_IMAGECACHE
-#DEFINES += QT_NO_DIRECTFB_WM
-#DEFINES += QT_NO_DIRECTFB_LAYER
-#DEFINES += QT_NO_DIRECTFB_PALETTE
-#DEFINES += QT_NO_DIRECTFB_PREALLOCATED
-#DEFINES += QT_NO_DIRECTFB_MOUSE
-#DEFINES += QT_NO_DIRECTFB_KEYBOARD
-#DEFINES += QT_DIRECTFB_TIMING
-#DEFINES += QT_NO_DIRECTFB_OPAQUE_DETECTION
-#DIRECTFB_DRAWINGOPERATIONS=DRAW_RECTS|DRAW_LINES|DRAW_IMAGE|DRAW_PIXMAP|DRAW_TILED_PIXMAP|STROKE_PATH|DRAW_PATH|DRAW_POINTS|DRAW_ELLIPSE|DRAW_POLYGON|DRAW_TEXT|FILL_PATH|FILL_RECT|DRAW_COLORSPANS
-#DEFINES += \"QT_DIRECTFB_WARN_ON_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\"
-#DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\"
-
target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers
INSTALLS += target
-HEADERS = qdirectfbscreen.h \
- qdirectfbwindowsurface.h \
- qdirectfbpaintengine.h \
- qdirectfbpaintdevice.h \
- qdirectfbpixmap.h \
- qdirectfbkeyboard.h \
- qdirectfbmouse.h
-
-SOURCES = qdirectfbscreen.cpp \
- qdirectfbscreenplugin.cpp \
- qdirectfbwindowsurface.cpp \
- qdirectfbpaintengine.cpp \
- qdirectfbpaintdevice.cpp \
- qdirectfbpixmap.cpp \
- qdirectfbkeyboard.cpp \
- qdirectfbmouse.cpp
+SOURCES += qdirectfbscreenplugin.cpp
QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB
LIBS += $$QT_LIBS_DIRECTFB
DEFINES += $$QT_DEFINES_DIRECTFB
+contains(gfx-plugins, directfb):DEFINES += QT_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
index 2fb1520..896f512 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
@@ -121,8 +121,8 @@ QDirectFBMouseHandlerPrivate::QDirectFBMouseHandlerPrivate(QDirectFBMouseHandler
return;
}
- int flags = ::fcntl(fd, F_GETFL, 0);
- ::fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+ int flags = fcntl(fd, F_GETFL, 0);
+ fcntl(fd, F_SETFL, flags | O_NONBLOCK);
// DirectFB seems to assume that the mouse always starts centered
prevPoint = QPoint(screen->deviceWidth() / 2, screen->deviceHeight() / 2);
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
index 106de0d..b82433d 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
@@ -48,14 +48,26 @@
QT_BEGIN_NAMESPACE
QDirectFBPaintDevice::QDirectFBPaintDevice(QDirectFBScreen *scr)
- : QCustomRasterPaintDevice(0), dfbSurface(0), lockedImage(0), screen(scr),
- bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0),
- imageFormat(QImage::Format_Invalid)
-{}
+ : QCustomRasterPaintDevice(0), dfbSurface(0), screen(scr),
+ bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0), imageFormat(QImage::Format_Invalid)
+{
+#ifdef QT_DIRECTFB_SUBSURFACE
+ subSurface = 0;
+ syncPending = false;
+#endif
+}
QDirectFBPaintDevice::~QDirectFBPaintDevice()
{
- delete lockedImage;
+ if (QDirectFBScreen::instance()) {
+ unlockSurface();
+#ifdef QT_DIRECTFB_SUBSURFACE
+ releaseSubSurface();
+#endif
+ if (dfbSurface) {
+ screen->releaseDFBSurface(dfbSurface);
+ }
+ }
delete engine;
}
@@ -64,30 +76,58 @@ IDirectFBSurface *QDirectFBPaintDevice::directFBSurface() const
return dfbSurface;
}
-void QDirectFBPaintDevice::lockDirectFB(DFBSurfaceLockFlags flags)
+bool QDirectFBPaintDevice::lockSurface(DFBSurfaceLockFlags lockFlags)
{
- if (!(lockFlgs & flags)) {
- if (lockFlgs)
- unlockDirectFB();
- mem = QDirectFBScreen::lockSurface(dfbSurface, flags, &bpl);
+ if (lockFlgs && (lockFlags & ~lockFlgs))
+ unlockSurface();
+ if (!mem) {
+ Q_ASSERT(dfbSurface);
+#ifdef QT_DIRECTFB_SUBSURFACE
+ if (!subSurface) {
+ DFBResult result;
+ subSurface = screen->getSubSurface(dfbSurface, QRect(), QDirectFBScreen::TrackSurface, &result);
+ if (result != DFB_OK || !subSurface) {
+ DirectFBError("Couldn't create sub surface", result);
+ return false;
+ }
+ }
+ IDirectFBSurface *surface = subSurface;
+#else
+ IDirectFBSurface *surface = dfbSurface;
+#endif
+ Q_ASSERT(surface);
+ mem = QDirectFBScreen::lockSurface(surface, lockFlags, &bpl);
+ lockFlgs = lockFlags;
Q_ASSERT(mem);
+ Q_ASSERT(bpl > 0);
const QSize s = size();
- lockedImage = new QImage(mem, s.width(), s.height(), bpl,
- QDirectFBScreen::getImageFormat(dfbSurface));
- lockFlgs = flags;
+ lockedImage = QImage(mem, s.width(), s.height(), bpl,
+ QDirectFBScreen::getImageFormat(dfbSurface));
+ return true;
}
+#ifdef QT_DIRECTFB_SUBSURFACE
+ if (syncPending) {
+ syncPending = false;
+ screen->waitIdle();
+ }
+#endif
+ return false;
}
-void QDirectFBPaintDevice::unlockDirectFB()
+void QDirectFBPaintDevice::unlockSurface()
{
- if (!lockedImage || !QDirectFBScreen::instance())
- return;
-
- dfbSurface->Unlock(dfbSurface);
- delete lockedImage;
- lockedImage = 0;
- mem = 0;
- lockFlgs = DFBSurfaceLockFlags(0);
+ if (QDirectFBScreen::instance() && lockFlgs) {
+#ifdef QT_DIRECTFB_SUBSURFACE
+ IDirectFBSurface *surface = subSurface;
+#else
+ IDirectFBSurface *surface = dfbSurface;
+#endif
+ if (surface) {
+ surface->Unlock(surface);
+ lockFlgs = static_cast<DFBSurfaceLockFlags>(0);
+ mem = 0;
+ }
+ }
}
void *QDirectFBPaintDevice::memory() const
@@ -102,17 +142,10 @@ QImage::Format QDirectFBPaintDevice::format() const
int QDirectFBPaintDevice::bytesPerLine() const
{
- if (bpl == -1) {
- // Can only get the stride when we lock the surface
- Q_ASSERT(!lockedImage);
- QDirectFBPaintDevice* that = const_cast<QDirectFBPaintDevice*>(this);
- that->lockDirectFB(DSLF_READ|DSLF_WRITE);
- Q_ASSERT(bpl != -1);
- }
+ Q_ASSERT(!mem || bpl != -1);
return bpl;
}
-
QSize QDirectFBPaintDevice::size() const
{
int w, h;
@@ -142,8 +175,8 @@ int QDirectFBPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
case QPaintDevice::PdmDepth:
return QDirectFBScreen::depth(imageFormat);
case QPaintDevice::PdmNumColors: {
- if (lockedImage)
- return lockedImage->numColors();
+ if (!lockedImage.isNull())
+ return lockedImage.numColors();
DFBResult result;
IDirectFBPalette *palette = 0;
@@ -171,6 +204,17 @@ QPaintEngine *QDirectFBPaintDevice::paintEngine() const
return engine;
}
+#ifdef QT_DIRECTFB_SUBSURFACE
+void QDirectFBPaintDevice::releaseSubSurface()
+{
+ Q_ASSERT(QDirectFBScreen::instance());
+ if (subSurface) {
+ screen->releaseDFBSurface(subSurface);
+ subSurface = 0;
+ }
+}
+#endif
+
QT_END_NAMESPACE
#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
index f5de44b..adb80e2 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
@@ -62,8 +62,8 @@ public:
virtual IDirectFBSurface *directFBSurface() const;
- void lockDirectFB(DFBSurfaceLockFlags lock);
- void unlockDirectFB();
+ bool lockSurface(DFBSurfaceLockFlags lockFlags);
+ void unlockSurface();
// Reimplemented from QCustomRasterPaintDevice:
void *memory() const;
@@ -73,7 +73,6 @@ public:
int metric(QPaintDevice::PaintDeviceMetric metric) const;
DFBSurfaceLockFlags lockFlags() const { return lockFlgs; }
QPaintEngine *paintEngine() const;
-
protected:
QDirectFBPaintDevice(QDirectFBScreen *scr);
inline int dotsPerMeterX() const
@@ -84,17 +83,21 @@ protected:
{
return (screen->deviceHeight() * 1000) / screen->physicalHeight();
}
-protected:
+
IDirectFBSurface *dfbSurface;
- QImage *lockedImage;
+#ifdef QT_DIRECTFB_SUBSURFACE
+ void releaseSubSurface();
+ IDirectFBSurface *subSurface;
+ friend class QDirectFBPaintEnginePrivate;
+ bool syncPending;
+#endif
+ QImage lockedImage;
QDirectFBScreen *screen;
int bpl;
DFBSurfaceLockFlags lockFlgs;
uchar *mem;
QDirectFBPaintEngine *engine;
QImage::Format imageFormat;
-private:
- Q_DISABLE_COPY(QDirectFBPaintDevice);
};
QT_END_NAMESPACE
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 9a9553e..6535d65 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -93,6 +93,7 @@ public:
inline void lock();
inline void unlock();
+ static inline void unlock(QDirectFBPaintDevice *device);
inline bool isSimpleBrush(const QBrush &brush) const;
@@ -109,7 +110,7 @@ public:
#endif
void prepareForBlit(bool alpha);
-private:
+
IDirectFBSurface *surface;
bool antialiased;
@@ -129,7 +130,6 @@ private:
QRect currentClip;
QDirectFBPaintEngine *q;
- friend class QDirectFBPaintEngine;
};
class SurfaceCache
@@ -222,6 +222,7 @@ template <class T>
static inline void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface);
#define CLIPPED_PAINT(operation) { \
+ d->unlock(); \
DFBRegion clipRegion; \
switch (d->clipType) { \
case QDirectFBPaintEnginePrivate::NoClip: \
@@ -269,6 +270,7 @@ bool QDirectFBPaintEngine::begin(QPaintDevice *device)
QPixmapData *data = static_cast<QPixmap*>(device)->pixmapData();
Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
QDirectFBPixmapData *dfbPixmapData = static_cast<QDirectFBPixmapData*>(data);
+ QDirectFBPaintEnginePrivate::unlock(dfbPixmapData);
d->dfbDevice = static_cast<QDirectFBPaintDevice*>(dfbPixmapData);
}
@@ -409,14 +411,13 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount)
QRasterPaintEngine::drawRects(rects, rectCount);
return;
}
- d->unlock();
if (brush != Qt::NoBrush) {
d->setDFBColor(brush.color());
- CLIPPED_PAINT(::fillRects<QRect>(rects, rectCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(QT_PREPEND_NAMESPACE(fillRects<QRect>)(rects, rectCount, state()->matrix, d->surface));
}
if (pen != Qt::NoPen) {
d->setDFBColor(pen.color());
- CLIPPED_PAINT(::drawRects<QRect>(rects, rectCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects<QRect>)(rects, rectCount, state()->matrix, d->surface));
}
}
@@ -438,14 +439,13 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount)
QRasterPaintEngine::drawRects(rects, rectCount);
return;
}
- d->unlock();
if (brush != Qt::NoBrush) {
d->setDFBColor(brush.color());
- CLIPPED_PAINT(::fillRects<QRectF>(rects, rectCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(fillRects<QRectF>(rects, rectCount, state()->matrix, d->surface));
}
if (pen != Qt::NoPen) {
d->setDFBColor(pen.color());
- CLIPPED_PAINT(::drawRects<QRectF>(rects, rectCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects<QRectF>)(rects, rectCount, state()->matrix, d->surface));
}
}
@@ -464,9 +464,8 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount)
const QPen &pen = state()->pen;
if (pen != Qt::NoPen) {
- d->unlock();
d->setDFBColor(pen.color());
- CLIPPED_PAINT(::drawLines<QLine>(lines, lineCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines<QLine>)(lines, lineCount, state()->matrix, d->surface));
}
}
@@ -485,9 +484,8 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount)
const QPen &pen = state()->pen;
if (pen != Qt::NoPen) {
- d->unlock();
d->setDFBColor(pen.color());
- CLIPPED_PAINT(::drawLines<QLineF>(lines, lineCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines<QLineF>)(lines, lineCount, state()->matrix, d->surface));
}
}
@@ -533,7 +531,6 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image,
return;
}
#if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE
- d->unlock();
bool release;
IDirectFBSurface *imgSurface = d->getSurface(image, &release);
d->prepareForBlit(QDirectFBScreen::hasAlphaChannel(imgSurface));
@@ -561,25 +558,25 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap,
RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
d->lock();
QRasterPaintEngine::drawPixmap(r, pixmap, sr);
- } else if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
- || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
- || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
- || (state()->renderHints & QPainter::SmoothPixmapTransform
- && state()->matrix.mapRect(r).size() != sr.size())) {
- RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
- const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(DSLF_READ);
- d->lock();
- QRasterPaintEngine::drawImage(r, *img, sr);
} else {
- d->unlock();
- d->prepareForBlit(pixmap.hasAlphaChannel());
QPixmapData *data = pixmap.pixmapData();
Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
- dfbData->unlockDirectFB();
- IDirectFBSurface *s = dfbData->directFBSurface();
-
- CLIPPED_PAINT(d->blit(r, s, sr));
+ if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
+ || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
+ || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
+ || (state()->renderHints & QPainter::SmoothPixmapTransform
+ && state()->matrix.mapRect(r).size() != sr.size())) {
+ RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
+ const QImage *img = dfbData->buffer();
+ d->lock();
+ QRasterPaintEngine::drawImage(r, *img, sr);
+ } else {
+ QDirectFBPaintEnginePrivate::unlock(dfbData);
+ d->prepareForBlit(pixmap.hasAlphaChannel());
+ IDirectFBSurface *s = dfbData->directFBSurface();
+ CLIPPED_PAINT(d->blit(r, s, sr));
+ }
}
}
@@ -602,14 +599,16 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r,
|| d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
|| (state()->renderHints & QPainter::SmoothPixmapTransform && state()->matrix.isScaling())) {
RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset);
- const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(DSLF_READ);
+ QPixmapData *pixmapData = pixmap.pixmapData();
+ Q_ASSERT(pixmapData->classId() == QPixmapData::DirectFBClass);
+ QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(pixmapData);
+ const QImage *img = dfbData->buffer();
d->lock();
QRasterPixmapData *data = new QRasterPixmapData(QPixmapData::PixmapType);
data->fromImage(*img, Qt::AutoColor);
const QPixmap pix(data);
QRasterPaintEngine::drawTiledPixmap(r, pix, offset);
} else {
- d->unlock();
CLIPPED_PAINT(d->drawTiledPixmap(r, pixmap, offset));
}
}
@@ -708,7 +707,6 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
const QColor color = brush.color();
if (!color.isValid())
return;
- d->unlock();
d->setDFBColor(color);
const QRect r = state()->matrix.mapRect(rect).toRect();
CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()));
@@ -725,7 +723,6 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
if (texture.pixmapData()->classId() != QPixmapData::DirectFBClass)
break;
- d->unlock();
CLIPPED_PAINT(d->drawTiledPixmap(rect, texture, rect.topLeft() - state()->brushOrigin));
return; }
default:
@@ -749,7 +746,6 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color)
d->lock();
QRasterPaintEngine::fillRect(rect, color);
} else {
- d->unlock();
d->setDFBColor(color);
const QRect r = state()->matrix.mapRect(rect).toRect();
CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()));
@@ -811,8 +807,7 @@ void QDirectFBPaintEnginePrivate::lock()
// lock so we need to call the base implementation of prepare so
// it updates its rasterBuffer to point to the new buffer address.
Q_ASSERT(dfbDevice);
- if (dfbDevice->lockFlags() != (DSLF_WRITE|DSLF_READ)) {
- dfbDevice->lockDirectFB(DSLF_READ|DSLF_WRITE);
+ if (dfbDevice->lockSurface(DSLF_READ|DSLF_WRITE)) {
prepare(dfbDevice);
}
}
@@ -820,7 +815,21 @@ void QDirectFBPaintEnginePrivate::lock()
void QDirectFBPaintEnginePrivate::unlock()
{
Q_ASSERT(dfbDevice);
- dfbDevice->unlockDirectFB();
+#ifdef QT_DIRECTFB_SUBSURFACE
+ dfbDevice->syncPending = true;
+#else
+ QDirectFBPaintEnginePrivate::unlock(dfbDevice);
+#endif
+}
+
+void QDirectFBPaintEnginePrivate::unlock(QDirectFBPaintDevice *device)
+{
+#ifdef QT_NO_DIRECTFB_SUBSURFACE
+ Q_ASSERT(device);
+ device->unlockSurface();
+#else
+ Q_UNUSED(device);
+#endif
}
void QDirectFBPaintEnginePrivate::setTransform(const QTransform &transform)
@@ -895,10 +904,10 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m
case QPainter::CompositionMode_Plus:
surface->SetPorterDuff(surface, DSPD_ADD);
break;
-#endif
case QPainter::CompositionMode_Xor:
surface->SetPorterDuff(surface, DSPD_XOR);
break;
+#endif
default:
compositionModeStatus = 0;
break;
@@ -1031,7 +1040,7 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix
QPixmapData *data = pixmap.pixmapData();
Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
- dfbData->unlockDirectFB();
+ QDirectFBPaintEnginePrivate::unlock(dfbData);
const QSize pixmapSize = dfbData->size();
IDirectFBSurface *sourceSurface = dfbData->directFBSurface();
if (transform.isScaling()) {
@@ -1040,8 +1049,8 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix
offset.ry() *= transform.m22();
const QSizeF mappedSize(pixmapSize.width() * transform.m11(), pixmapSize.height() * transform.m22());
- qreal y = ::fixCoord(destinationRect.y(), mappedSize.height(), offset.y());
- const qreal startX = ::fixCoord(destinationRect.x(), mappedSize.width(), offset.x());
+ qreal y = fixCoord(destinationRect.y(), mappedSize.height(), offset.y());
+ const qreal startX = fixCoord(destinationRect.x(), mappedSize.width(), offset.x());
while (y <= destinationRect.bottom()) {
qreal x = startX;
while (x <= destinationRect.right()) {
@@ -1052,8 +1061,8 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix
y += mappedSize.height();
}
} else {
- qreal y = ::fixCoord(destinationRect.y(), pixmapSize.height(), offset.y());
- const qreal startX = ::fixCoord(destinationRect.x(), pixmapSize.width(), offset.x());
+ qreal y = fixCoord(destinationRect.y(), pixmapSize.height(), offset.y());
+ const qreal startX = fixCoord(destinationRect.x(), pixmapSize.width(), offset.x());
int horizontal = qMax(1, destinationRect.width() / pixmapSize.width()) + 1;
if (startX != destinationRect.x())
++horizontal;
@@ -1165,12 +1174,12 @@ template <class T>
static inline void drawLines(const T *lines, int n, const QTransform &transform, IDirectFBSurface *surface)
{
if (n == 1) {
- const QLine l = ::map(transform, lines[0]);
+ const QLine l = map(transform, lines[0]);
surface->DrawLine(surface, l.x1(), l.y1(), l.x2(), l.y2());
} else {
QVarLengthArray<DFBRegion, 32> lineArray(n);
for (int i=0; i<n; ++i) {
- const QLine l = ::map(transform, lines[i]);
+ const QLine l = map(transform, lines[i]);
lineArray[i].x1 = l.x1();
lineArray[i].y1 = l.y1();
lineArray[i].x2 = l.x2();
@@ -1184,12 +1193,12 @@ template <class T>
static inline void fillRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface)
{
if (n == 1) {
- const QRect r = ::mapRect(transform, rects[0]);
+ const QRect r = mapRect(transform, rects[0]);
surface->FillRectangle(surface, r.x(), r.y(), r.width(), r.height());
} else {
QVarLengthArray<DFBRectangle, 32> rectArray(n);
for (int i=0; i<n; ++i) {
- const QRect r = ::mapRect(transform, rects[i]);
+ const QRect r = mapRect(transform, rects[i]);
rectArray[i].x = r.x();
rectArray[i].y = r.y();
rectArray[i].w = r.width();
@@ -1203,7 +1212,7 @@ template <class T>
static inline void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface)
{
for (int i=0; i<n; ++i) {
- const QRect r = ::mapRect(transform, rects[i]);
+ const QRect r = mapRect(transform, rects[i]);
surface->DrawRectangle(surface, r.x(), r.y(), r.width(), r.height());
}
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index 0717020..6550683 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -64,9 +64,6 @@ QDirectFBPixmapData::QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixe
QDirectFBPixmapData::~QDirectFBPixmapData()
{
- unlockDirectFB();
- if (dfbSurface && QDirectFBScreen::instance())
- screen->releaseDFBSurface(dfbSurface);
}
void QDirectFBPixmapData::resize(int width, int height)
@@ -167,7 +164,7 @@ static bool checkForAlphaPixels(const QImage &img)
bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img)
{
#ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION
- return ::checkForAlphaPixels(img);
+ return checkForAlphaPixels(img);
#else
return img.hasAlphaChannel();
#endif
@@ -375,9 +372,13 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect)
QPixmapData::copy(data, rect);
return;
}
- unlockDirectFB();
const QDirectFBPixmapData *otherData = static_cast<const QDirectFBPixmapData*>(data);
+#ifdef QT_NO_DIRECTFB_SUBSURFACE
+ if (otherData->lockFlags()) {
+ const_cast<QDirectFBPixmapData*>(otherData)->unlockSurface();
+ }
+#endif
IDirectFBSurface *src = otherData->directFBSurface();
alpha = data->hasAlphaChannel();
imageFormat = (alpha
@@ -405,6 +406,7 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect)
h = rect.height();
d = otherData->d;
is_null = (w <= 0 || h <= 0);
+ unlockSurface();
DFBResult result = dfbSurface->Blit(dfbSurface, src, &blitRect, 0, 0);
#if (Q_DIRECTFB_VERSION >= 0x010000)
dfbSurface->ReleaseSource(dfbSurface);
@@ -443,7 +445,7 @@ void QDirectFBPixmapData::fill(const QColor &color)
alpha = (color.alpha() < 255);
- if (alpha && ::isOpaqueFormat(imageFormat)) {
+ if (alpha && isOpaqueFormat(imageFormat)) {
QSize size;
dfbSurface->GetSize(dfbSurface, &size.rwidth(), &size.rheight());
screen->releaseDFBSurface(dfbSurface);
@@ -465,18 +467,21 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform,
Qt::TransformationMode mode) const
{
QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this);
+#ifdef QT_NO_DIRECTFB_SUBSURFACE
+ if (lockFlags())
+ that->unlockSurface();
+#endif
+
if (!dfbSurface || transform.type() != QTransform::TxScale
|| mode != Qt::FastTransformation)
{
const QImage *image = that->buffer();
Q_ASSERT(image);
const QImage transformed = image->transformed(transform, mode);
- that->unlockDirectFB();
QDirectFBPixmapData *data = new QDirectFBPixmapData(screen, QPixmapData::PixmapType);
data->fromImage(transformed, Qt::AutoColor);
return QPixmap(data);
}
- that->unlockDirectFB();
const QSize size = transform.mapRect(QRect(0, 0, w, h)).size();
if (size.isEmpty())
@@ -556,14 +561,12 @@ QPaintEngine *QDirectFBPixmapData::paintEngine() const
QImage *QDirectFBPixmapData::buffer()
{
- lockDirectFB(DSLF_READ|DSLF_WRITE);
- return lockedImage;
-}
-
-QImage * QDirectFBPixmapData::buffer(DFBSurfaceLockFlags lockFlags)
-{
- lockDirectFB(lockFlags);
- return lockedImage;
+ if (!lockFlgs) {
+ lockSurface(DSLF_READ|DSLF_WRITE);
+ }
+ Q_ASSERT(lockFlgs);
+ Q_ASSERT(!lockedImage.isNull());
+ return &lockedImage;
}
void QDirectFBPixmapData::invalidate()
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
index 7b4ae47..5d3a2f6 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
@@ -81,11 +81,9 @@ public:
virtual QImage toImage() const;
virtual QPaintEngine *paintEngine() const;
virtual QImage *buffer();
- virtual int metric(QPaintDevice::PaintDeviceMetric m) const {return QDirectFBPaintDevice::metric(m);}
-
- QImage *buffer(DFBSurfaceLockFlags lockFlags);
-
// Pure virtual in QPixmapData, so re-implement here and delegate to QDirectFBPaintDevice
+ virtual int metric(QPaintDevice::PaintDeviceMetric m) const { return QDirectFBPaintDevice::metric(m); }
+
inline QImage::Format pixelFormat() const { return imageFormat; }
static bool hasAlphaChannel(const QImage &img);
inline bool hasAlphaChannel() const { return alpha; }
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 59fa191..5651506 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -319,14 +319,38 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc,
if (options & TrackSurface) {
d_ptr->allocatedSurfaces.insert(newSurface);
-
- //qDebug("Created a new DirectFB surface at %p. New count = %d",
- // newSurface, d_ptr->allocatedSurfaces.count());
}
return newSurface;
}
+#ifdef QT_DIRECTFB_SUBSURFACE
+IDirectFBSurface *QDirectFBScreen::getSubSurface(IDirectFBSurface *surface,
+ const QRect &rect,
+ SurfaceCreationOptions options,
+ DFBResult *resultPtr)
+{
+ Q_ASSERT(!(options & NoPreallocated));
+ Q_ASSERT(surface);
+ DFBResult res;
+ DFBResult &result = (resultPtr ? *resultPtr : res);
+ IDirectFBSurface *subSurface = 0;
+ if (rect.isNull()) {
+ result = surface->GetSubSurface(surface, 0, &subSurface);
+ } else {
+ const DFBRectangle subRect = { rect.x(), rect.y(), rect.width(), rect.height() };
+ result = surface->GetSubSurface(surface, &subRect, &subSurface);
+ }
+ if (result != DFB_OK) {
+ DirectFBError("Can't get sub surface", result);
+ } else if (options & TrackSurface) {
+ d_ptr->allocatedSurfaces.insert(subSurface);
+ }
+ return subSurface;
+}
+#endif
+
+
void QDirectFBScreen::releaseDFBSurface(IDirectFBSurface *surface)
{
Q_ASSERT(QDirectFBScreen::instance());
@@ -999,9 +1023,9 @@ static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface)
dev.name, dev.vendor, dev.driver.name, dev.driver.major,
dev.driver.minor, dev.driver.vendor, DFB_PIXELFORMAT_INDEX(pixelFormat),
QDirectFBScreen::getImageFormat(primarySurface), dev.acceleration_mask,
- ::flagDescriptions(dev.acceleration_mask, accelerationDescriptions).constData(),
- dev.blitting_flags, ::flagDescriptions(dev.blitting_flags, blitDescriptions).constData(),
- dev.drawing_flags, ::flagDescriptions(dev.drawing_flags, drawDescriptions).constData(),
+ flagDescriptions(dev.acceleration_mask, accelerationDescriptions).constData(),
+ dev.blitting_flags, flagDescriptions(dev.blitting_flags, blitDescriptions).constData(),
+ dev.drawing_flags, flagDescriptions(dev.drawing_flags, drawDescriptions).constData(),
(dev.video_memory >> 10));
}
#endif
@@ -1067,7 +1091,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
#ifdef QT_DIRECTFB_IMAGECACHE
int imageCacheSize = 4 * 1024 * 1024; // 4 MB
- ::setIntOption(displayArgs, QLatin1String("imagecachesize"), &imageCacheSize);
+ setIntOption(displayArgs, QLatin1String("imagecachesize"), &imageCacheSize);
QDirectFBPaintEngine::initImageCache(imageCacheSize);
#endif
@@ -1168,6 +1192,33 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
lstep = 0;
size = 0;
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreen::connect: "
+ "Unable to get screen!", result);
+ return false;
+ }
+ const QString qws_size = qgetenv("QWS_SIZE");
+ if (!qws_size.isEmpty()) {
+ QRegExp rx(QLatin1String("(\\d+)x(\\d+)"));
+ if (!rx.exactMatch(qws_size)) {
+ qWarning("QDirectFBScreen::connect: Can't parse QWS_SIZE=\"%s\"", qPrintable(qws_size));
+ } else {
+ int *ints[2] = { &w, &h };
+ for (int i=0; i<2; ++i) {
+ *ints[i] = rx.cap(i + 1).toInt();
+ if (*ints[i] <= 0) {
+ qWarning("QDirectFBScreen::connect: %s is not a positive integer",
+ qPrintable(rx.cap(i + 1)));
+ w = h = 0;
+ break;
+ }
+ }
+ }
+ }
+
+ setIntOption(displayArgs, QLatin1String("width"), &w);
+ setIntOption(displayArgs, QLatin1String("height"), &h);
+
#ifndef QT_NO_DIRECTFB_LAYER
result = d_ptr->dfb->GetDisplayLayer(d_ptr->dfb, DLID_PRIMARY,
&d_ptr->dfbLayer);
@@ -1180,19 +1231,26 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
#else
result = d_ptr->dfb->GetScreen(d_ptr->dfb, 0, &d_ptr->dfbScreen);
#endif
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreen::connect: "
- "Unable to get screen!", result);
- return false;
- }
- result = d_ptr->dfbScreen->GetSize(d_ptr->dfbScreen, &w, &h);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreen::connect: "
- "Unable to get screen size!", result);
+
+ if (w <= 0 || h <= 0) {
+#ifdef QT_NO_DIRECTFB_WM
+ result = d_ptr->primarySurface->GetSize(d_ptr->primarySurface, &w, &h);
+#elif (Q_DIRECTFB_VERSION >= 0x010000)
+ result = d_ptr->dfbScreen->GetSize(d_ptr->dfbScreen, &w, &h);
+#else
+ qWarning("QDirectFBScreen::connect: DirectFB versions prior to 1.0 do not offer a way\n"
+ "query the size of the primary surface in windowed mode. You have to specify\n"
+ "the size of the display using QWS_SIZE=[0-9]x[0-9] or\n"
+ "QWS_DISPLAY=directfb:width=[0-9]:height=[0-9]");
return false;
+#endif
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreen::connect: "
+ "Unable to get screen size!", result);
+ return false;
+ }
}
- ::setIntOption(displayArgs, QLatin1String("width"), &w);
- ::setIntOption(displayArgs, QLatin1String("height"), &h);
+
dw = w;
dh = h;
@@ -1200,8 +1258,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
Q_ASSERT(dw != 0 && dh != 0);
physWidth = physHeight = -1;
- ::setIntOption(displayArgs, QLatin1String("mmWidth"), &physWidth);
- ::setIntOption(displayArgs, QLatin1String("mmHeight"), &physHeight);
+ setIntOption(displayArgs, QLatin1String("mmWidth"), &physWidth);
+ setIntOption(displayArgs, QLatin1String("mmHeight"), &physHeight);
const int dpi = 72;
if (physWidth < 0)
physWidth = qRound(dw * 25.4 / dpi);
@@ -1432,7 +1490,7 @@ void QDirectFBScreen::solidFill(const QColor &color, const QRegion &region)
color.red(), color.green(), color.blue(),
color.alpha());
const int n = region.numRects();
- if (n > 1) {
+ if (n == 1) {
const QRect r = region.boundingRect();
d_ptr->primarySurface->FillRectangle(d_ptr->primarySurface, r.x(), r.y(), r.width(), r.height());
} else {
@@ -1527,6 +1585,11 @@ void QDirectFBScreen::setDirectFBImageProvider(IDirectFBImageProvider *provider)
}
#endif
+void QDirectFBScreen::waitIdle()
+{
+ d_ptr->dfb->WaitIdle(d_ptr->dfb);
+}
+
IDirectFBSurface * QDirectFBScreen::surfaceForWidget(const QWidget *widget, QRect *rect) const
{
Q_ASSERT(widget);
@@ -1540,6 +1603,7 @@ IDirectFBSurface * QDirectFBScreen::surfaceForWidget(const QWidget *widget, QRec
return 0;
}
+#ifdef QT_DIRECTFB_SUBSURFACE
IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, const QRect &area) const
{
Q_ASSERT(widget);
@@ -1550,7 +1614,7 @@ IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, co
if (!area.isNull())
rect &= area.translated(widget->mapTo(widget->window(), QPoint(0, 0)));
if (!rect.isNull()) {
- const DFBRectangle subRect = {rect.x(), rect.y(), rect.width(), rect.height() };
+ const DFBRectangle subRect = { rect.x(), rect.y(), rect.width(), rect.height() };
const DFBResult result = surface->GetSubSurface(surface, &subRect, &subSurface);
if (result != DFB_OK) {
DirectFBError("QDirectFBScreen::subSurface(): Can't get sub surface", result);
@@ -1559,6 +1623,7 @@ IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, co
}
return subSurface;
}
+#endif
QT_END_NAMESPACE
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index e74adb1..0ce7a53 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -54,6 +54,9 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
+#if !defined QT_NO_DIRECTFB_SUBSURFACE && !defined QT_DIRECTFB_SUBSURFACE
+#define QT_DIRECTFB_SUBSURFACE
+#endif
#if !defined QT_NO_DIRECTFB_LAYER && !defined QT_DIRECTFB_LAYER
#define QT_DIRECTFB_LAYER
#endif
@@ -166,8 +169,11 @@ public:
return static_cast<QDirectFBScreen*>(inst);
}
+ void waitIdle();
IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const;
+#ifdef QT_DIRECTFB_SUBSURFACE
IDirectFBSurface *subSurfaceForWidget(const QWidget *widget, const QRect &area = QRect()) const;
+#endif
IDirectFB *dfb();
#ifdef QT_NO_DIRECTFB_WM
@@ -199,6 +205,12 @@ public:
IDirectFBSurface *createDFBSurface(DFBSurfaceDescription desc,
SurfaceCreationOptions options,
DFBResult *result);
+#ifdef QT_DIRECTFB_SUBSURFACE
+ IDirectFBSurface *getSubSurface(IDirectFBSurface *surface,
+ const QRect &rect,
+ SurfaceCreationOptions options,
+ DFBResult *result);
+#endif
void flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags,
const QRegion &region, const QPoint &offset);
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index 73a6dd7..9e0691d 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -100,6 +100,13 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect
QDirectFBWindowSurface::~QDirectFBWindowSurface()
{
+ releaseSurface();
+ // these are not tracked by QDirectFBScreen so we don't want QDirectFBPaintDevice to release it
+}
+
+bool QDirectFBWindowSurface::isValid() const
+{
+ return true;
}
#ifdef QT_DIRECTFB_WM
@@ -111,15 +118,8 @@ void QDirectFBWindowSurface::raise()
sibling->raise();
}
}
-#endif
-
-bool QDirectFBWindowSurface::isValid() const
-{
- return true;
-}
-#ifndef QT_NO_DIRECTFB_WM
-void QDirectFBWindowSurface::createWindow()
+void QDirectFBWindowSurface::createWindow(const QRect &rect)
{
IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer();
if (!layer)
@@ -127,8 +127,12 @@ void QDirectFBWindowSurface::createWindow()
DFBWindowDescription description;
description.caps = DWCAPS_NODECORATION|DWCAPS_DOUBLEBUFFER;
- description.flags = DWDESC_CAPS|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT;
+ description.flags = DWDESC_CAPS|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT|DWDESC_HEIGHT|DWDESC_WIDTH|DWDESC_POSX|DWDESC_POSY;
+ description.posx = rect.x();
+ description.posy = rect.y();
+ description.width = rect.width();
+ description.height = rect.height();
description.surface_caps = DSCAPS_NONE;
if (screen->directFBFlags() & QDirectFBScreen::VideoOnly)
description.surface_caps |= DSCAPS_VIDEOONLY;
@@ -148,10 +152,8 @@ void QDirectFBWindowSurface::createWindow()
dfbWindow->GetSurface(dfbWindow, &dfbSurface);
updateFormat();
}
-#endif // QT_NO_DIRECTFB_WM
-#ifndef QT_NO_DIRECTFB_WM
-static DFBResult setGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const QRect &rect)
+static DFBResult setWindowGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const QRect &rect)
{
DFBResult result = DFB_OK;
const bool isMove = old.isEmpty() || rect.topLeft() != old.topLeft();
@@ -178,7 +180,7 @@ static DFBResult setGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const
#endif
return result;
}
-#endif
+#endif // QT_NO_DIRECTFB_WM
void QDirectFBWindowSurface::setGeometry(const QRect &rect)
{
@@ -205,11 +207,12 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect)
const QRect oldRect = geometry();
DFBResult result = DFB_OK;
// If we're in a resize, the surface shouldn't be locked
- Q_ASSERT((lockedImage == 0) || (rect.size() == geometry().size()));
#ifdef QT_DIRECTFB_WM
- if (!dfbWindow)
- createWindow();
- ::setGeometry(dfbWindow, oldRect, rect);
+ if (!dfbWindow) {
+ createWindow(rect);
+ } else {
+ setWindowGeometry(dfbWindow, oldRect, rect);
+ }
#else
if (mode == Primary) {
if (dfbSurface && dfbSurface != primarySurface)
@@ -271,12 +274,12 @@ bool QDirectFBWindowSurface::scroll(const QRegion &region, int dx, int dy)
return false;
dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX);
if (region.numRects() == 1) {
- ::scrollSurface(dfbSurface, region.boundingRect(), dx, dy);
+ scrollSurface(dfbSurface, region.boundingRect(), dx, dy);
} else {
const QVector<QRect> rects = region.rects();
const int n = rects.size();
for (int i=0; i<n; ++i) {
- ::scrollSurface(dfbSurface, rects.at(i), dx, dy);
+ scrollSurface(dfbSurface, rects.at(i), dx, dy);
}
}
return true;
@@ -420,7 +423,9 @@ void QDirectFBWindowSurface::beginPaint(const QRegion &)
void QDirectFBWindowSurface::endPaint(const QRegion &)
{
- unlockDirectFB();
+#ifdef QT_NO_DIRECTFB_SUBSURFACE
+ unlockSurface();
+#endif
}
IDirectFBSurface *QDirectFBWindowSurface::directFBSurface() const
@@ -457,6 +462,24 @@ void QDirectFBWindowSurface::updateFormat()
imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid;
}
+void QDirectFBWindowSurface::releaseSurface()
+{
+ if (dfbSurface) {
+#ifdef QT_NO_DIRECTFB_SUBSURFACE
+ if (lockFlgs)
+ unlockSurface();
+#endif
+#ifdef QT_NO_DIRECTFB_WM
+ Q_ASSERT(screen->primarySurface());
+ if (dfbSurface != screen->primarySurface())
+#endif
+
+ dfbSurface->Release(dfbSurface);
+ dfbSurface = 0;
+ }
+}
+
+
QT_END_NAMESPACE
#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
index ca76613..7ae9bfe 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
@@ -95,10 +95,11 @@ public:
IDirectFBSurface *directFBSurface() const;
private:
void updateFormat();
+ void releaseSurface();
QDirectFBWindowSurface *sibling;
#ifdef QT_DIRECTFB_WM
- void createWindow();
+ void createWindow(const QRect &rect);
IDirectFBWindow *dfbWindow;
#else
enum Mode {
diff --git a/src/plugins/graphicssystems/graphicssystems.pro b/src/plugins/graphicssystems/graphicssystems.pro
index bfdec6a..14e3cfc 100644
--- a/src/plugins/graphicssystems/graphicssystems.pro
+++ b/src/plugins/graphicssystems/graphicssystems.pro
@@ -1,4 +1,5 @@
TEMPLATE = subdirs
+SUBDIRS += trace
contains(QT_CONFIG, opengl):SUBDIRS += opengl
contains(QT_CONFIG, openvg):contains(QT_CONFIG, egl):SUBDIRS += openvg
diff --git a/src/plugins/graphicssystems/trace/main.cpp b/src/plugins/graphicssystems/trace/main.cpp
new file mode 100644
index 0000000..908e3f4
--- /dev/null
+++ b/src/plugins/graphicssystems/trace/main.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <private/qgraphicssystemplugin_p.h>
+#include "qgraphicssystem_trace_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QTraceGraphicsSystemPlugin : public QGraphicsSystemPlugin
+{
+public:
+ QStringList keys() const;
+ QGraphicsSystem *create(const QString&);
+};
+
+QStringList QTraceGraphicsSystemPlugin::keys() const
+{
+ return QStringList(QLatin1String("Trace"));
+}
+
+QGraphicsSystem* QTraceGraphicsSystemPlugin::create(const QString& system)
+{
+ if (system.toLower() == QLatin1String("trace"))
+ return new QTraceGraphicsSystem;
+
+ return 0;
+}
+
+Q_EXPORT_PLUGIN2(trace, QTraceGraphicsSystemPlugin)
+
+QT_END_NAMESPACE
diff --git a/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp b/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp
new file mode 100644
index 0000000..36a8df1
--- /dev/null
+++ b/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgraphicssystem_trace_p.h"
+#include <private/qpixmap_raster_p.h>
+#include <private/qpaintbuffer_p.h>
+#include <private/qwindowsurface_raster_p.h>
+
+#include <QFile>
+#include <QPainter>
+#include <QtDebug>
+
+QT_BEGIN_NAMESPACE
+
+class QTraceWindowSurface : public QRasterWindowSurface
+{
+public:
+ QTraceWindowSurface(QWidget *widget);
+ ~QTraceWindowSurface();
+
+ QPaintDevice *paintDevice();
+ void endPaint(const QRegion &rgn);
+
+private:
+ QPaintBuffer *buffer;
+
+ QFile *outputFile;
+ QDataStream *out;
+
+ int frameId;
+};
+
+QTraceWindowSurface::QTraceWindowSurface(QWidget *widget)
+ : QRasterWindowSurface(widget)
+ , buffer(0)
+ , outputFile(0)
+ , out(0)
+ , frameId(0)
+{
+}
+
+QTraceWindowSurface::~QTraceWindowSurface()
+{
+ delete out;
+ delete outputFile;
+}
+
+QPaintDevice *QTraceWindowSurface::paintDevice()
+{
+ if (!buffer) {
+ buffer = new QPaintBuffer;
+ buffer->setBoundingRect(geometry());
+ }
+ return buffer;
+}
+
+void QTraceWindowSurface::endPaint(const QRegion &rgn)
+{
+ if (!out) {
+ outputFile = new QFile(QString(QLatin1String("qtgraphics-%0.trace")).arg((qulonglong)window()->winId()));
+ if (outputFile->open(QIODevice::WriteOnly))
+ out = new QDataStream(outputFile);
+ }
+
+ QPainter p(QRasterWindowSurface::paintDevice());
+ buffer->draw(&p);
+ p.end();
+
+ if (out) {
+ *out << frameId++;
+ *out << (qulonglong)window()->winId();
+ *out << geometry();
+ *out << rgn;
+ *out << *buffer;
+ }
+
+ delete buffer;
+ buffer = 0;
+}
+
+QTraceGraphicsSystem::QTraceGraphicsSystem()
+{
+}
+
+QPixmapData *QTraceGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
+{
+ return new QRasterPixmapData(type);
+}
+
+QWindowSurface *QTraceGraphicsSystem::createWindowSurface(QWidget *widget) const
+{
+ return new QTraceWindowSurface(widget);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/graphicssystems/trace/qgraphicssystem_trace_p.h b/src/plugins/graphicssystems/trace/qgraphicssystem_trace_p.h
new file mode 100644
index 0000000..5deafc9
--- /dev/null
+++ b/src/plugins/graphicssystems/trace/qgraphicssystem_trace_p.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGRAPHICSSYSTEM_TRACE_P_H
+#define QGRAPHICSSYSTEM_TRACE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qgraphicssystem_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QTraceGraphicsSystem : public QGraphicsSystem
+{
+public:
+ QTraceGraphicsSystem();
+
+ QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
+ QWindowSurface *createWindowSurface(QWidget *widget) const;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/graphicssystems/trace/trace.pro b/src/plugins/graphicssystems/trace/trace.pro
new file mode 100644
index 0000000..d548a6c
--- /dev/null
+++ b/src/plugins/graphicssystems/trace/trace.pro
@@ -0,0 +1,12 @@
+TARGET = qtracegraphicssystem
+include(../../qpluginbase.pri)
+
+QT += network
+
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems
+
+SOURCES = main.cpp qgraphicssystem_trace.cpp
+
+target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems
+INSTALLS += target
+INCLUDEPATH += ../../../3rdparty/harfbuzz/src
diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp
index de985d8..0f6a349 100644
--- a/src/plugins/imageformats/gif/qgifhandler.cpp
+++ b/src/plugins/imageformats/gif/qgifhandler.cpp
@@ -234,7 +234,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
#define LM(l, m) (((m)<<8)|l)
digress = false;
- int initial = length;
+ const int initial = length;
while (!digress && length) {
length--;
unsigned char ch=*buffer++;
@@ -333,7 +333,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
sheight = newtop + newheight;
QImage::Format format = trans_index >= 0 ? QImage::Format_ARGB32 : QImage::Format_RGB32;
- if (image->isNull() || (image->size() != QSize(swidth, sheight)) || image->format() != format) {
+ if (image->isNull()) {
(*image) = QImage(swidth, sheight, format);
memset(image->bits(), 0, image->numBytes());
diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri
index 10563c1..a3abc98 100644
--- a/src/plugins/qpluginbase.pri
+++ b/src/plugins/qpluginbase.pri
@@ -1,6 +1,6 @@
TEMPLATE = lib
isEmpty(QT_MAJOR_VERSION) {
- VERSION=4.5.3
+ VERSION=4.6.0
} else {
VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
}