summaryrefslogtreecommitdiffstats
path: root/src/plugins/gfxdrivers/directfb
diff options
context:
space:
mode:
authorAnders Bakken <agbakken@gmail.com>2010-10-22 20:11:22 (GMT)
committerDonald Carr <donald.carr@nokia.com>2010-10-22 20:11:22 (GMT)
commit3f744a4e816b8a7850e8c0479b254a8e6bd2e74f (patch)
tree97aeb8ef71c233d3d72f2acb73f2a2fe65aa061e /src/plugins/gfxdrivers/directfb
parentccfa6f282fc7a4c258c83844433f04a6380e4055 (diff)
downloadQt-3f744a4e816b8a7850e8c0479b254a8e6bd2e74f.zip
Qt-3f744a4e816b8a7850e8c0479b254a8e6bd2e74f.tar.gz
Qt-3f744a4e816b8a7850e8c0479b254a8e6bd2e74f.tar.bz2
QtDFB: Make transparent windows behave better
Windows with Qt::WA_NoSystemBackground should clear to transparent in beginPaint. Merge-request: 882 Reviewed-by: Donald Carr <donald.carr@nokia.com>
Diffstat (limited to 'src/plugins/gfxdrivers/directfb')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp36
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h1
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp9
3 files changed, 29 insertions, 17 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index bf6164d..f2ee6ae 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -1554,9 +1554,8 @@ void QDirectFBScreen::exposeRegion(QRegion r, int)
: (DSBLIT_BLEND_ALPHACHANNEL|DSBLIT_BLEND_COLORALPHA);
}
}
- if (!region.isEmpty()) {
- solidFill(d_ptr->backgroundColor, region);
- }
+
+ solidFill(d_ptr->backgroundColor, region);
while (idx > 0) {
const PaintCommand &cmd = commands[--idx];
@@ -1629,29 +1628,34 @@ void QDirectFBScreen::solidFill(const QColor &color, const QRegion &region)
Q_UNUSED(color);
Q_UNUSED(region);
#else
+ QDirectFBScreen::solidFill(d_ptr->primarySurface, color, region);
+#endif
+}
+
+static inline void clearRect(IDirectFBSurface *surface, const QColor &color, const QRect &rect)
+{
+ Q_ASSERT(surface);
+ const DFBRegion region = { rect.left(), rect.top(), rect.right(), rect.bottom() };
+ // could just reinterpret_cast this to a DFBRegion
+ surface->SetClip(surface, &region);
+ surface->Clear(surface, color.red(), color.green(), color.blue(), color.alpha());
+}
+
+void QDirectFBScreen::solidFill(IDirectFBSurface *surface, const QColor &color, const QRegion &region)
+{
if (region.isEmpty())
return;
- d_ptr->primarySurface->SetColor(d_ptr->primarySurface,
- color.red(), color.green(), color.blue(),
- color.alpha());
const int n = region.rectCount();
if (n == 1) {
- const QRect r = region.boundingRect();
- d_ptr->primarySurface->FillRectangle(d_ptr->primarySurface, r.x(), r.y(), r.width(), r.height());
+ clearRect(surface, color, region.boundingRect());
} else {
const QVector<QRect> rects = region.rects();
- QVarLengthArray<DFBRectangle, 32> rectArray(n);
for (int i=0; i<n; ++i) {
- const QRect &r = rects.at(i);
- rectArray[i].x = r.x();
- rectArray[i].y = r.y();
- rectArray[i].w = r.width();
- rectArray[i].h = r.height();
+ clearRect(surface, color, rects.at(i));
}
- d_ptr->primarySurface->FillRectangles(d_ptr->primarySurface, rectArray.constData(), n);
}
-#endif
+ surface->SetClip(surface, 0);
}
QImage::Format QDirectFBScreen::alphaPixmapFormat() const
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index c483020..1085423 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -159,6 +159,7 @@ public:
void exposeRegion(QRegion r, int changing);
void solidFill(const QColor &color, const QRegion &region);
+ static void solidFill(IDirectFBSurface *surface, const QColor &color, const QRegion &region);
void setMode(int width, int height, int depth);
void blank(bool on);
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index 51969fc..2eeee24 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -380,11 +380,18 @@ void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion &region,
flushPending = false;
}
-void QDirectFBWindowSurface::beginPaint(const QRegion &)
+void QDirectFBWindowSurface::beginPaint(const QRegion &region)
{
if (!engine) {
engine = new QDirectFBPaintEngine(this);
}
+
+ if (dfbSurface) {
+ const QWidget *win = window();
+ if (win && win->testAttribute(Qt::WA_NoSystemBackground)) {
+ QDirectFBScreen::solidFill(dfbSurface, Qt::transparent, region);
+ }
+ }
flushPending = true;
}