summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-12-13 11:02:32 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2011-12-13 11:02:32 (GMT)
commitee387dcb715ebc21f63b524bb87a8ffaf198f8aa (patch)
tree3adf6ac4929ef98e081f7d61b6897cba5171e933 /src/plugins/platforms
parente394dd804fa6690f6d4bd270f61ca56331cea63b (diff)
downloadQt-ee387dcb715ebc21f63b524bb87a8ffaf198f8aa.zip
Qt-ee387dcb715ebc21f63b524bb87a8ffaf198f8aa.tar.gz
Qt-ee387dcb715ebc21f63b524bb87a8ffaf198f8aa.tar.bz2
[blitter] Work on tst_QPixmap::clear()
By default QPixmap may not hasAlphaChannel(), only if setMask() or fill() with a transparent color is called a QPixmap will hasAlphaChannel(). Make the QBlittablePlatformPixmap remember if there is an alpha channel, pass this as parameter in createBlittable to make it clear that this is required and not optional. Update the DirectFB plugin to handle this parameter to create a RGB32 or ARGB Surface depending on the alpha value, also only use PreMultiplied alpha when using ARGB. Separate the two constructors for the QDirectFbBlitter to either adopt a DirectFB Surface or to create one. Cherry-picked-from: qtbase:ab50b60f5cc237d5620f3ff3b2eb44c857f8f60b Change-Id: I8abf82408ecd2d075fc6f241ace8be2a34ac56e7 Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com> Merge-request: 1492 Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/directfb/qdirectfbblitter.cpp33
-rw-r--r--src/plugins/platforms/directfb/qdirectfbblitter.h10
2 files changed, 30 insertions, 13 deletions
diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.cpp b/src/plugins/platforms/directfb/qdirectfbblitter.cpp
index 86a8bf7..83c27d1 100644
--- a/src/plugins/platforms/directfb/qdirectfbblitter.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbblitter.cpp
@@ -54,22 +54,33 @@ QDirectFbBlitter::QDirectFbBlitter(const QSize &rect, IDirectFBSurface *surface)
|QBlittable::SourceOverPixmapCapability
|QBlittable::SourceOverScaledPixmapCapability))
{
- if (surface) {
- m_surface = surface;
- } else {
- DFBSurfaceDescription surfaceDesc;
- memset(&surfaceDesc,0,sizeof(DFBSurfaceDescription));
- surfaceDesc.width = rect.width();
- surfaceDesc.height = rect.height();
+ m_surface = surface;
+}
+
+QDirectFbBlitter::QDirectFbBlitter(const QSize &rect, bool alpha)
+ : QBlittable(rect, QBlittable::Capabilities(QBlittable::SolidRectCapability
+ |QBlittable::SourcePixmapCapability
+ |QBlittable::SourceOverPixmapCapability
+ |QBlittable::SourceOverScaledPixmapCapability))
+{
+ DFBSurfaceDescription surfaceDesc;
+ memset(&surfaceDesc,0,sizeof(DFBSurfaceDescription));
+ surfaceDesc.width = rect.width();
+ surfaceDesc.height = rect.height();
+
+ if (alpha) {
surfaceDesc.caps = DSCAPS_PREMULTIPLIED;
surfaceDesc.pixelformat = DSPF_ARGB;
surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS | DSDESC_PIXELFORMAT);
-
- IDirectFB *dfb = QDirectFbConvenience::dfbInterface();
- dfb->CreateSurface(dfb,&surfaceDesc, &m_surface);
- m_surface->Clear(m_surface,0,0,0,0);
+ } else {
+ surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT);
+ surfaceDesc.pixelformat = DSPF_RGB32;
}
+
+ IDirectFB *dfb = QDirectFbConvenience::dfbInterface();
+ dfb->CreateSurface(dfb , &surfaceDesc, &m_surface);
+ m_surface->Clear(m_surface, 0, 0, 0, 0);
}
QDirectFbBlitter::~QDirectFbBlitter()
diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.h b/src/plugins/platforms/directfb/qdirectfbblitter.h
index 16d7599..5a2b77f 100644
--- a/src/plugins/platforms/directfb/qdirectfbblitter.h
+++ b/src/plugins/platforms/directfb/qdirectfbblitter.h
@@ -51,7 +51,8 @@
class QDirectFbBlitter : public QBlittable
{
public:
- QDirectFbBlitter(const QSize &size, IDirectFBSurface *surface = 0);
+ QDirectFbBlitter(const QSize &size, IDirectFBSurface *surface);
+ QDirectFbBlitter(const QSize &size, bool alpha);
virtual ~QDirectFbBlitter();
virtual void fillRect(const QRectF &rect, const QColor &color);
@@ -70,7 +71,12 @@ protected:
class QDirectFbBlitterPixmapData : public QBlittablePixmapData
{
public:
- QBlittable *createBlittable(const QSize &size) const { return new QDirectFbBlitter(size); }
+ QBlittable *createBlittable(const QSize &size, bool alpha) const;
};
+inline QBlittable *QDirectFbBlitterPixmapData::createBlittable(const QSize& size, bool alpha) const
+{
+ return new QDirectFbBlitter(size, alpha);
+}
+
#endif // QDIRECTFBBLITTER_H