diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 32 |
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; |