diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2010-01-05 11:09:20 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2010-01-05 11:09:20 (GMT) |
commit | 5e4b2e2591bb1b5897b29c43fa35b0a60fd43d56 (patch) | |
tree | 84c3a6c8def77ca0a518a9e9da7a1d52d1fcbc0c /src | |
parent | 781e8b00979f22de15a17510121be1ad20630c7a (diff) | |
download | Qt-5e4b2e2591bb1b5897b29c43fa35b0a60fd43d56.zip Qt-5e4b2e2591bb1b5897b29c43fa35b0a60fd43d56.tar.gz Qt-5e4b2e2591bb1b5897b29c43fa35b0a60fd43d56.tar.bz2 |
Make sure that premultiplied surfaces are used
and clean up a bit. Also removed alot of unnecessary windowsurface code
Diffstat (limited to 'src')
7 files changed, 24 insertions, 47 deletions
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 3b18ca9..3613211 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -29,15 +29,13 @@ QBlittable *QBlittablePixmapData::blittable() const void QBlittablePixmapData::setBlittable(QBlittable *blittable) { - if (m_blittable) - delete m_blittable; + delete m_blittable; + resize(blittable->rect().width(),blittable->rect().height()); m_blittable = blittable; } void QBlittablePixmapData::resize(int width, int height) { - delete m_blittable; - m_blittable = 0; delete m_engine; m_engine = 0; d = QApplicationPrivate::graphicsSystem()->screens().at(0)->depth(); @@ -78,7 +76,7 @@ int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const void QBlittablePixmapData::fill(const QColor &color) { if (blittable()->capabilities() & QBlittable::SolidRectCapability) - blittable()->fillRect(m_blittable->rect(),color); + blittable()->fillRect(QRectF(0,0,w,h),color); else blittable()->lock()->fill(color.rgb()); } diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index 6a5462e..7f67997 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -8,7 +8,6 @@ class QBlittablePrivate; class QBlitterPaintEnginePrivate; class QBlittablePixmapData; -// ### find name class Q_GUI_EXPORT QBlittable { Q_DECLARE_PRIVATE(QBlittable); diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp index a995b0f..06622a1 100644 --- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp @@ -20,7 +20,8 @@ QDirectFbBlitter::QDirectFbBlitter(const QRect &rect, IDirectFBSurface *surface) DFBSurfaceDescription surfaceDesc; surfaceDesc.width = rect.width(); surfaceDesc.height = rect.height(); - surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT); + surfaceDesc.caps = DSCAPS_PREMULTIPLIED; + surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS); IDirectFB *dfb = QDirectFbConvenience::dfbInterface(); dfb->CreateSurface(dfb,&surfaceDesc, &m_surface); diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp index 2bd2f3b..4e2085d 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp @@ -25,9 +25,9 @@ QImage::Format QDirectFbConvenience::imageFormatFromSurfaceFormat(const DFBSurfa case DSPF_RGB32: return QImage::Format_RGB32; case DSPF_ARGB: { - return (caps & DSCAPS_PREMULTIPLIED - ? QImage::Format_ARGB32_Premultiplied - : QImage::Format_ARGB32); } + if (caps & DSCAPS_PREMULTIPLIED) + return QImage::Format_ARGB32_Premultiplied; + else return QImage::Format_ARGB32; } default: break; } diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index e0479a0..9e5e8bb 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -61,13 +61,8 @@ QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(IDirectFB *dfb, int DirectFBError("QDirectFbGraphicsSystemScreen " "Unable to get primary display layer!", result); } - DFBDisplayLayerConfig *displayLayerConfig; -// m_layer->GetConfiguration(m_layer,displayLayerConfig); -// displayLayerConfig->surface_caps = DFBSurfaceCapabilities(displayLayerConfig->surface_caps | DSCAPS_PREMULTIPLIED); -// m_layer->SetConfiguration(m_layer, displayLayerConfig); m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); - DFBDisplayLayerConfig config; m_layer->GetConfiguration(m_layer, &config); @@ -101,7 +96,7 @@ IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect, #if DIRECTFB_MINOR_VERSION >= 1 description.options = DFBWindowOptions(DWOP_ALPHACHANNEL); #endif - description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER); + description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER|DWCAPS_ALPHACHANNEL); description.surface_caps = DSCAPS_PREMULTIPLIED; DFBResult result = m_layer->CreateWindow(m_layer,&description,&window); diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index 913e01d..f7229e9 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -47,30 +47,25 @@ #include <QtCore/qdebug.h> +#include <wait.h> + QT_BEGIN_NAMESPACE QDirectFbWindowSurface::QDirectFbWindowSurface(QDirectFbGraphicsSystemScreen *screen, QWidget *window) - : QWindowSurface(window), m_screen(screen), m_pixmap(0), pmdata(0), + : QWindowSurface(window), m_screen(screen), m_pixmap(0), m_pmdata(0), m_dfbWindow(0), m_dfbSurface(0) { window->setWindowSurface(this); m_dfbWindow = m_screen->createWindow(window->rect(),window); - DFBResult result = m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); - if (result != DFB_OK) { - DirectFBError("QDirectFbWindowSurface::QDirectFbWindowSurface: unable to get windows surface",result); - } - if (m_dfbSurface) { - m_dfbSurface->Clear(m_dfbSurface, 0, 0, 0, 0); - m_dfbSurface->Flip(m_dfbSurface, 0, DSFLIP_ONSYNC); - } + m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); + qDebug () << "initial surface: " << m_dfbSurface; + QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect(), m_dfbSurface); - pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); - int width,height; - m_dfbSurface->GetSize(m_dfbSurface, &width, &height); - pmdata->resize(width,height); - pmdata->setBlittable(blitter); + m_pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); + m_pmdata->setBlittable(blitter); + m_pixmap = new QPixmap(m_pmdata); + - m_pixmap = new QPixmap(pmdata); } QDirectFbWindowSurface::~QDirectFbWindowSurface() @@ -104,23 +99,12 @@ void QDirectFbWindowSurface::setGeometry(const QRect &rect) QWindowSurface::setGeometry(rect); m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), rect.width(), rect.height()); - if (m_dfbSurface) { - m_dfbSurface->Release(m_dfbSurface); - m_dfbSurface = 0; - } - DFBResult result = m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); - if (result != DFB_OK) - DirectFBError("QDirectFbWindowSurface::setGeometry() failed to retrieve new surface",result); - - if (m_dfbSurface) { - m_dfbSurface->Clear(m_dfbSurface, 0, 0, 0, 0); - m_dfbSurface->Flip(m_dfbSurface, 0, DSFLIP_ONSYNC); - } + //Have to add 1 ref ass it will be removed by deleting the old blitter in setBlittable + m_dfbSurface->AddRef(m_dfbSurface); + QBlittable *blittabler = new QDirectFbBlitter(rect,m_dfbSurface); + m_pmdata->setBlittable(blittabler); - QDirectFbBlitter *blitter = new QDirectFbBlitter(rect, m_dfbSurface); - pmdata->resize(rect.width(),rect.height()); - pmdata->setBlittable(blitter); } bool QDirectFbWindowSurface::scroll(const QRegion &area, int dx, int dy) diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h index 3c81287..f74fb29 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h @@ -76,7 +76,7 @@ private: QDirectFbGraphicsSystemScreen *m_screen; QPixmap *m_pixmap; - QBlittablePixmapData *pmdata; + QBlittablePixmapData *m_pmdata; IDirectFBWindow *m_dfbWindow; IDirectFBSurface *m_dfbSurface; |