summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAnders Bakken <anders@trolltech.com>2009-03-23 22:06:43 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2009-03-25 15:57:18 (GMT)
commit2ab5d8db650118312bfe9b1e60c4ac60229b229f (patch)
treefba80e848e2ed57876ce78ef23ecf9853735a202 /src/plugins
parentb99287bef5bf8c71ef5b0aeb7de85a069b222443 (diff)
downloadQt-2ab5d8db650118312bfe9b1e60c4ac60229b229f.zip
Qt-2ab5d8db650118312bfe9b1e60c4ac60229b229f.tar.gz
Qt-2ab5d8db650118312bfe9b1e60c4ac60229b229f.tar.bz2
Clean up locking/unlocking
Store the QDirectFBPaintDevice we're painting and use this when unlocking/locking instead of working on QPaintEngine::device() which isn't necessarily the same. Reviewed-by: Tom Cooksey
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp32
1 files changed, 11 insertions, 21 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index e8afba3..86357e6 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -211,7 +211,7 @@ public:
inline void setDFBColor(const QColor &color) const;
- inline bool lock();
+ inline void lock();
inline void unlock();
inline bool dfbCanHandleClip(const QRect &rect) const;
@@ -259,6 +259,7 @@ private:
bool dirtyFlags;
bool dirtyClip;
bool dfbHandledClip;
+ QDirectFBPaintDevice *dfbDevice;
QDirectFBPaintEngine *q;
};
@@ -267,7 +268,7 @@ QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p
: surface(0), antialiased(false), simplePen(false),
simpleBrush(false), matrixRotShear(false), matrixScale(false), fbWidth(-1), fbHeight(-1),
opacity(255), drawFlags(0), blitFlags(0), duffFlags(0), dirtyFlags(false), dirtyClip(true),
- dfbHandledClip(false), q(p)
+ dfbHandledClip(false), dfbDevice(0), q(p)
{
fb = QDirectFBScreen::instance()->dfb();
surfaceCache = new SurfaceCache;
@@ -278,7 +279,6 @@ QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p
QDirectFBPaintEnginePrivate::~QDirectFBPaintEnginePrivate()
{
- unlock();
delete surfaceCache;
}
@@ -305,26 +305,18 @@ void QDirectFBPaintEnginePrivate::setClipDirty()
}
-bool QDirectFBPaintEnginePrivate::lock()
+void QDirectFBPaintEnginePrivate::lock()
{
// We will potentially get a new pointer to the buffer after a
// lock so we need to call the base implementation of prepare so
// it updates its rasterBuffer to point to the new buffer address.
- if (device->devType() == QInternal::CustomRaster) {
- prepare(static_cast<QCustomRasterPaintDevice*>(device));
- return true;
- }
- return false;
+ Q_ASSERT(dfbDevice);
+ prepare(dfbDevice);
}
void QDirectFBPaintEnginePrivate::unlock()
{
- QPaintDevice *device = q->paintDevice();
- if (!device) //XXX This should probably be an assert
- return;
-
- Q_ASSERT(device->devType() == QInternal::CustomRaster);
- QDirectFBPaintDevice* dfbDevice = static_cast<QDirectFBPaintDevice*>(device);
+ Q_ASSERT(dfbDevice);
dfbDevice->unlockDirectFB();
}
@@ -337,16 +329,13 @@ void QDirectFBPaintEnginePrivate::setTransform(const QTransform &m)
void QDirectFBPaintEnginePrivate::begin(QPaintDevice *device)
{
- QDirectFBPaintDevice* dfbDevice = 0;
-
if (device->devType() == QInternal::CustomRaster)
dfbDevice = static_cast<QDirectFBPaintDevice*>(device);
else if (device->devType() == QInternal::Pixmap) {
QPixmapData *data = static_cast<QPixmap*>(device)->pixmapData();
- if (data->classId() == QPixmapData::DirectFBClass) {
- QDirectFBPixmapData* dfbPixmapData = static_cast<QDirectFBPixmapData*>(data);
- dfbDevice = static_cast<QDirectFBPaintDevice*>(dfbPixmapData);
- }
+ Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
+ QDirectFBPixmapData* dfbPixmapData = static_cast<QDirectFBPixmapData*>(data);
+ dfbDevice = static_cast<QDirectFBPaintDevice*>(dfbPixmapData);
}
if (dfbDevice)
@@ -373,6 +362,7 @@ void QDirectFBPaintEnginePrivate::begin(QPaintDevice *device)
void QDirectFBPaintEnginePrivate::end()
{
+ dfbDevice = 0;
surface->ReleaseSource(surface);
surface->SetClip(surface, NULL);
surface = 0;