summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-04-29 06:18:27 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-04-29 06:18:27 (GMT)
commit68999af7823e80aa049c19f332045b1fb074fb96 (patch)
treeb18b30c870157e1da14b8cf21568bb0d4684e0cf /src/plugins
parentbad50f8a2ef285aa9943291400cd322a6ec7af82 (diff)
parent822114e976d7c6644f060ac366c08c92da1a4779 (diff)
downloadQt-68999af7823e80aa049c19f332045b1fb074fb96.zip
Qt-68999af7823e80aa049c19f332045b1fb074fb96.tar.gz
Qt-68999af7823e80aa049c19f332045b1fb074fb96.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/gfxdrivers/directfb/directfb.pro37
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp41
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbmouse.h1
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp150
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp163
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h13
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp2
7 files changed, 224 insertions, 183 deletions
diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro
index 1ee9030..67f5d61 100644
--- a/src/plugins/gfxdrivers/directfb/directfb.pro
+++ b/src/plugins/gfxdrivers/directfb/directfb.pro
@@ -14,30 +14,29 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers
#DEFINES += QT_NO_DIRECTFB_KEYBOARD
#DEFINES += QT_DIRECTFB_TIMING
#DEFINES += QT_NO_DIRECTFB_OPAQUE_DETECTION
-#DEFINES += QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
-#DEFINES += QT_DIRECTFB_DISABLE_RASTERFALLBACKS
+#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 \
- qdirectfbsurface.h \
- qdirectfbpaintengine.h \
- qdirectfbpaintdevice.h \
- qdirectfbpixmap.h \
- qdirectfbkeyboard.h \
- qdirectfbmouse.h
+HEADERS = qdirectfbscreen.h \
+ qdirectfbsurface.h \
+ qdirectfbpaintengine.h \
+ qdirectfbpaintdevice.h \
+ qdirectfbpixmap.h \
+ qdirectfbkeyboard.h \
+ qdirectfbmouse.h
-SOURCES = \
- qdirectfbscreen.cpp \
- qdirectfbscreenplugin.cpp \
- qdirectfbsurface.cpp \
- qdirectfbpaintengine.cpp \
- qdirectfbpaintdevice.cpp \
- qdirectfbpixmap.cpp \
- qdirectfbkeyboard.cpp \
- qdirectfbmouse.cpp
+SOURCES = qdirectfbscreen.cpp \
+ qdirectfbscreenplugin.cpp \
+ qdirectfbsurface.cpp \
+ qdirectfbpaintengine.cpp \
+ qdirectfbpaintdevice.cpp \
+ qdirectfbpixmap.cpp \
+ qdirectfbkeyboard.cpp \
+ qdirectfbmouse.cpp
QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB
LIBS += $$QT_LIBS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
index f4d9b46..b999dd2 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
@@ -56,9 +56,7 @@ public:
QDirectFBMouseHandlerPrivate(QDirectFBMouseHandler *h);
~QDirectFBMouseHandlerPrivate();
- void suspend();
- void resume();
-
+ void setEnabled(bool on);
private:
QDirectFBMouseHandler *handler;
IDirectFBEventBuffer *eventBuffer;
@@ -130,7 +128,7 @@ QDirectFBMouseHandlerPrivate::QDirectFBMouseHandlerPrivate(QDirectFBMouseHandler
mouseNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this);
connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
- resume();
+ setEnabled(true);
}
QDirectFBMouseHandlerPrivate::~QDirectFBMouseHandlerPrivate()
@@ -139,15 +137,32 @@ QDirectFBMouseHandlerPrivate::~QDirectFBMouseHandlerPrivate()
eventBuffer->Release(eventBuffer);
}
-void QDirectFBMouseHandlerPrivate::suspend()
+void QDirectFBMouseHandlerPrivate::setEnabled(bool on)
{
- mouseNotifier->setEnabled(false);
-}
+ if (mouseNotifier->isEnabled() != on) {
+#ifndef QT_NO_DIRECTFB_LAYER
+ DFBResult result;
+ result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreenCursor::QDirectFBScreenCursor: "
+ "Unable to set cooperative level", result);
+ }
+ result = layer->EnableCursor(layer, on ? 1 : 0);
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreenCursor::QDirectFBScreenCursor: "
+ "Unable to enable cursor", result);
+ }
-void QDirectFBMouseHandlerPrivate::resume()
-{
- eventBuffer->Reset(eventBuffer);
- mouseNotifier->setEnabled(true);
+ result = layer->SetCooperativeLevel(layer, DLSCL_SHARED);
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreenCursor::show: "
+ "Unable to set cooperative level", result);
+ }
+
+ layer->SetCooperativeLevel(layer, DLSCL_SHARED);
+#endif
+ mouseNotifier->setEnabled(on);
+ }
}
void QDirectFBMouseHandlerPrivate::readMouseData()
@@ -260,12 +275,12 @@ QDirectFBMouseHandler::~QDirectFBMouseHandler()
void QDirectFBMouseHandler::suspend()
{
- d->suspend();
+ d->setEnabled(false);
}
void QDirectFBMouseHandler::resume()
{
- d->resume();
+ d->setEnabled(true);
}
#include "qdirectfbmouse.moc"
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h
index e81a4ba..d2eccfc 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h
@@ -61,7 +61,6 @@ public:
void suspend();
void resume();
-
protected:
QDirectFBMouseHandlerPrivate *d;
};
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index ba5d71a..9e6f821 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -54,6 +54,27 @@
#include <private/qpixmapdata_p.h>
#include <private/qpixmap_raster_p.h>
+#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS || defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
+#define VOID_ARG() static_cast<bool>(false)
+enum PaintOperation {
+ DRAW_RECTS = 0x0001,
+ DRAW_LINES = 0x0002,
+ DRAW_IMAGE = 0x0004,
+ DRAW_PIXMAP = 0x0008,
+ DRAW_TILED_PIXMAP = 0x0010,
+ STROKE_PATH = 0x0020,
+ DRAW_PATH = 0x0040,
+ DRAW_POINTS = 0x0080,
+ DRAW_ELLIPSE = 0x0100,
+ DRAW_POLYGON = 0x0200,
+ DRAW_TEXT = 0x0400,
+ FILL_PATH = 0x0800,
+ FILL_RECT = 0x1000,
+ DRAW_COLORSPANS = 0x2000,
+ ALL = 0xffff
+};
+#endif
+
#ifdef QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
template <typename T> inline const T *ptr(const T &t) { return &t; }
template <> inline const bool* ptr<bool>(const bool &) { return 0; }
@@ -98,24 +119,31 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device *
#endif
#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS && defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
-#define RASTERFALLBACK(one, two, three) rasterFallbackWarn("Disabled raster engine operation", \
- __FUNCTION__, state()->painter->device(), \
- d_func()->matrixScale, d_func()->matrixRotShear, \
- d_func()->simplePen, d_func()->dfbCanHandleClip(), \
- d_func()->forceRasterPrimitives, \
- #one, one, #two, two, #three, three); \
- return;
+#define RASTERFALLBACK(op, one, two, three) \
+ if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS)) \
+ rasterFallbackWarn("Disabled raster engine operation", \
+ __FUNCTION__, state()->painter->device(), \
+ d_func()->matrixScale, d_func()->matrixRotShear, \
+ d_func()->simplePen, d_func()->dfbCanHandleClip(), \
+ d_func()->forceRasterPrimitives, \
+ #one, one, #two, two, #three, three); \
+ if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS)) \
+ return;
#elif defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
-#define RASTERFALLBACK(one, two, three) return;
+#define RASTERFALLBACK(op, one, two, three) \
+ if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS)) \
+ return;
#elif defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
-#define RASTERFALLBACK(one, two, three) rasterFallbackWarn("Falling back to raster engine for", \
- __FUNCTION__, state()->painter->device(), \
- d_func()->matrixScale, d_func()->matrixRotShear, \
- d_func()->simplePen, d_func()->dfbCanHandleClip(), \
- d_func()->forceRasterPrimitives, \
- #one, one, #two, two, #three, three);
+#define RASTERFALLBACK(op, one, two, three) \
+ if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS)) \
+ rasterFallbackWarn("Falling back to raster engine for", \
+ __FUNCTION__, state()->painter->device(), \
+ d_func()->matrixScale, d_func()->matrixRotShear, \
+ d_func()->simplePen, d_func()->dfbCanHandleClip(), \
+ d_func()->forceRasterPrimitives, \
+ #one, one, #two, two, #three, three);
#else
-#define RASTERFALLBACK(one, two, three)
+#define RASTERFALLBACK(op, one, two, three)
#endif
static inline uint ALPHA_MUL(uint x, uint a)
@@ -270,14 +298,14 @@ public:
inline bool dfbCanHandleClip() const;
inline bool isSimpleBrush(const QBrush &brush) const;
- void drawLines(const QLine *lines, int count) const;
- void drawLines(const QLineF *lines, int count) const;
+ void drawLines(const QLine *lines, int count);
+ void drawLines(const QLineF *lines, int count);
- void fillRegion(const QRegion &r) const;
- void fillRects(const QRect *rects, int count) const;
- void drawRects(const QRect *rects, int count) const;
- void fillRects(const QRectF *rects, int count) const;
- void drawRects(const QRectF *rects, int count) const;
+ void fillRegion(const QRegion &r);
+ void fillRects(const QRect *rects, int count);
+ void drawRects(const QRect *rects, int count);
+ void fillRects(const QRectF *rects, int count);
+ void drawRects(const QRectF *rects, int count);
void drawPixmap(const QRectF &dest,
@@ -309,6 +337,7 @@ private:
bool dirtyClip;
bool dfbHandledClip;
+ bool ignoreSystemClip;
QDirectFBPaintDevice *dfbDevice;
QDirectFBPaintEngine *q;
@@ -322,6 +351,7 @@ QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p
dfbHandledClip(false), dfbDevice(0), q(p)
{
fb = QDirectFBScreen::instance()->dfb();
+ ignoreSystemClip = QDirectFBScreen::instance()->directFBFlags() & QDirectFBScreen::IgnoreSystemClip;
surfaceCache = new SurfaceCache;
static int cacheLimit = qgetenv("QT_DIRECTFB_IMAGECACHE").toInt();
if (cacheLimit > 0)
@@ -545,7 +575,7 @@ void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color)
surface->SetDrawingFlags(surface, DFBSurfaceDrawingFlags(drawingFlags));
}
-void QDirectFBPaintEnginePrivate::drawLines(const QLine *lines, int n) const
+void QDirectFBPaintEnginePrivate::drawLines(const QLine *lines, int n)
{
for (int i = 0; i < n; ++i) {
const QLine l = transform.map(lines[i]);
@@ -553,7 +583,7 @@ void QDirectFBPaintEnginePrivate::drawLines(const QLine *lines, int n) const
}
}
-void QDirectFBPaintEnginePrivate::drawLines(const QLineF *lines, int n) const
+void QDirectFBPaintEnginePrivate::drawLines(const QLineF *lines, int n)
{
for (int i = 0; i < n; ++i) {
const QLine l = transform.map(lines[i]).toLine();
@@ -561,14 +591,16 @@ void QDirectFBPaintEnginePrivate::drawLines(const QLineF *lines, int n) const
}
}
-void QDirectFBPaintEnginePrivate::fillRegion(const QRegion &region) const
+void QDirectFBPaintEnginePrivate::fillRegion(const QRegion &region)
{
+ Q_ASSERT(isSimpleBrush(q->state()->brush));
+ setDFBColor(q->state()->brush.color());
const QVector<QRect> rects = region.rects();
const int n = rects.size();
fillRects(rects.constData(), n);
}
-void QDirectFBPaintEnginePrivate::fillRects(const QRect *rects, int n) const
+void QDirectFBPaintEnginePrivate::fillRects(const QRect *rects, int n)
{
for (int i = 0; i < n; ++i) {
const QRect r = transform.mapRect(rects[i]);
@@ -577,7 +609,7 @@ void QDirectFBPaintEnginePrivate::fillRects(const QRect *rects, int n) const
}
}
-void QDirectFBPaintEnginePrivate::fillRects(const QRectF *rects, int n) const
+void QDirectFBPaintEnginePrivate::fillRects(const QRectF *rects, int n)
{
for (int i = 0; i < n; ++i) {
const QRect r = transform.mapRect(rects[i]).toRect();
@@ -586,7 +618,7 @@ void QDirectFBPaintEnginePrivate::fillRects(const QRectF *rects, int n) const
}
}
-void QDirectFBPaintEnginePrivate::drawRects(const QRect *rects, int n) const
+void QDirectFBPaintEnginePrivate::drawRects(const QRect *rects, int n)
{
for (int i = 0; i < n; ++i) {
const QRect r = transform.mapRect(rects[i]);
@@ -595,7 +627,7 @@ void QDirectFBPaintEnginePrivate::drawRects(const QRect *rects, int n) const
}
}
-void QDirectFBPaintEnginePrivate::drawRects(const QRectF *rects, int n) const
+void QDirectFBPaintEnginePrivate::drawRects(const QRectF *rects, int n)
{
for (int i = 0; i < n; ++i) {
const QRect r = transform.mapRect(rects[i]).toRect();
@@ -744,23 +776,24 @@ void QDirectFBPaintEnginePrivate::updateClip()
if (!dirtyClip)
return;
- if (!clip() || !clip()->enabled) {
+ const QClipData *clipData = clip();
+ if (!clipData || !clipData->enabled) {
surface->SetClip(surface, NULL);
dfbHandledClip = true;
- }
- else if (clip()->hasRectClip) {
+ } else if (clipData->hasRectClip) {
const DFBRegion r = {
- clip()->clipRect.x(),
- clip()->clipRect.y(),
- clip()->clipRect.x() + clip()->clipRect.width(),
- clip()->clipRect.y() + clip()->clipRect.height()
+ clipData->clipRect.x(),
+ clipData->clipRect.y(),
+ clipData->clipRect.x() + clipData->clipRect.width(),
+ clipData->clipRect.y() + clipData->clipRect.height()
};
surface->SetClip(surface, &r);
-
dfbHandledClip = true;
- }
- else
+ } else if (clipData->hasRegionClip && ignoreSystemClip && clipData->clipRegion == systemClip) {
+ dfbHandledClip = true;
+ } else {
dfbHandledClip = false;
+ }
dirtyClip = false;
}
@@ -890,7 +923,7 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount)
if (!d->dfbCanHandleClip() || d->matrixRotShear
|| !d->simplePen || d->forceRasterPrimitives
|| !d->isSimpleBrush(brush)) {
- RASTERFALLBACK(rectCount, static_cast<bool>(false), static_cast<bool>(false));
+ RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawRects(rects, rectCount);
return;
@@ -916,6 +949,7 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount)
if (!d->dfbCanHandleClip() || d->matrixRotShear
|| !d->simplePen || d->forceRasterPrimitives
|| !d->isSimpleBrush(brush)) {
+ RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawRects(rects, rectCount);
return;
@@ -938,7 +972,7 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount)
Q_D(QDirectFBPaintEngine);
d->updateClip();
if (!d->simplePen || !d->dfbCanHandleClip() || d->forceRasterPrimitives) {
- RASTERFALLBACK(lineCount, static_cast<bool>(false), static_cast<bool>(false));
+ RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawLines(lines, lineCount);
return;
@@ -956,7 +990,7 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount)
Q_D(QDirectFBPaintEngine);
d->updateClip();
if (!d->simplePen || !d->dfbCanHandleClip() || d->forceRasterPrimitives) {
- RASTERFALLBACK(lineCount, static_cast<bool>(false), static_cast<bool>(false));
+ RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawLines(lines, lineCount);
return;
@@ -982,7 +1016,7 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image,
|| QDirectFBScreen::getSurfacePixelFormat(image.format()) == DSPF_UNKNOWN)
#endif
{
- RASTERFALLBACK(r, image.size(), sr);
+ RASTERFALLBACK(DRAW_IMAGE, r, image.size(), sr);
d->lock();
QRasterPaintEngine::drawImage(r, image, sr, flags);
return;
@@ -1006,11 +1040,11 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap,
d->updateClip();
if (pixmap.pixmapData()->classId() != QPixmapData::DirectFBClass) {
- // not using RASTERFALLBACK since this is the way we do bitmaps?
+ RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
d->lock();
QRasterPaintEngine::drawPixmap(r, pixmap, sr);
} else if (!d->dfbCanHandleClip(r) || d->matrixRotShear) {
- RASTERFALLBACK(r, pixmap.size(), sr);
+ RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer();
d->lock();
QRasterPaintEngine::drawImage(r, *img, sr);
@@ -1032,10 +1066,11 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r,
Q_D(QDirectFBPaintEngine);
d->updateClip();
if (pixmap.pixmapData()->classId() != QPixmapData::DirectFBClass) {
+ RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), sp);
d->lock();
QRasterPaintEngine::drawTiledPixmap(r, pixmap, sp);
} else if (!d->dfbCanHandleClip(r) || d->matrixRotShear || !sp.isNull()) {
- RASTERFALLBACK(r, pixmap.size(), sp);
+ RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), sp);
const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer();
d->lock();
QRasterPixmapData *data = new QRasterPixmapData(QPixmapData::PixmapType);
@@ -1051,6 +1086,7 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r,
void QDirectFBPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
{
+ RASTERFALLBACK(STROKE_PATH, path, VOID_ARG(), VOID_ARG());
Q_D(QDirectFBPaintEngine);
d->lock();
QRasterPaintEngine::stroke(path, pen);
@@ -1058,7 +1094,7 @@ void QDirectFBPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
void QDirectFBPaintEngine::drawPath(const QPainterPath &path)
{
- RASTERFALLBACK(path.boundingRect(), static_cast<bool>(false), static_cast<bool>(false));
+ RASTERFALLBACK(DRAW_PATH, path, VOID_ARG(), VOID_ARG());
Q_D(QDirectFBPaintEngine);
d->lock();
QRasterPaintEngine::drawPath(path);
@@ -1066,7 +1102,7 @@ void QDirectFBPaintEngine::drawPath(const QPainterPath &path)
void QDirectFBPaintEngine::drawPoints(const QPointF *points, int pointCount)
{
- RASTERFALLBACK(pointCount, static_cast<bool>(false), static_cast<bool>(false));
+ RASTERFALLBACK(DRAW_POINTS, pointCount, VOID_ARG(), VOID_ARG());
Q_D(QDirectFBPaintEngine);
d->lock();
QRasterPaintEngine::drawPoints(points, pointCount);
@@ -1074,7 +1110,7 @@ void QDirectFBPaintEngine::drawPoints(const QPointF *points, int pointCount)
void QDirectFBPaintEngine::drawPoints(const QPoint *points, int pointCount)
{
- RASTERFALLBACK(pointCount, static_cast<bool>(false), static_cast<bool>(false));
+ RASTERFALLBACK(DRAW_POINTS, pointCount, VOID_ARG(), VOID_ARG());
Q_D(QDirectFBPaintEngine);
d->lock();
QRasterPaintEngine::drawPoints(points, pointCount);
@@ -1082,7 +1118,7 @@ void QDirectFBPaintEngine::drawPoints(const QPoint *points, int pointCount)
void QDirectFBPaintEngine::drawEllipse(const QRectF &rect)
{
- RASTERFALLBACK(rect, static_cast<bool>(false), static_cast<bool>(false));
+ RASTERFALLBACK(DRAW_ELLIPSE, rect, VOID_ARG(), VOID_ARG());
Q_D(QDirectFBPaintEngine);
d->lock();
QRasterPaintEngine::drawEllipse(rect);
@@ -1091,7 +1127,7 @@ void QDirectFBPaintEngine::drawEllipse(const QRectF &rect)
void QDirectFBPaintEngine::drawPolygon(const QPointF *points, int pointCount,
PolygonDrawMode mode)
{
- RASTERFALLBACK(pointCount, mode, static_cast<bool>(false));
+ RASTERFALLBACK(DRAW_POLYGON, pointCount, mode, VOID_ARG());
Q_D(QDirectFBPaintEngine);
d->lock();
QRasterPaintEngine::drawPolygon(points, pointCount, mode);
@@ -1100,7 +1136,7 @@ void QDirectFBPaintEngine::drawPolygon(const QPointF *points, int pointCount,
void QDirectFBPaintEngine::drawPolygon(const QPoint *points, int pointCount,
PolygonDrawMode mode)
{
- RASTERFALLBACK(pointCount, mode, static_cast<bool>(false));
+ RASTERFALLBACK(DRAW_POLYGON, pointCount, mode, VOID_ARG());
Q_D(QDirectFBPaintEngine);
d->lock();
QRasterPaintEngine::drawPolygon(points, pointCount, mode);
@@ -1109,7 +1145,7 @@ void QDirectFBPaintEngine::drawPolygon(const QPoint *points, int pointCount,
void QDirectFBPaintEngine::drawTextItem(const QPointF &p,
const QTextItem &textItem)
{
- RASTERFALLBACK(p, textItem.text(), static_cast<bool>(false));
+ RASTERFALLBACK(DRAW_TEXT, p, textItem.text(), VOID_ARG());
Q_D(QDirectFBPaintEngine);
d->lock();
QRasterPaintEngine::drawTextItem(p, textItem);
@@ -1117,7 +1153,7 @@ void QDirectFBPaintEngine::drawTextItem(const QPointF &p,
void QDirectFBPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
{
- RASTERFALLBACK(path, brush, static_cast<bool>(false));
+ RASTERFALLBACK(FILL_PATH, path, brush, VOID_ARG());
Q_D(QDirectFBPaintEngine);
d->lock();
QRasterPaintEngine::fill(path, brush);
@@ -1151,7 +1187,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
break;
}
}
- RASTERFALLBACK(rect, brush, static_cast<bool>(false));
+ RASTERFALLBACK(FILL_RECT, rect, brush, VOID_ARG());
d->lock();
QRasterPaintEngine::fillRect(rect, brush);
}
@@ -1161,7 +1197,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color)
Q_D(QDirectFBPaintEngine);
d->updateClip();
if (!d->dfbCanHandleClip() || d->matrixRotShear || d->forceRasterPrimitives) {
- RASTERFALLBACK(rect, color, static_cast<bool>(false));
+ RASTERFALLBACK(FILL_RECT, rect, color, VOID_ARG());
d->lock();
QRasterPaintEngine::fillRect(rect, color);
} else {
@@ -1178,7 +1214,7 @@ void QDirectFBPaintEngine::drawColorSpans(const QSpan *spans, int count,
{
Q_D(QDirectFBPaintEngine);
if (d->forceRasterPrimitives) {
- RASTERFALLBACK(count, color, static_cast<bool>(false));
+ RASTERFALLBACK(DRAW_COLORSPANS, count, color, VOID_ARG());
d->lock();
QRasterPaintEngine::drawColorSpans(spans, count, color);
} else {
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 3e54e7f..a53b1c0 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -80,7 +80,7 @@ public:
#ifndef QT_NO_DIRECTFB_KEYBOARD
QDirectFBKeyboardHandler *keyboard;
#endif
- bool videoonly;
+ QDirectFBScreen::DirectFBFlags directFBFlags;
QImage::Format alphaPixmapFormat;
};
@@ -96,7 +96,7 @@ QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen* screen)
#ifndef QT_NO_DIRECTFB_KEYBOARD
, keyboard(0)
#endif
- , videoonly(false)
+ , directFBFlags(QDirectFBScreen::NoFlags)
, alphaPixmapFormat(QImage::Format_Invalid)
{
#ifndef QT_NO_QWS_SIGNALHANDLER
@@ -225,7 +225,7 @@ IDirectFBSurface* QDirectFBScreen::createDFBSurface(const DFBSurfaceDescription
return 0;
}
- if (d_ptr->videoonly && !(desc->flags & DSDESC_PREALLOCATED)) {
+ if (d_ptr->directFBFlags & VideoOnly && !(desc->flags & DSDESC_PREALLOCATED)) {
// Add the video only capability. This means the surface will be created in video ram
DFBSurfaceDescription voDesc = *desc;
if (!(voDesc.flags & DSDESC_CAPS)) {
@@ -345,11 +345,10 @@ void QDirectFBScreen::releaseDFBSurface(IDirectFBSurface *surface)
//qDebug("Released surface at %p. New count = %d", surface, d_ptr->allocatedSurfaces.count());
}
-bool QDirectFBScreen::preferVideoOnly() const
+QDirectFBScreen::DirectFBFlags QDirectFBScreen::directFBFlags() const
{
- return d_ptr->videoonly;
+ return d_ptr->directFBFlags;
}
-
IDirectFB* QDirectFBScreen::dfb()
{
return d_ptr->dfb;
@@ -539,16 +538,12 @@ class Q_GUI_EXPORT QDirectFBScreenCursor : public QScreenCursor
{
public:
QDirectFBScreenCursor();
- ~QDirectFBScreenCursor();
-
- void set(const QImage &image, int hotx, int hoty);
- void move(int x, int y);
- void show();
- void hide();
-
+ virtual void set(const QImage &image, int hotx, int hoty);
+ virtual void move(int x, int y);
+ virtual void show();
+ virtual void hide();
private:
IDirectFBDisplayLayer *layer;
- bool implicitHide;
};
QDirectFBScreenCursor::QDirectFBScreenCursor()
@@ -558,116 +553,101 @@ QDirectFBScreenCursor::QDirectFBScreenCursor()
qFatal("QDirectFBScreenCursor: DirectFB not initialized");
layer = QDirectFBScreen::instance()->dfbDisplayLayer();
+ Q_ASSERT(layer);
- if (layer)
- layer->SetCooperativeLevel(layer, DLSCL_SHARED); // XXX: hw: remove?
- else
- qFatal("QDirectFBScreenCursor: Unable to get primary display layer!");
-
- enable = true;
+ enable = false;
hwaccel = true;
- implicitHide = false;
supportsAlpha = true;
-
- set(QImage(), 0, 0);
-}
-
-QDirectFBScreenCursor::~QDirectFBScreenCursor()
-{
}
-void QDirectFBScreenCursor::show()
+void QDirectFBScreenCursor::move(int x, int y)
{
- DFBResult result;
- result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::show: "
- "Unable to set cooperative level", result);
- }
- result = layer->EnableCursor(layer, 1);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::show: "
- "Unable to enable cursor", result);
- }
- result = layer->SetCooperativeLevel(layer, DLSCL_SHARED);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::show: "
- "Unable to reset cooperative level", result);
- }
- implicitHide = false;
+ layer->WarpCursor(layer, x, y);
}
void QDirectFBScreenCursor::hide()
{
- DFBResult result;
- result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::hide: "
- "Unable to set cooperative level", result);
- }
- result = layer->EnableCursor(layer, 0);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::hide: "
- "Unable to disable cursor", result);
- }
- result = layer->SetCooperativeLevel(layer, DLSCL_SHARED);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::hide: "
- "Unable to reset cooperative level", result);
+ if (enable) {
+ enable = false;
+ DFBResult result;
+ result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreenCursor::hide: "
+ "Unable to set cooperative level", result);
+ }
+ result = layer->SetCursorOpacity(layer, 0);
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreenCursor::hide: "
+ "Unable to set cursor opacity", result);
+ }
+ result = layer->SetCooperativeLevel(layer, DLSCL_SHARED);
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreenCursor::hide: "
+ "Unable to set cooperative level", result);
+ }
}
- implicitHide = true;
}
-void QDirectFBScreenCursor::move(int x, int y)
+void QDirectFBScreenCursor::show()
{
- layer->WarpCursor(layer, x, y);
+ if (!enable) {
+ enable = true;
+ DFBResult result;
+ result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreenCursor::show: "
+ "Unable to set cooperative level", result);
+ }
+ result = layer->SetCursorOpacity(layer, 255);
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreenCursor::show: "
+ "Unable to set cursor shape", result);
+ }
+ result = layer->SetCooperativeLevel(layer, DLSCL_SHARED);
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreenCursor::show: "
+ "Unable to set cooperative level", result);
+ }
+ }
}
void QDirectFBScreenCursor::set(const QImage &image, int hotx, int hoty)
{
- if (image.isNull() && isVisible()) {
- hide();
- implicitHide = true;
- } else if (!image.isNull() && implicitHide) {
- show();
- }
- cursor = image.convertToFormat(QDirectFBScreen::instance()->alphaPixmapFormat());
+ QDirectFBScreen *screen = QDirectFBScreen::instance();
+ if (!screen)
+ return;
- if (!image.isNull()) {
- Q_ASSERT(cursor.numColors() == 0);
+ if (image.isNull()) {
+ cursor = QImage();
+ hide();
+ } else {
+ cursor = image.convertToFormat(screen->alphaPixmapFormat());
size = cursor.size();
hotspot = QPoint(hotx, hoty);
-
- DFBSurfaceDescription description;
- description = QDirectFBScreen::getSurfaceDescription(cursor);
-
- IDirectFBSurface *surface;
- surface = QDirectFBScreen::instance()->createDFBSurface(&description,
- QDirectFBScreen::TrackSurface);
+ IDirectFBSurface *surface = screen->createDFBSurface(cursor, QDirectFBScreen::DontTrackSurface);
if (!surface) {
qWarning("QDirectFBScreenCursor::set: Unable to create surface");
return;
}
DFBResult result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::set: "
+ DirectFBError("QDirectFBScreenCursor::show: "
"Unable to set cooperative level", result);
}
result = layer->SetCursorShape(layer, surface, hotx, hoty);
if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::set: Unable to set cursor shape",
- result);
+ DirectFBError("QDirectFBScreenCursor::show: "
+ "Unable to set cursor shape", result);
}
-
+ surface->Release(surface);
result = layer->SetCooperativeLevel(layer, DLSCL_SHARED);
if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::set: "
- "Unable to reset cooperative level", result);
+ DirectFBError("QDirectFBScreenCursor::show: "
+ "Unable to set cooperative level", result);
}
-
- if (surface)
- QDirectFBScreen::instance()->releaseDFBSurface(surface);
+ show();
}
+
}
#endif // QT_NO_DIRECTFB_LAYER
@@ -823,8 +803,11 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
if (displayArgs.contains(QLatin1String("debug"), Qt::CaseInsensitive))
printDirectFBInfo(d_ptr->dfb);
- if (displayArgs.contains(QLatin1String("videoonly")))
- d_ptr->videoonly = true;
+ if (displayArgs.contains(QLatin1String("videoonly"), Qt::CaseInsensitive))
+ d_ptr->directFBFlags |= VideoOnly;
+
+ if (displayArgs.contains(QLatin1String("ignoresystemclip"), Qt::CaseInsensitive))
+ d_ptr->directFBFlags |= IgnoreSystemClip;
#ifndef QT_NO_DIRECTFB_WM
if (displayArgs.contains(QLatin1String("fullscreen")))
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index 8dd38dc..8e75277 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -59,6 +59,16 @@ public:
QDirectFBScreen(int display_id);
~QDirectFBScreen();
+ enum DirectFBFlag {
+ NoFlags = 0x00,
+ VideoOnly = 0x01,
+ IgnoreSystemClip = 0x02
+ };
+
+ Q_DECLARE_FLAGS(DirectFBFlags, DirectFBFlag);
+
+ DirectFBFlags directFBFlags() const;
+
bool connect(const QString &displaySpec);
void disconnect();
bool initDevice();
@@ -108,8 +118,6 @@ public:
SurfaceCreationOptions options);
void releaseDFBSurface(IDirectFBSurface* surface);
- bool preferVideoOnly() const;
-
static int depth(DFBSurfacePixelFormat format);
static DFBSurfacePixelFormat getSurfacePixelFormat(QImage::Format format);
@@ -138,6 +146,7 @@ private:
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QDirectFBScreen::SurfaceCreationOptions);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QDirectFBScreen::DirectFBFlags);
inline bool QDirectFBScreen::isPremultiplied(QImage::Format format)
{
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp
index 8ed308c..257efeb 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp
@@ -110,7 +110,7 @@ void QDirectFBSurface::createWindow()
|DWDESC_PIXELFORMAT);
description.surface_caps = DSCAPS_NONE;
- if (screen->preferVideoOnly())
+ if (screen->directFBFlags() & QDirectFBScreen::VideoOnly)
description.surface_caps = DFBSurfaceCapabilities(description.surface_caps|DSCAPS_VIDEOONLY);
const QImage::Format format = screen->pixelFormat();
description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(format);