diff options
author | Anders Bakken <anders.bakken@nokia.com> | 2009-04-07 22:01:46 (GMT) |
---|---|---|
committer | Anders Bakken <anders.bakken@nokia.com> | 2009-04-07 22:01:46 (GMT) |
commit | b818bf2d67e4e5f3f3a01eeb0c0de37a4cd33b50 (patch) | |
tree | aac1d769f99258035a53f0dc5b1aa5a172ece694 /src/plugins | |
parent | 2553bde1b24091ef4076d0512709b6657750000e (diff) | |
download | Qt-b818bf2d67e4e5f3f3a01eeb0c0de37a4cd33b50.zip Qt-b818bf2d67e4e5f3f3a01eeb0c0de37a4cd33b50.tar.gz Qt-b818bf2d67e4e5f3f3a01eeb0c0de37a4cd33b50.tar.bz2 |
Work around RGB32 issue in solidFill
Drawing operations with DirectFB in RGB32 changes the alpha byte to 0.
This doesn't play well with QRasterEngine.
See 5fb7752ff93b31635e64fa321917749744cc9db6 and
34059fba55816496d2570b3306ac2b631b12a5c6
Reviewed-by: TrustMe
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index a62c846..bf9864a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -1182,21 +1182,29 @@ void QDirectFBScreen::solidFill(const QColor &color, const QRegion ®ion) if (region.isEmpty()) return; - const QVector<QRect> rects = region.rects(); - QVarLengthArray<DFBRectangle> dfbRects(rects.size()); - for (int i = 0; i < rects.size(); ++i) { - const QRect r = rects.at(i); - dfbRects[i].x = r.x(); - dfbRects[i].y = r.y(); - dfbRects[i].w = r.width(); - dfbRects[i].h = r.height(); + if (QDirectFBScreen::getImageFormat(d_ptr->dfbSurface) == QImage::Format_RGB32) { + uchar *mem; + int bpl; + d_ptr->dfbSurface->Lock(d_ptr->dfbSurface, DSLF_WRITE, (void**)&mem, &bpl); + QImage img(mem, w, h, bpl, QImage::Format_RGB32); + QPainter p(&img); + p.setBrush(color); + p.setPen(Qt::NoPen); + const QVector<QRect> rects = region.rects(); + p.drawRects(rects.constData(), rects.size()); + p.end(); + d_ptr->dfbSurface->Unlock(d_ptr->dfbSurface); + } else { + d_ptr->dfbSurface->SetColor(d_ptr->dfbSurface, + color.red(), color.green(), color.blue(), + color.alpha()); + const QVector<QRect> rects = region.rects(); + for (int i=0; i<rects.size(); ++i) { + const QRect &r = rects.at(i); + d_ptr->dfbSurface->FillRectangle(d_ptr->dfbSurface, + r.x(), r.y(), r.width(), r.height()); + } } - - d_ptr->dfbSurface->SetColor(d_ptr->dfbSurface, - color.red(), color.green(), color.blue(), - color.alpha()); - d_ptr->dfbSurface->FillRectangles(d_ptr->dfbSurface, dfbRects.data(), - dfbRects.size()); } QImage::Format QDirectFBScreen::alphaPixmapFormat() const @@ -1204,7 +1212,6 @@ QImage::Format QDirectFBScreen::alphaPixmapFormat() const return d_ptr->alphaPixmapFormat; } - bool QDirectFBScreen::initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *description, QImage::Format format) { |