diff options
author | Anders Bakken <anders.bakken@nokia.com> | 2009-07-01 23:07:01 (GMT) |
---|---|---|
committer | Anders Bakken <anders.bakken@nokia.com> | 2009-07-01 23:07:01 (GMT) |
commit | 3e303b195a79d555b907a6badbe4df5d4b8686b4 (patch) | |
tree | e6d58e5b7f692c004f8d6ba3f53b314333c7f09f /src/plugins | |
parent | 7c6ae7d93b2fe7fb3054798ad77b411608801388 (diff) | |
download | Qt-3e303b195a79d555b907a6badbe4df5d4b8686b4.zip Qt-3e303b195a79d555b907a6badbe4df5d4b8686b4.tar.gz Qt-3e303b195a79d555b907a6badbe4df5d4b8686b4.tar.bz2 |
Code cleanup
Move the code from QDirectFBPaintEnginePrivate::(end|begin) into
QDirectFBPaintEngine::(end|begin)
Reviewed-by: TrustMe
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 84 |
1 files changed, 36 insertions, 48 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 40bec0e..bac9f09 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -244,9 +244,6 @@ public: inline void updateClip(); void systemStateChanged(); - void begin(QPaintDevice *device); - void end(); - static IDirectFBSurface *getSurface(const QImage &img, bool *release); #ifdef QT_DIRECTFB_IMAGECACHE @@ -299,7 +296,34 @@ QDirectFBPaintEngine::~QDirectFBPaintEngine() bool QDirectFBPaintEngine::begin(QPaintDevice *device) { Q_D(QDirectFBPaintEngine); - d->begin(device); + d->lastLockedHeight = -1; + if (device->devType() == QInternal::CustomRaster) { + d->dfbDevice = static_cast<QDirectFBPaintDevice*>(device); + } else if (d->device->devType() == QInternal::Pixmap) { + QPixmapData *data = static_cast<QPixmap*>(device)->pixmapData(); + Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); + QDirectFBPixmapData *dfbPixmapData = static_cast<QDirectFBPixmapData*>(data); + d->dfbDevice = static_cast<QDirectFBPaintDevice*>(dfbPixmapData); + } + + if (d->dfbDevice) + d->surface = d->dfbDevice->directFBSurface(); + + if (!d->surface) { + qFatal("QDirectFBPaintEngine used on an invalid device: 0x%x", + device->devType()); + } + d->lockedMemory = 0; + + d->surface->GetSize(d->surface, &d->fbWidth, &d->fbHeight); + + d->setTransform(QTransform()); + d->antialiased = false; + d->setOpacity(255); + d->setCompositionMode(state()->compositionMode()); + d->dirtyClip = true; + d->setPen(state()->pen); + const bool status = QRasterPaintEngine::begin(device); // XXX: QRasterPaintEngine::begin() resets the capabilities @@ -311,8 +335,14 @@ bool QDirectFBPaintEngine::begin(QPaintDevice *device) bool QDirectFBPaintEngine::end() { Q_D(QDirectFBPaintEngine); - d->end(); - return QRasterPaintEngine::end(); + d->unlock(); + d->dfbDevice = 0; +#if (Q_DIRECTFB_VERSION >= 0x010000) + d->surface->ReleaseSource(d->surface); +#endif + d->surface->SetClip(d->surface, NULL); + d->surface = 0; + return true; } void QDirectFBPaintEngine::clipEnabledChanged() @@ -873,48 +903,6 @@ void QDirectFBPaintEnginePrivate::setTransform(const QTransform &m) } } -void QDirectFBPaintEnginePrivate::begin(QPaintDevice *device) -{ - lastLockedHeight = -1; - if (device->devType() == QInternal::CustomRaster) - dfbDevice = static_cast<QDirectFBPaintDevice*>(device); - else if (device->devType() == QInternal::Pixmap) { - QPixmapData *data = static_cast<QPixmap*>(device)->pixmapData(); - Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); - QDirectFBPixmapData* dfbPixmapData = static_cast<QDirectFBPixmapData*>(data); - dfbDevice = static_cast<QDirectFBPaintDevice*>(dfbPixmapData); - } - - if (dfbDevice) - surface = dfbDevice->directFBSurface(); - - if (!surface) { - qFatal("QDirectFBPaintEngine used on an invalid device: 0x%x", - device->devType()); - } - lockedMemory = 0; - - surface->GetSize(surface, &fbWidth, &fbHeight); - - setTransform(QTransform()); - antialiased = false; - setOpacity(255); - setCompositionMode(q->state()->compositionMode()); - dirtyClip = true; - setPen(q->state()->pen); -} - -void QDirectFBPaintEnginePrivate::end() -{ - lockedMemory = 0; - dfbDevice = 0; -#if (Q_DIRECTFB_VERSION >= 0x010000) - surface->ReleaseSource(surface); -#endif - surface->SetClip(surface, NULL); - surface = 0; -} - void QDirectFBPaintEnginePrivate::setPen(const QPen &p) { pen = p; |