summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp4
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp7
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp23
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h4
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp17
-rw-r--r--src/plugins/imageformats/svg/qsvgiohandler.cpp35
6 files changed, 78 insertions, 12 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 2fb533a..5be4d47 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -532,7 +532,9 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image,
d->prepareForBlit(QDirectFBScreen::hasAlpha(imgSurface));
d->blit(r, imgSurface, sr);
if (release) {
+#if (Q_DIRECTFB_VERSION >= 0x010000)
imgSurface->ReleaseSource(imgSurface);
+#endif
imgSurface->Release(imgSurface);
}
#endif
@@ -897,7 +899,9 @@ void QDirectFBPaintEnginePrivate::end()
{
lockedMemory = 0;
dfbDevice = 0;
+#if (Q_DIRECTFB_VERSION >= 0x010000)
surface->ReleaseSource(surface);
+#endif
surface->SetClip(surface, NULL);
surface = 0;
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index 18754f5..8184073 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -225,7 +225,9 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect)
const DFBRectangle blitRect = { rect.x(), rect.y(),
rect.width(), rect.height() };
DFBResult result = dfbSurface->Blit(dfbSurface, src, &blitRect, 0, 0);
+#if (Q_DIRECTFB_VERSION >= 0x010000)
dfbSurface->ReleaseSource(dfbSurface);
+#endif
if (result != DFB_OK) {
DirectFBError("QDirectFBPixmapData::copy()", result);
invalidate();
@@ -316,8 +318,9 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform,
const DFBRectangle destRect = { 0, 0, size.width(), size.height() };
data->dfbSurface->StretchBlit(data->dfbSurface, dfbSurface, 0, &destRect);
+#if (Q_DIRECTFB_VERSION >= 0x010000)
data->dfbSurface->ReleaseSource(data->dfbSurface);
-
+#endif
return QPixmap(data);
}
@@ -336,7 +339,9 @@ QImage QDirectFBPixmapData::toImage() const
imgSurface->SetBlittingFlags(imgSurface, DSBLIT_NOFX);
}
imgSurface->Blit(imgSurface, dfbSurface, 0, 0, 0);
+#if (Q_DIRECTFB_VERSION >= 0x010000)
imgSurface->ReleaseSource(imgSurface);
+#endif
imgSurface->Release(imgSurface);
return ret;
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 9e35a66..f694ed9 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -196,7 +196,9 @@ IDirectFBSurface *QDirectFBScreen::copyDFBSurface(IDirectFBSurface *src,
surface->SetBlittingFlags(surface, flags);
surface->Blit(surface, src, 0, 0, 0);
+#if (Q_DIRECTFB_VERSION >= 0x010000)
surface->ReleaseSource(surface);
+#endif
return surface;
}
@@ -317,7 +319,9 @@ IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img,
DFBResult result = dfbSurface->Blit(dfbSurface, imgSurface, 0, 0, 0);
if (result != DFB_OK)
DirectFBError("QDirectFBScreen::copyToDFBSurface()", result);
+#if (Q_DIRECTFB_VERSION >= 0x010000)
dfbSurface->ReleaseSource(dfbSurface);
+#endif
imgSurface->Release(imgSurface);
#else // QT_NO_DIRECTFB_PREALLOCATED
Q_ASSERT(image.format() == pixmapFormat);
@@ -388,10 +392,12 @@ DFBSurfacePixelFormat QDirectFBScreen::getSurfacePixelFormat(QImage::Format form
#endif
case QImage::Format_RGB16:
return DSPF_RGB16;
+#if (Q_DIRECTFB_VERSION >= 0x010000)
case QImage::Format_ARGB6666_Premultiplied:
return DSPF_ARGB6666;
case QImage::Format_RGB666:
return DSPF_RGB18;
+#endif
case QImage::Format_RGB32:
return DSPF_RGB32;
case QImage::Format_ARGB32_Premultiplied:
@@ -423,10 +429,12 @@ QImage::Format QDirectFBScreen::getImageFormat(IDirectFBSurface *surface)
return QImage::Format_RGB555;
case DSPF_RGB16:
return QImage::Format_RGB16;
+#if (Q_DIRECTFB_VERSION >= 0x010000)
case DSPF_ARGB6666:
return QImage::Format_ARGB6666_Premultiplied;
case DSPF_RGB18:
return QImage::Format_RGB666;
+#endif
case DSPF_RGB32:
return QImage::Format_RGB32;
case DSPF_ARGB: {
@@ -778,9 +786,13 @@ static const FlagDescription blitDescriptions[] = {
{ " DSBLIT_DST_PREMULTIPLY", DSBLIT_DST_PREMULTIPLY },
{ " DSBLIT_DEMULTIPLY", DSBLIT_DEMULTIPLY },
{ " DSBLIT_DEINTERLACE", DSBLIT_DEINTERLACE },
+#if (Q_DIRECTFB_VERSION >= 0x000923)
{ " DSBLIT_SRC_PREMULTCOLOR", DSBLIT_SRC_PREMULTCOLOR },
{ " DSBLIT_XOR", DSBLIT_XOR },
+#endif
+#if (Q_DIRECTFB_VERSION >= 0x010000)
{ " DSBLIT_INDEX_TRANSLATION", DSBLIT_INDEX_TRANSLATION },
+#endif
{ 0, 0 }
};
@@ -798,6 +810,7 @@ static const FlagDescription drawDescriptions[] = {
+#if (Q_DIRECTFB_VERSION >= 0x000923)
static const QByteArray flagDescriptions(uint mask, const FlagDescription *flags)
{
#ifdef QT_NO_DEBUG
@@ -818,9 +831,6 @@ static const QByteArray flagDescriptions(uint mask, const FlagDescription *flags
return (QLatin1Char(' ') + list.join(QLatin1String("|"))).toLatin1();
#endif
}
-
-
-
static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface)
{
DFBResult result;
@@ -845,6 +855,7 @@ static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface)
dev.drawing_flags, ::flagDescriptions(dev.drawing_flags, drawDescriptions).constData(),
(dev.video_memory >> 10));
}
+#endif
static inline bool setIntOption(const QStringList &arguments, const QString &variable, int *value)
{
@@ -1039,8 +1050,10 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
setGraphicsSystem(d_ptr);
+#if (Q_DIRECTFB_VERSION >= 0x000923)
if (displayArgs.contains(QLatin1String("debug"), Qt::CaseInsensitive))
printDirectFBInfo(d_ptr->dfb, d_ptr->dfbSurface);
+#endif
return true;
}
@@ -1223,7 +1236,9 @@ void QDirectFBScreen::compose(const QRegion &region)
blit(surface->image(), offset, r);
}
}
+#if (Q_DIRECTFB_VERSION >= 0x010000)
d_ptr->dfbSurface->ReleaseSource(d_ptr->dfbSurface);
+#endif
}
// Normally, when using DirectFB to compose the windows (I.e. when
@@ -1271,7 +1286,9 @@ void QDirectFBScreen::blit(const QImage &img, const QPoint &topLeft,
return;
}
blit(src, topLeft, reg);
+#if (Q_DIRECTFB_VERSION >= 0x010000)
d_ptr->dfbSurface->ReleaseSource(d_ptr->dfbSurface);
+#endif
src->Release(src);
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index 84199a2..c105590 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -177,11 +177,15 @@ inline bool QDirectFBScreen::hasAlpha(DFBSurfacePixelFormat format)
case DSPF_A1:
case DSPF_ARGB2554:
case DSPF_ARGB4444:
+#if (Q_DIRECTFB_VERSION >= 0x000923)
case DSPF_AYUV:
+#endif
+#if (Q_DIRECTFB_VERSION >= 0x010000)
case DSPF_A4:
case DSPF_ARGB1666:
case DSPF_ARGB6666:
case DSPF_LUT2:
+#endif
return true;
default:
return false;
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index 330eb88..442f8dd 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -188,14 +188,25 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect, const QRegion &mask)
if (!dfbWindow)
createWindow();
- if (isResize && isMove)
+#if (Q_DIRECTFB_VERSION >= 0x010000)
+ if (isResize && isMove) {
result = dfbWindow->SetBounds(dfbWindow, rect.x(), rect.y(),
rect.width(), rect.height());
- else if (isResize)
+ } else if (isResize) {
result = dfbWindow->Resize(dfbWindow,
rect.width(), rect.height());
- else if (isMove)
+ } else if (isMove) {
result = dfbWindow->MoveTo(dfbWindow, rect.x(), rect.y());
+ }
+#else
+ if (isResize) {
+ result = dfbWindow->Resize(dfbWindow,
+ rect.width(), rect.height());
+ }
+ if (isMove) {
+ result = dfbWindow->MoveTo(dfbWindow, rect.x(), rect.y());
+ }
+#endif
#endif
}
diff --git a/src/plugins/imageformats/svg/qsvgiohandler.cpp b/src/plugins/imageformats/svg/qsvgiohandler.cpp
index 41b247b..405a760 100644
--- a/src/plugins/imageformats/svg/qsvgiohandler.cpp
+++ b/src/plugins/imageformats/svg/qsvgiohandler.cpp
@@ -64,6 +64,7 @@ public:
}
bool load(QIODevice *device);
+ static bool findSvgTag(QIODevice *device);
QSvgRenderer *r;
QSize defaultSize;
@@ -86,6 +87,33 @@ bool QSvgIOHandlerPrivate::load(QIODevice *device)
return loaded;
}
+bool QSvgIOHandlerPrivate::findSvgTag(QIODevice *device)
+{
+ qint64 pos = device->pos();
+ device->seek(0);
+ char buffer[256];
+ const char svg_tag[] = "<svg";
+
+ while (1) {
+ int size = device->read(buffer, 256);
+ for (int i=0; i<size - 5; ++i) {
+ if (!memcmp(buffer + i, svg_tag, 4)) {
+ if (buffer[i+4] == ' ' || buffer[i+4] == '\t'
+ || buffer[i+4] == '\n' || buffer[i+4] == '\r')
+ {
+ device->seek(pos);
+ return true;
+ }
+ }
+ }
+ if (device->atEnd())
+ break;
+ device->seek(device->pos()-4);
+ }
+ device->seek(pos);
+ return false;
+}
+
QSvgIOHandler::QSvgIOHandler()
: d(new QSvgIOHandlerPrivate())
{
@@ -101,9 +129,7 @@ QSvgIOHandler::~QSvgIOHandler()
bool QSvgIOHandler::canRead() const
{
- QByteArray contents = device()->peek(80);
-
- return contents.contains("<svg");
+ return QSvgIOHandlerPrivate::findSvgTag(device());
}
@@ -182,8 +208,7 @@ bool QSvgIOHandler::supportsOption(ImageOption option) const
bool QSvgIOHandler::canRead(QIODevice *device)
{
- QByteArray contents = device->peek(80);
- return contents.contains("<svg");
+ return QSvgIOHandlerPrivate::findSvgTag(device);
}
QT_END_NAMESPACE