summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2011-09-29 18:10:15 +0200
committerQt by Nokia <qt-info@nokia.com>2011-10-21 16:54:45 +0200
commitb1c803a925cc6cfb78598066f735e54a007d57a3 (patch)
treeca627b3ad653c9a64fa8130bc2cf181f01b21989
parentd43775b93b7f0b2968c94a345e1c45bed5e63dbc (diff)
[directfb] Prepare to select the alpha/opaque pixel formats
Right now we assume to use 32bpp but depending on the hardware this might not be optimal at all. Begin to prepare the code for not having a 32bpp surfaces. Change-Id: Iedfa49c568559e074dfaeae2a216c9eb93721d2c Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
-rw-r--r--src/plugins/platforms/directfb/qdirectfbblitter.cpp19
-rw-r--r--src/plugins/platforms/directfb/qdirectfbblitter.h4
2 files changed, 21 insertions, 2 deletions
diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.cpp b/src/plugins/platforms/directfb/qdirectfbblitter.cpp
index fcca7dd840..bd31982d42 100644
--- a/src/plugins/platforms/directfb/qdirectfbblitter.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbblitter.cpp
@@ -74,11 +74,11 @@ QDirectFbBlitter::QDirectFbBlitter(const QSize &rect, bool alpha)
if (alpha) {
surfaceDesc.caps = DSCAPS_PREMULTIPLIED;
- surfaceDesc.pixelformat = DSPF_ARGB;
+ surfaceDesc.pixelformat = QDirectFbBlitter::alphaPixmapFormat();
surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS | DSDESC_PIXELFORMAT);
} else {
surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT);
- surfaceDesc.pixelformat = DSPF_RGB32;
+ surfaceDesc.pixelformat = QDirectFbBlitter::pixmapFormat();
}
@@ -92,6 +92,21 @@ QDirectFbBlitter::~QDirectFbBlitter()
unlock();
}
+DFBSurfacePixelFormat QDirectFbBlitter::alphaPixmapFormat()
+{
+ return DSPF_ARGB;
+}
+
+DFBSurfacePixelFormat QDirectFbBlitter::pixmapFormat()
+{
+ return DSPF_RGB32;
+}
+
+DFBSurfacePixelFormat QDirectFbBlitter::selectPixmapFormat(bool withAlpha)
+{
+ return withAlpha ? alphaPixmapFormat() : pixmapFormat();
+}
+
void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color)
{
m_surface->SetColor(m_surface.data(), color.red(), color.green(), color.blue(), color.alpha());
diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.h b/src/plugins/platforms/directfb/qdirectfbblitter.h
index b1cc5be979..6ed3850487 100644
--- a/src/plugins/platforms/directfb/qdirectfbblitter.h
+++ b/src/plugins/platforms/directfb/qdirectfbblitter.h
@@ -58,6 +58,10 @@ public:
virtual void fillRect(const QRectF &rect, const QColor &color);
virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect);
+ static DFBSurfacePixelFormat alphaPixmapFormat();
+ static DFBSurfacePixelFormat pixmapFormat();
+ static DFBSurfacePixelFormat selectPixmapFormat(bool withAlpha);
+
protected:
virtual QImage *doLock();
virtual void doUnlock();