diff options
author | Anders Bakken <anders.bakken@nokia.com> | 2009-06-18 00:31:23 (GMT) |
---|---|---|
committer | Anders Bakken <anders.bakken@nokia.com> | 2009-06-18 00:31:23 (GMT) |
commit | 7d6da125cb94f70f2b14b60c87ded71876e28149 (patch) | |
tree | af041c9630adba73a37872618e1c21b59778bb77 /src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | |
parent | f5d119bf15e248634ef02437ffd9b77755262f00 (diff) | |
download | Qt-7d6da125cb94f70f2b14b60c87ded71876e28149.zip Qt-7d6da125cb94f70f2b14b60c87ded71876e28149.tar.gz Qt-7d6da125cb94f70f2b14b60c87ded71876e28149.tar.bz2 |
Fix a couple of issues after QPixmapData optims
Make sure we always set w, h and d.
See fa8030a935acaacee570eee320e7510a4cfdc853
Reviewed-by: TrustMe
Diffstat (limited to 'src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp')
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index c239248..1c86466 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -72,9 +72,10 @@ void QDirectFBPixmapData::resize(int width, int height) } format = screen->pixelFormat(); - dfbSurface = QDirectFBScreen::instance()->createDFBSurface(QSize(width, height), - format, - QDirectFBScreen::TrackSurface); + dfbSurface = screen->createDFBSurface(QSize(width, height), + format, + QDirectFBScreen::TrackSurface); + d = screen->depth(); alpha = false; if (!dfbSurface) { invalidate(); @@ -195,8 +196,8 @@ void QDirectFBPixmapData::fromImage(const QImage &i, invalidate(); return; } - w = metric(QPaintDevice::PdmWidth); - h = metric(QPaintDevice::PdmHeight); + w = img.width(); + h = img.height(); is_null = (w <= 0 || h <= 0); d = metric(QPaintDevice::PdmDepth); setSerialNumber(++global_ser_no); @@ -209,7 +210,8 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect) return; } - IDirectFBSurface *src = static_cast<const QDirectFBPixmapData*>(data)->directFBSurface(); + const QDirectFBPixmapData *otherData = static_cast<const QDirectFBPixmapData*>(data); + IDirectFBSurface *src = otherData->directFBSurface(); alpha = data->hasAlphaChannel(); format = (alpha ? QDirectFBScreen::instance()->alphaPixmapFormat() @@ -232,6 +234,9 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect) } const DFBRectangle blitRect = { rect.x(), rect.y(), rect.width(), rect.height() }; + w = rect.width(); + h = rect.height(); + d = otherData->d; DFBResult result = dfbSurface->Blit(dfbSurface, src, &blitRect, 0, 0); #if (Q_DIRECTFB_VERSION >= 0x010000) dfbSurface->ReleaseSource(dfbSurface); @@ -303,9 +308,6 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform, return QPixmap(data); } - int w, h; - dfbSurface->GetSize(dfbSurface, &w, &h); - const QSize size = transform.mapRect(QRect(0, 0, w, h)).size(); if (size.isEmpty()) return QPixmap(); @@ -326,6 +328,8 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform, const DFBRectangle destRect = { 0, 0, size.width(), size.height() }; data->dfbSurface->StretchBlit(data->dfbSurface, dfbSurface, 0, &destRect); + data->w = size.width(); + data->h = size.height(); #if (Q_DIRECTFB_VERSION >= 0x010000) data->dfbSurface->ReleaseSource(data->dfbSurface); #endif @@ -338,7 +342,7 @@ QImage QDirectFBPixmapData::toImage() const return QImage(); #ifndef QT_NO_DIRECTFB_PREALLOCATED - QImage ret(size(), QDirectFBScreen::getImageFormat(dfbSurface)); + QImage ret(w, h, QDirectFBScreen::getImageFormat(dfbSurface)); if (IDirectFBSurface *imgSurface = screen->createDFBSurface(ret, QDirectFBScreen::DontTrackSurface)) { if (hasAlphaChannel()) { imgSurface->SetBlittingFlags(imgSurface, DSBLIT_BLEND_ALPHACHANNEL); @@ -387,6 +391,7 @@ void QDirectFBPixmapData::invalidate() { setSerialNumber(0); alpha = false; + d = w = h = 0; format = QImage::Format_Invalid; } |