diff options
author | David Boddie <dboddie@trolltech.com> | 2009-03-31 18:09:31 (GMT) |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2009-03-31 18:09:31 (GMT) |
commit | c2ad3b2ab704b751f2900729892099a13ef200a0 (patch) | |
tree | 6e2220efa142be2b05bd2e08c72061005fd0e574 | |
parent | 65c16391fff38e28e4a9db215758b1df6c868a32 (diff) | |
parent | ac96e93728541897203a8d1bcbdf9e43c4af8758 (diff) | |
download | Qt-c2ad3b2ab704b751f2900729892099a13ef200a0.zip Qt-c2ad3b2ab704b751f2900729892099a13ef200a0.tar.gz Qt-c2ad3b2ab704b751f2900729892099a13ef200a0.tar.bz2 |
Merge branch '4.5' of /home/dboddie/git/qt-45/ into 4.5
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 55 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp | 8 |
2 files changed, 30 insertions, 33 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 90fc446..3b6ea80 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -61,17 +61,6 @@ static inline uint ALPHA_MUL(uint x, uint a) return t; } -static inline QRect mapRect(const QTransform &transform, const QRect &rect) -{ - return (transform.isIdentity() ? rect : transform.mapRect(rect)); -} - -static inline QRect mapRect(const QTransform &transform, const QRectF &rect) -{ - return (transform.isIdentity() ? rect : transform.mapRect(rect)). - toRect(); -} - class SurfaceCache { public: @@ -243,6 +232,7 @@ public: SurfaceCache *surfaceCache; QTransform transform; + int lastLockedHeight; private: // QRegion rectsToClippedRegion(const QRect *rects, int n) const; // QRegion rectsToClippedRegion(const QRectF *rects, int n) const; @@ -267,9 +257,9 @@ private: QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p) : surface(0), antialiased(false), forceRasterPrimitives(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), dfbDevice(0), q(p) + simpleBrush(false), matrixRotShear(false), matrixScale(false), lastLockedHeight(-1), + fbWidth(-1), fbHeight(-1), opacity(255), drawFlags(0), blitFlags(0), duffFlags(0), + dirtyFlags(false), dirtyClip(true), dfbHandledClip(false), dfbDevice(0), q(p) { fb = QDirectFBScreen::instance()->dfb(); surfaceCache = new SurfaceCache; @@ -311,6 +301,8 @@ 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. + lastLockedHeight = dfbDevice->height(); + Q_ASSERT(dfbDevice); prepare(dfbDevice); } @@ -330,6 +322,7 @@ 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) { @@ -538,7 +531,7 @@ QRegion QDirectFBPaintEnginePrivate::rectsToClippedRegion(const QRect *rects, QRegion region; for (int i = 0; i < n; ++i) { - const QRect r = ::mapRect(transform, rects[i]); + const QRect r = transform.mapRect(rects[i]); region += clip & r; } @@ -551,7 +544,7 @@ QRegion QDirectFBPaintEnginePrivate::rectsToClippedRegion(const QRectF *rects, QRegion region; for (int i = 0; i < n; ++i) { - const QRect r = ::mapRect(transform, rects[i]); + const QRect r = transform.mapRect(rects[i]).toRect(); region += clip & r; } @@ -580,7 +573,7 @@ void QDirectFBPaintEnginePrivate::fillRects(const QRect *rects, int n) const { QVarLengthArray<DFBRectangle> dfbRects(n); for (int i = 0; i < n; ++i) { - const QRect r = ::mapRect(transform, rects[i]); + const QRect r = transform.mapRect(rects[i]); dfbRects[i].x = r.x(); dfbRects[i].y = r.y(); dfbRects[i].w = r.width(); @@ -593,7 +586,7 @@ void QDirectFBPaintEnginePrivate::fillRects(const QRectF *rects, int n) const { QVarLengthArray<DFBRectangle> dfbRects(n); for (int i = 0; i < n; ++i) { - const QRect r = ::mapRect(transform, rects[i]); + const QRect r = transform.mapRect(rects[i]).toRect(); dfbRects[i].x = r.x(); dfbRects[i].y = r.y(); dfbRects[i].w = r.width(); @@ -605,7 +598,7 @@ void QDirectFBPaintEnginePrivate::fillRects(const QRectF *rects, int n) const void QDirectFBPaintEnginePrivate::drawRects(const QRect *rects, int n) const { for (int i = 0; i < n; ++i) { - const QRect r = ::mapRect(transform, rects[i]); + const QRect r = transform.mapRect(rects[i]); surface->DrawRectangle(surface, r.x(), r.y(), r.width() + 1, r.height() + 1); } @@ -614,7 +607,7 @@ void QDirectFBPaintEnginePrivate::drawRects(const QRect *rects, int n) const void QDirectFBPaintEnginePrivate::drawRects(const QRectF *rects, int n) const { for (int i = 0; i < n; ++i) { - const QRect r = ::mapRect(transform, rects[i]); + const QRect r = transform.mapRect(rects[i]).toRect(); surface->DrawRectangle(surface, r.x(), r.y(), r.width() + 1, r.height() + 1); } @@ -638,7 +631,7 @@ void QDirectFBPaintEnginePrivate::drawPixmap(const QRectF &dest, QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data); IDirectFBSurface *s = dfbData->directFBSurface(); const QRect sr = src.toRect(); - const QRect dr = ::mapRect(transform, dest); + const QRect dr = transform.mapRect(dest).toRect(); const DFBRectangle sRect = { sr.x(), sr.y(), sr.width(), sr.height() }; DFBResult result; @@ -670,7 +663,7 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data); IDirectFBSurface *s = dfbData->directFBSurface(); - const QRect dr = ::mapRect(transform, dest); + const QRect dr = transform.mapRect(dest).toRect(); DFBResult result = DFB_OK; if (!matrixScale && dr == QRect(0, 0, fbWidth, fbHeight)) { @@ -692,7 +685,7 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, result = surface->BatchBlit(surface, s, rects.constData(), points.constData(), points.size()); } else { - const QRect sr = ::mapRect(transform, QRect(0, 0, pixmap.width(), pixmap.height())); + const QRect sr = transform.mapRect(QRect(0, 0, pixmap.width(), pixmap.height())); const int dx = sr.width(); const int dy = sr.height(); const DFBRectangle sRect = { 0, 0, dx, dy }; @@ -765,7 +758,7 @@ void QDirectFBPaintEnginePrivate::drawImage(const QRectF &dest, } const QRect sr = src.toRect(); - const QRect dr = ::mapRect(transform, dest); + const QRect dr = transform.mapRect(dest).toRect(); const DFBRectangle sRect = { sr.x(), sr.y(), sr.width(), sr.height() }; surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); @@ -927,6 +920,9 @@ void QDirectFBPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) { Q_D(QDirectFBPaintEngine); d->setClipDirty(); + const QPoint bottom = d->transform.map(QPoint(0, path.controlPointRect().y2)); + if (bottom.y() >= d->lastLockedHeight) + d->lock(); QRasterPaintEngine::clip(path, op); } @@ -934,10 +930,15 @@ void QDirectFBPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) { Q_D(QDirectFBPaintEngine); d->setClipDirty(); + if (!d->clip()->hasRectClip && d->clip()->enabled) { + const QPoint bottom = d->transform.map(QPoint(0, rect.bottom())); + if (bottom.y() >= d->lastLockedHeight) + d->lock(); + } + QRasterPaintEngine::clip(rect, op); } - void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount) { Q_D(QDirectFBPaintEngine); @@ -1185,7 +1186,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) d->unlock(); d->updateFlags(); d->setDFBColor(brush.color()); - const QRect r = ::mapRect(d->transform, rect); + const QRect r = d->transform.mapRect(rect).toRect(); d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()); return; } @@ -1217,7 +1218,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color) d->unlock(); d->updateFlags(); d->setDFBColor(color); - const QRect r = ::mapRect(d->transform, rect); + const QRect r = d->transform.mapRect(rect).toRect(); d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()); } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 3a6b3a2..fd6f48a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -249,14 +249,10 @@ IDirectFBSurface* QDirectFBScreen::createDFBSurface(const DFBSurfaceDescription } IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img, - QImage::Format format, + QImage::Format pixmapFormat, SurfaceCreationOptions options) { QImage image = img; - const QImage::Format pixmapFormat = image.hasAlphaChannel() - ? QDirectFBScreen::alphaPixmapFormat() - : QDirectFBScreen::pixelFormat(); - if (QDirectFBScreen::getSurfacePixelFormat(image.format()) == DSPF_UNKNOWN #ifdef QT_NO_DIRECTFB_PREALLOCATED || image.format() != pixmapFormat @@ -266,7 +262,7 @@ IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img, } - IDirectFBSurface *dfbSurface = createDFBSurface(img.size(), format, options); + IDirectFBSurface *dfbSurface = createDFBSurface(img.size(), pixmapFormat, options); if (!dfbSurface) { qWarning("QDirectFBPixmapData::fromImage() Couldn't create surface"); return 0; |