summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-01-11 15:14:33 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-01-11 15:14:33 (GMT)
commit721653914597ccdec7bbf94b58e6b6879dd53755 (patch)
treecfaceca17f82b85bf021b6eaeec04183fbb4d34f /src/plugins
parent5dfcb52fb853ae7f28acc83e2be99f999e1bf31e (diff)
downloadQt-721653914597ccdec7bbf94b58e6b6879dd53755.zip
Qt-721653914597ccdec7bbf94b58e6b6879dd53755.tar.gz
Qt-721653914597ccdec7bbf94b58e6b6879dd53755.tar.bz2
Added colordepth convenience function in minimaldfb
and added pixelformat for default dfbblitters
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp10
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp5
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h2
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp2
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp2
5 files changed, 20 insertions, 1 deletions
diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp
index 06622a1..23e3be6 100644
--- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp
+++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp
@@ -18,13 +18,16 @@ QDirectFbBlitter::QDirectFbBlitter(const QRect &rect, IDirectFBSurface *surface)
m_surface = surface;
} else {
DFBSurfaceDescription surfaceDesc;
+ memset(&surfaceDesc,0,sizeof(DFBSurfaceDescription));
surfaceDesc.width = rect.width();
surfaceDesc.height = rect.height();
surfaceDesc.caps = DSCAPS_PREMULTIPLIED;
- surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS);
+ surfaceDesc.pixelformat = DSPF_ARGB;
+ surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT);
IDirectFB *dfb = QDirectFbConvenience::dfbInterface();
dfb->CreateSurface(dfb,&surfaceDesc, &m_surface);
+ m_surface->Clear(m_surface,0,0,0,0);
}
}
@@ -36,6 +39,10 @@ QDirectFbBlitter::~QDirectFbBlitter()
void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color)
{
m_surface->SetColor(m_surface, color.red(), color.green(), color.blue(), color.alpha());
+// When the blitter api supports non opaque blits, also remember to change
+// qpixmap_blitter.cpp::fill
+// DFBSurfaceDrawingFlags drawingFlags = color.alpha() ? DSDRAW_BLEND : DSDRAW_NOFX;
+// m_surface->SetDrawingFlags(m_surface, drawingFlags);
m_surface->SetDrawingFlags(m_surface, DSDRAW_NOFX);
m_surface->FillRectangle(m_surface, rect.x(), rect.y(),
rect.width(), rect.height());
@@ -49,6 +56,7 @@ void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, con
m_surface->SetColor(m_surface, 0xff, 0xff, 0xff, 255);
QPixmapData *data = pixmap.pixmapData();
+ Q_ASSERT(data->width() && data->height());
Q_ASSERT(data->classId() == QPixmapData::BlitterClass);
QBlittablePixmapData *blitPm = static_cast<QBlittablePixmapData*>(data);
QDirectFbBlitter *dfbBlitter = static_cast<QDirectFbBlitter *>(blitPm->blittable());
diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp
index 25d6258..57d03fc 100644
--- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp
+++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp
@@ -58,6 +58,11 @@ QImage::Format QDirectFbConvenience::imageFormatFromSurfaceFormat(const DFBSurfa
}
+int QDirectFbConvenience::colorDepthForSurface(const DFBSurfacePixelFormat format)
+{
+ return ((0x1f << 7) & format) >> 7;
+}
+
IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPixmapData(QPixmapData *pixmapData)
{
QBlittablePixmapData *blittablePmData = static_cast<QBlittablePixmapData *>(pixmapData);
diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h
index c086828..0b1a24f 100644
--- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h
+++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h
@@ -19,6 +19,8 @@ class QDirectFbConvenience
{
public:
static QImage::Format imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps);
+ static bool pixelFomatHasAlpha(const DFBSurfacePixelFormat format) { return (1 << 16) & format; }
+ static int colorDepthForSurface(const DFBSurfacePixelFormat format);
//This is set by the graphicssystem constructor
static IDirectFB *dfbInterface();
diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp
index aef7a3d..f1f2215 100644
--- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp
+++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp
@@ -64,6 +64,8 @@ QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(int display)
m_layer->GetConfiguration(m_layer, &config);
m_format = QDirectFbConvenience::imageFormatFromSurfaceFormat(config.pixelformat, config.surface_caps);
+ qDebug() << QDirectFbConvenience::pixelFomatHasAlpha(config.pixelformat);
+ qDebug() << QDirectFbConvenience::colorDepthForSurface(config.pixelformat);
qDebug() << "GraphcisSystemScreen has format: " << m_format;
m_geometry = QRect(0,0,config.width,config.height);
const int dpi = 72;
diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp
index c8e4f9d..5f03b78 100644
--- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp
+++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp
@@ -63,6 +63,8 @@ QDirectFbWindowSurface::QDirectFbWindowSurface(QDirectFbGraphicsSystemScreen *sc
m_dfbSurface->GetCapabilities(m_dfbSurface, &caps);
DFBSurfacePixelFormat format;
m_dfbSurface->GetPixelFormat(m_dfbSurface, &format);
+ qDebug() << QDirectFbConvenience::pixelFomatHasAlpha(format);
+ qDebug() << QDirectFbConvenience::colorDepthForSurface(format);
qDebug() << "WindowSurface format " << QDirectFbConvenience::imageFormatFromSurfaceFormat(format,caps);