summaryrefslogtreecommitdiffstats
path: root/src/plugins/gfxdrivers
diff options
context:
space:
mode:
authorAnders Bakken <anders.bakken@nokia.com>2009-06-18 00:31:23 (GMT)
committerAnders Bakken <anders.bakken@nokia.com>2009-06-18 00:31:23 (GMT)
commit7d6da125cb94f70f2b14b60c87ded71876e28149 (patch)
treeaf041c9630adba73a37872618e1c21b59778bb77 /src/plugins/gfxdrivers
parentf5d119bf15e248634ef02437ffd9b77755262f00 (diff)
downloadQt-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')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp10
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp25
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp7
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h1
4 files changed, 20 insertions, 23 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
index 52f6a37..905fec3 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
@@ -129,18 +129,14 @@ int QDirectFBPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
if (!dfbSurface)
return 0;
- int w, h;
- dfbSurface->GetSize(dfbSurface, &w, &h);
-
switch (metric) {
case QPaintDevice::PdmWidth:
- return w;
case QPaintDevice::PdmHeight:
- return h;
+ return (metric == PdmWidth ? size().width() : size().height());
case QPaintDevice::PdmWidthMM:
- return (w * 1000) / dotsPerMeterX();
+ return (size().width() * 1000) / dotsPerMeterX();
case QPaintDevice::PdmHeightMM:
- return (h * 1000) / dotsPerMeterY();
+ return (size().height() * 1000) / dotsPerMeterY();
case QPaintDevice::PdmPhysicalDpiX:
case QPaintDevice::PdmDpiX:
return (dotsPerMeterX() * 254) / 10000; // 0.0254 meters-per-inch
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;
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 5d89994..62fef5b 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -751,12 +751,7 @@ QPixmapData *QDirectFBScreenPrivate::createPixmapData(QPixmapData::PixelType typ
return new QDirectFBPixmapData(type);
}
-#ifdef QT_NO_DEBUG
-struct FlagDescription;
-static const FlagDescription *accelerationDescriptions = 0;
-static const FlagDescription *blitDescriptions = 0;
-static const FlagDescription *drawDescriptions = 0;
-#else
+#ifndef QT_NO_DEBUG
struct FlagDescription {
const char *name;
uint flag;
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index c2c9a59..4239156 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -118,6 +118,7 @@ public:
SurfaceCreationOptions options);
void releaseDFBSurface(IDirectFBSurface *surface);
+ using QScreen::depth;
static int depth(DFBSurfacePixelFormat format);
static DFBSurfacePixelFormat getSurfacePixelFormat(QImage::Format format);