summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@nokia.com>2010-03-07 19:06:05 (GMT)
committerLorn Potter <lorn.potter@nokia.com>2010-03-07 19:06:05 (GMT)
commit987ffcbad3337fd343febb305911298a37ed9b7e (patch)
tree3665886405a5bc5300ef8a1c0522780639f29843 /src/plugins
parent4e605d83b5966b08a82eb54e733c2f37bca6b5d6 (diff)
parent987458462994497f764baf253baca0faabdb63cc (diff)
downloadQt-987ffcbad3337fd343febb305911298a37ed9b7e.zip
Qt-987ffcbad3337fd343febb305911298a37ed9b7e.tar.gz
Qt-987ffcbad3337fd343febb305911298a37ed9b7e.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/codecs/cn/qgb18030codec.cpp59
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp227
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp2
-rw-r--r--src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp34
-rw-r--r--src/plugins/sqldrivers/odbc/odbc.pro1
5 files changed, 226 insertions, 97 deletions
diff --git a/src/plugins/codecs/cn/qgb18030codec.cpp b/src/plugins/codecs/cn/qgb18030codec.cpp
index 5537cf7..3f2eec7 100644
--- a/src/plugins/codecs/cn/qgb18030codec.cpp
+++ b/src/plugins/codecs/cn/qgb18030codec.cpp
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
#define Is3rdByte(c) (InRange((c), 0x81, 0xFE))
#define Is4thByte(c) (InRange((c), 0x30, 0x39))
-#define QValidChar(u) ((u) ? QChar((ushort)(u)) : QChar(QChar::ReplacementCharacter))
+#define qValidChar(u) ((u) ? (u) : static_cast<ushort>(QChar::ReplacementCharacter))
/* User-defined areas: UDA 1: 0xAAA1 - 0xAFFE (564/0)
UDA 2: 0xF8A1 - 0xFEFE (658/0)
@@ -160,7 +160,7 @@ QString QGb18030Codec::convertToUnicode(const char* chars, int len, ConverterSta
{
uchar buf[4];
int nbuf = 0;
- QChar replacement = QChar::ReplacementCharacter;
+ ushort replacement = QChar::ReplacementCharacter;
if (state) {
if (state->flags & ConvertInvalidToNull)
replacement = QChar::Null;
@@ -173,6 +173,9 @@ QString QGb18030Codec::convertToUnicode(const char* chars, int len, ConverterSta
int invalid = 0;
QString result;
+ result.resize(len);
+ int unicodeLen = 0;
+ ushort *const resultData = reinterpret_cast<ushort*>(result.data());
//qDebug("QGb18030Decoder::toUnicode(const char* chars, int len = %d)", len);
for (int i = 0; i < len; i++) {
uchar ch = chars[i];
@@ -180,14 +183,16 @@ QString QGb18030Codec::convertToUnicode(const char* chars, int len, ConverterSta
case 0:
if (ch < 0x80) {
// ASCII
- result += QLatin1Char(ch);
+ resultData[unicodeLen] = ch;
+ ++unicodeLen;
} else if (Is1stByte(ch)) {
// GB18030?
buf[0] = ch;
nbuf = 1;
} else {
// Invalid
- result += replacement;
+ resultData[unicodeLen] = replacement;
+ ++unicodeLen;
++invalid;
}
break;
@@ -198,9 +203,11 @@ QString QGb18030Codec::convertToUnicode(const char* chars, int len, ConverterSta
int clen = 2;
uint u = qt_Gb18030ToUnicode(buf, clen);
if (clen == 2) {
- result += QValidChar(u);
+ resultData[unicodeLen] = qValidChar(static_cast<ushort>(u));
+ ++unicodeLen;
} else {
- result += replacement;
+ resultData[unicodeLen] = replacement;
+ ++unicodeLen;
++invalid;
}
nbuf = 0;
@@ -209,7 +216,8 @@ QString QGb18030Codec::convertToUnicode(const char* chars, int len, ConverterSta
nbuf = 2;
} else {
// Error
- result += replacement;
+ resultData[unicodeLen] = replacement;
+ ++unicodeLen;
++invalid;
nbuf = 0;
}
@@ -220,7 +228,8 @@ QString QGb18030Codec::convertToUnicode(const char* chars, int len, ConverterSta
buf[2] = ch;
nbuf = 3;
} else {
- result += replacement;
+ resultData[unicodeLen] = replacement;
+ ++unicodeLen;
++invalid;
nbuf = 0;
}
@@ -232,19 +241,24 @@ QString QGb18030Codec::convertToUnicode(const char* chars, int len, ConverterSta
int clen = 4;
uint u = qt_Gb18030ToUnicode(buf, clen);
if (clen == 4) {
- result += QValidChar(u);
+ resultData[unicodeLen] = qValidChar(u);
+ ++unicodeLen;
} else {
- result += replacement;
+ resultData[unicodeLen] = replacement;
+ ++unicodeLen;
++invalid;
}
} else {
- result += replacement;
+ resultData[unicodeLen] = replacement;
+ ++unicodeLen;
++invalid;
}
nbuf = 0;
break;
}
}
+ result.resize(unicodeLen);
+
if (state) {
state->remainingChars = nbuf;
state->state_data[0] = (buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3];
@@ -342,7 +356,7 @@ QString QGbkCodec::convertToUnicode(const char* chars, int len, ConverterState *
int clen = 2;
uint u = qt_Gb18030ToUnicode(buf, clen);
if (clen == 2) {
- result += QValidChar(u);
+ result += qValidChar(u);
} else {
result += replacement;
++invalid;
@@ -445,7 +459,7 @@ QString QGb2312Codec::convertToUnicode(const char* chars, int len, ConverterStat
{
uchar buf[2];
int nbuf = 0;
- QChar replacement = QChar::ReplacementCharacter;
+ ushort replacement = QChar::ReplacementCharacter;
if (state) {
if (state->flags & ConvertInvalidToNull)
replacement = QChar::Null;
@@ -456,6 +470,9 @@ QString QGb2312Codec::convertToUnicode(const char* chars, int len, ConverterStat
int invalid = 0;
QString result;
+ result.resize(len);
+ int unicodeLen = 0;
+ ushort *const resultData = reinterpret_cast<ushort*>(result.data());
//qDebug("QGb2312Decoder::toUnicode(const char* chars, int len = %d)", len);
for (int i=0; i<len; i++) {
uchar ch = chars[i];
@@ -463,14 +480,16 @@ QString QGb2312Codec::convertToUnicode(const char* chars, int len, ConverterStat
case 0:
if (ch < 0x80) {
// ASCII
- result += QLatin1Char(ch);
+ resultData[unicodeLen] = ch;
+ ++unicodeLen;
} else if (IsByteInGb2312(ch)) {
// GB2312 1st byte?
buf[0] = ch;
nbuf = 1;
} else {
// Invalid
- result += replacement;
+ resultData[unicodeLen] = replacement;
+ ++unicodeLen;
++invalid;
}
break;
@@ -481,21 +500,25 @@ QString QGb2312Codec::convertToUnicode(const char* chars, int len, ConverterStat
int clen = 2;
uint u = qt_Gb18030ToUnicode(buf, clen);
if (clen == 2) {
- result += QValidChar(u);
+ resultData[unicodeLen] = qValidChar(static_cast<ushort>(u));
+ ++unicodeLen;
} else {
- result += replacement;
+ resultData[unicodeLen] = replacement;
+ ++unicodeLen;
++invalid;
}
nbuf = 0;
} else {
// Error
- result += replacement;
+ resultData[unicodeLen] = replacement;
+ ++unicodeLen;
++invalid;
nbuf = 0;
}
break;
}
}
+ result.resize(unicodeLen);
if (state) {
state->remainingChars = nbuf;
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 12f4c6b..54f4a8a 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -68,11 +68,10 @@ public:
};
enum CompositionModeStatus {
- PorterDuff_None = 0x00,
- PorterDuff_SupportedBlits = 0x01,
- PorterDuff_SupportedPrimitives = 0x02,
- PorterDuff_SupportedOpaquePrimitives = 0x04,
- PorterDuff_Dirty = 0x10
+ PorterDuff_None = 0x0,
+ PorterDuff_Supported = 0x1,
+ PorterDuff_PremultiplyColors = 0x2,
+ PorterDuff_AlwaysBlend = 0x4
};
enum ClipType {
@@ -97,7 +96,6 @@ public:
inline void unlock();
static inline void unlock(QDirectFBPaintDevice *device);
- inline bool testCompositionMode(const QPen *pen, const QBrush *brush, const QColor *color = 0) const;
inline bool isSimpleBrush(const QBrush &brush) const;
void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &pos);
@@ -130,6 +128,7 @@ public:
ClipType clipType;
QDirectFBPaintDevice *dfbDevice;
uint compositionModeStatus;
+ bool isPremultiplied;
bool inClip;
QRect currentClip;
@@ -168,7 +167,7 @@ struct CachedImage
static QCache<qint64, CachedImage> imageCache(4*1024*1024); // 4 MB
#endif
-#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS || defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
+#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS || defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS || defined QT_DEBUG
#define VOID_ARG() static_cast<bool>(false)
enum PaintOperation {
DRAW_RECTS = 0x0001, DRAW_LINES = 0x0002, DRAW_IMAGE = 0x0004,
@@ -178,9 +177,89 @@ enum PaintOperation {
FILL_RECT = 0x1000, DRAW_COLORSPANS = 0x2000, DRAW_ROUNDED_RECT = 0x4000,
DRAW_STATICTEXT = 0x8000, ALL = 0xffff
};
+
+#ifdef QT_DEBUG
+static void initRasterFallbacksMasks(int *warningMask, int *disableMask)
+{
+ struct {
+ const char *name;
+ PaintOperation operation;
+ } const operations[] = {
+ { "DRAW_RECTS", DRAW_RECTS },
+ { "DRAW_LINES", DRAW_LINES },
+ { "DRAW_IMAGE", DRAW_IMAGE },
+ { "DRAW_PIXMAP", DRAW_PIXMAP },
+ { "DRAW_TILED_PIXMAP", DRAW_TILED_PIXMAP },
+ { "STROKE_PATH", STROKE_PATH },
+ { "DRAW_PATH", DRAW_PATH },
+ { "DRAW_POINTS", DRAW_POINTS },
+ { "DRAW_ELLIPSE", DRAW_ELLIPSE },
+ { "DRAW_POLYGON", DRAW_POLYGON },
+ { "DRAW_TEXT", DRAW_TEXT },
+ { "FILL_PATH", FILL_PATH },
+ { "FILL_RECT", FILL_RECT },
+ { "DRAW_COLORSPANS", DRAW_COLORSPANS },
+ { "DRAW_ROUNDED_RECT", DRAW_ROUNDED_RECT },
+ { "ALL", ALL },
+ { 0, ALL }
+ };
+
+ QStringList warning = QString::fromLatin1(qgetenv("QT_DIRECTFB_WARN_ON_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|'),
+ QString::SkipEmptyParts);
+ QStringList disable = QString::fromLatin1(qgetenv("QT_DIRECTFB_DISABLE_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|'),
+ QString::SkipEmptyParts);
+ *warningMask = 0;
+ *disableMask = 0;
+ if (!warning.isEmpty() || !disable.isEmpty()) {
+ for (int i=0; operations[i].name; ++i) {
+ const QString name = QString::fromLatin1(operations[i].name);
+ int idx = warning.indexOf(name);
+ if (idx != -1) {
+ *warningMask |= operations[i].operation;
+ warning.remove(warning.begin() + idx);
+ }
+ idx = disable.indexOf(name);
+ if (idx != -1) {
+ *disableMask |= operations[i].operation;
+ disable.remove(disable.begin() + idx);
+ }
+ }
+ }
+ if (!warning.isEmpty()) {
+ qWarning("QDirectFBPaintEngine QT_DIRECTFB_WARN_ON_RASTERFALLBACKS Unknown operation(s): %s",
+ qPrintable(warning.join(QLatin1String("|"))));
+ }
+ if (!disable.isEmpty()) {
+ qWarning("QDirectFBPaintEngine QT_DIRECTFB_DISABLE_RASTERFALLBACKS Unknown operation(s): %s",
+ qPrintable(disable.join(QLatin1String("|"))));
+ }
+
+}
#endif
+static inline int rasterFallbacksMask(bool warn)
+{
#ifdef QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
+ if (warn)
+ return QT_DIRECTFB_WARN_ON_RASTERFALLBACKS;
+#endif
+#ifdef QT_DIRECTFB_DISABLE_RASTERFALLBACKS
+ if (!warn)
+ return QT_DIRECTFB_DISABLE_RASTERFALLBACKS;
+#endif
+#ifndef QT_DEBUG
+ return 0;
+#else
+ static int warnMask = -1;
+ static int disableMask = -1;
+ if (warnMask == -1)
+ initRasterFallbacksMasks(&warnMask, &disableMask);
+ return warn ? warnMask : disableMask;
+#endif
+}
+#endif
+
+#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS || defined QT_DEBUG
template <typename device, typename T1, typename T2, typename T3>
static void rasterFallbackWarn(const char *msg, const char *func, const device *dev,
uint transformationType, bool simplePen,
@@ -190,25 +269,31 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device *
const char *nameThree, const T3 &three);
#endif
-#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS && defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
+#if defined QT_DEBUG || (defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS && defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS)
#define RASTERFALLBACK(op, one, two, three) \
- if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS)) \
- rasterFallbackWarn("Disabled raster engine operation", \
- __FUNCTION__, state()->painter->device(), \
- d_func()->transformationType, \
- d_func()->simplePen, \
- d_func()->clipType, \
- d_func()->compositionModeStatus, \
- #one, one, #two, two, #three, three); \
- if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS)) \
- return;
+ { \
+ const bool disable = op & rasterFallbacksMask(false); \
+ if (op & rasterFallbacksMask(true)) \
+ rasterFallbackWarn(disable \
+ ? "Disabled raster engine operation" \
+ : "Falling back to raster engine for", \
+ __FUNCTION__, \
+ state()->painter->device(), \
+ d_func()->transformationType, \
+ d_func()->simplePen, \
+ d_func()->clipType, \
+ d_func()->compositionModeStatus, \
+ #one, one, #two, two, #three, three); \
+ if (disable) \
+ return; \
+ }
#elif defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
-#define RASTERFALLBACK(op, one, two, three) \
- if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS)) \
+#define RASTERFALLBACK(op, one, two, three) \
+ if (op & rasterFallbacksMask(false)) \
return;
#elif defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
#define RASTERFALLBACK(op, one, two, three) \
- if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS)) \
+ if (op & rasterFallbacksMask(true)) \
rasterFallbackWarn("Falling back to raster engine for", \
__FUNCTION__, state()->painter->device(), \
d_func()->transformationType, \
@@ -287,6 +372,7 @@ bool QDirectFBPaintEngine::begin(QPaintDevice *device)
qFatal("QDirectFBPaintEngine used on an invalid device: 0x%x",
device->devType());
}
+ d->isPremultiplied = QDirectFBScreen::isPremultiplied(d->dfbDevice->format());
d->prepare(d->dfbDevice);
gccaps = AllFeatures;
@@ -413,7 +499,7 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount)
|| !d->simplePen
|| d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
|| !d->isSimpleBrush(brush)
- || !d->testCompositionMode(&pen, &brush)) {
+ || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawRects(rects, rectCount);
@@ -443,7 +529,7 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount)
|| !d->simplePen
|| d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
|| !d->isSimpleBrush(brush)
- || !d->testCompositionMode(&pen, &brush)) {
+ || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawRects(rects, rectCount);
@@ -468,7 +554,7 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount)
const QPen &pen = state()->pen;
if (!d->simplePen
|| d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
- || !d->testCompositionMode(&pen, 0)) {
+ || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawLines(lines, lineCount);
@@ -488,7 +574,7 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount)
const QPen &pen = state()->pen;
if (!d->simplePen
|| d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
- || !d->testCompositionMode(&pen, 0)) {
+ || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawLines(lines, lineCount);
@@ -526,7 +612,7 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image,
*/
#if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE
- if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
+ if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)
|| (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
|| (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
|| (!d->supportsStretchBlit() && state()->matrix.mapRect(r).size() != sr.size())
@@ -575,7 +661,7 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap,
QPixmapData *data = pixmap.pixmapData();
Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
- if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
+ if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)
|| (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
|| (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
|| (!d->supportsStretchBlit() && state()->matrix.mapRect(r).size() != sr.size())) {
@@ -606,7 +692,7 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r,
RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset);
d->lock();
QRasterPaintEngine::drawTiledPixmap(r, pixmap, offset);
- } else if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
+ } else if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)
|| (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
|| (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
|| (!d->supportsStretchBlit() && state()->matrix.isScaling())) {
@@ -727,20 +813,21 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
if (d->clipType != QDirectFBPaintEnginePrivate::ComplexClip) {
switch (brush.style()) {
case Qt::SolidPattern: {
- if (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported
- || !d->testCompositionMode(0, &brush)) {
- break;
- }
const QColor color = brush.color();
if (!color.isValid())
return;
+
+ if (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported
+ || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
+ break;
+ }
d->setDFBColor(color);
const QRect r = state()->matrix.mapRect(rect).toRect();
CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()));
return; }
case Qt::TexturePattern: {
- if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
+ if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)
|| (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
|| (!d->supportsStretchBlit() && state()->matrix.isScaling())) {
break;
@@ -768,7 +855,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color)
Q_D(QDirectFBPaintEngine);
if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported)
|| (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
- || !d->testCompositionMode(0, 0, &color)) {
+ || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
RASTERFALLBACK(FILL_RECT, rect, color, VOID_ARG());
d->lock();
QRasterPaintEngine::fillRect(rect, color);
@@ -812,7 +899,7 @@ QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p
: surface(0), antialiased(false), simplePen(false),
transformationType(0), opacity(255),
clipType(ClipUnset), dfbDevice(0),
- compositionModeStatus(0), inClip(false), q(p)
+ compositionModeStatus(0), isPremultiplied(false), inClip(false), q(p)
{
fb = QDirectFBScreen::instance()->dfb();
surfaceCache = new SurfaceCache;
@@ -828,36 +915,6 @@ bool QDirectFBPaintEnginePrivate::isSimpleBrush(const QBrush &brush) const
return (brush.style() == Qt::NoBrush) || (brush.style() == Qt::SolidPattern && !antialiased);
}
-bool QDirectFBPaintEnginePrivate::testCompositionMode(const QPen *pen, const QBrush *brush, const QColor *color) const
-{
- Q_ASSERT(!pen || pen->style() == Qt::NoPen || pen->style() == Qt::SolidLine);
- Q_ASSERT(!brush || brush->style() == Qt::NoBrush || brush->style() == Qt::SolidPattern);
- switch (compositionModeStatus & (QDirectFBPaintEnginePrivate::PorterDuff_SupportedOpaquePrimitives
- |QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives)) {
- case QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives:
- return true;
- case QDirectFBPaintEnginePrivate::PorterDuff_SupportedOpaquePrimitives:
- if (pen && pen->style() == Qt::SolidLine && pen->color().alpha() != 255)
- return false;
- if (brush) {
- if (brush->style() == Qt::SolidPattern && brush->color().alpha() != 255) {
- return false;
- }
- } else if (color && color->alpha() != 255) {
- return false;
- }
- return true;
- case QDirectFBPaintEnginePrivate::PorterDuff_None:
- return false;
- default:
- // ### PorterDuff_SupportedOpaquePrimitives|PorterDuff_SupportedPrimitives can't be combined
- break;
- }
- Q_ASSERT(0);
- return false;
-}
-
-
void QDirectFBPaintEnginePrivate::lock()
{
// We will potentially get a new pointer to the buffer after a
@@ -920,21 +977,23 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m
static const bool forceRasterFallBack = qgetenv("QT_DIRECTFB_FORCE_RASTER").toInt() > 0;
if (forceRasterFallBack) {
- compositionModeStatus = 0;
+ compositionModeStatus = PorterDuff_None;
return;
}
- compositionModeStatus = PorterDuff_SupportedBlits;
+ compositionModeStatus = PorterDuff_Supported|PorterDuff_PremultiplyColors|PorterDuff_AlwaysBlend;
switch (mode) {
case QPainter::CompositionMode_Clear:
surface->SetPorterDuff(surface, DSPD_CLEAR);
break;
case QPainter::CompositionMode_Source:
surface->SetPorterDuff(surface, DSPD_SRC);
- compositionModeStatus |= PorterDuff_SupportedOpaquePrimitives;
+ compositionModeStatus &= ~PorterDuff_AlwaysBlend;
+ if (!isPremultiplied)
+ compositionModeStatus &= ~PorterDuff_PremultiplyColors;
break;
case QPainter::CompositionMode_SourceOver:
- compositionModeStatus |= PorterDuff_SupportedPrimitives;
+ compositionModeStatus &= ~PorterDuff_AlwaysBlend;
surface->SetPorterDuff(surface, DSPD_SRC_OVER);
break;
case QPainter::CompositionMode_DestinationOver:
@@ -942,6 +1001,8 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m
break;
case QPainter::CompositionMode_SourceIn:
surface->SetPorterDuff(surface, DSPD_SRC_IN);
+ if (!isPremultiplied)
+ compositionModeStatus &= ~PorterDuff_PremultiplyColors;
break;
case QPainter::CompositionMode_DestinationIn:
surface->SetPorterDuff(surface, DSPD_DST_IN);
@@ -952,6 +1013,11 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m
case QPainter::CompositionMode_DestinationOut:
surface->SetPorterDuff(surface, DSPD_DST_OUT);
break;
+#if (Q_DIRECTFB_VERSION >= 0x010209)
+ case QPainter::CompositionMode_Destination:
+ surface->SetPorterDuff(surface, DSPD_DST);
+ break;
+#endif
#if (Q_DIRECTFB_VERSION >= 0x010000)
case QPainter::CompositionMode_SourceAtop:
surface->SetPorterDuff(surface, DSPD_SRC_ATOP);
@@ -967,7 +1033,7 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m
break;
#endif
default:
- compositionModeStatus = 0;
+ compositionModeStatus = PorterDuff_None;
break;
}
}
@@ -989,9 +1055,6 @@ void QDirectFBPaintEnginePrivate::prepareForBlit(bool alpha)
}
surface->SetColor(surface, 0xff, 0xff, 0xff, opacity);
surface->SetBlittingFlags(surface, blittingFlags);
- if (compositionModeStatus & PorterDuff_Dirty) {
- setCompositionMode(q->state()->composition_mode);
- }
}
static inline uint ALPHA_MUL(uint x, uint a)
@@ -1004,12 +1067,20 @@ static inline uint ALPHA_MUL(uint x, uint a)
void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color)
{
Q_ASSERT(surface);
+ Q_ASSERT(compositionModeStatus & PorterDuff_Supported);
const quint8 alpha = (opacity == 255 ?
color.alpha() : ALPHA_MUL(color.alpha(), opacity));
- surface->SetColor(surface, color.red(), color.green(), color.blue(), alpha);
- surface->SetPorterDuff(surface, DSPD_NONE);
- surface->SetDrawingFlags(surface, alpha == 255 ? DSDRAW_NOFX : DSDRAW_BLEND);
- compositionModeStatus |= PorterDuff_Dirty;
+ QColor col;
+ if (compositionModeStatus & PorterDuff_PremultiplyColors) {
+ col = QColor(ALPHA_MUL(color.red(), alpha),
+ ALPHA_MUL(color.green(), alpha),
+ ALPHA_MUL(color.blue(), alpha),
+ alpha);
+ } else {
+ col = QColor(color.red(), color.green(), color.blue(), alpha);
+ }
+ surface->SetColor(surface, col.red(), col.green(), col.blue(), col.alpha());
+ surface->SetDrawingFlags(surface, alpha == 255 && !(compositionModeStatus & PorterDuff_AlwaysBlend) ? DSDRAW_NOFX : DSDRAW_BLEND);
}
IDirectFBSurface *QDirectFBPaintEnginePrivate::getSurface(const QImage &img, bool *release)
@@ -1291,7 +1362,7 @@ static inline void drawRects(const T *rects, int n, const QTransform &transform,
}
}
-#ifdef QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
+#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS || defined QT_DEBUG
template <typename T> inline const T *ptr(const T &t) { return &t; }
template <> inline const bool* ptr<bool>(const bool &) { return 0; }
template <typename device, typename T1, typename T2, typename T3>
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index ba50329..b5ac67d 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -425,7 +425,7 @@ void QDirectFBPixmapData::fill(const QColor &color)
Q_ASSERT(dfbSurface);
- alpha = (color.alpha() < 255);
+ alpha |= (color.alpha() < 255);
if (alpha && isOpaqueFormat(imageFormat)) {
QSize size;
diff --git a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp
index 7bcb74d..e78fec1 100644
--- a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp
+++ b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp
@@ -325,6 +325,36 @@ static const struct {
{ 0xffe8, Qt::Key_Meta },
{ 0xffe9, Qt::Key_Alt },
{ 0xffea, Qt::Key_Alt },
+
+ { 0xffb0, Qt::Key_0 },
+ { 0xffb1, Qt::Key_1 },
+ { 0xffb2, Qt::Key_2 },
+ { 0xffb3, Qt::Key_3 },
+ { 0xffb4, Qt::Key_4 },
+ { 0xffb5, Qt::Key_5 },
+ { 0xffb6, Qt::Key_6 },
+ { 0xffb7, Qt::Key_7 },
+ { 0xffb8, Qt::Key_8 },
+ { 0xffb9, Qt::Key_9 },
+
+ { 0xff8d, Qt::Key_Return },
+ { 0xffaa, Qt::Key_Asterisk },
+ { 0xffab, Qt::Key_Plus },
+ { 0xffad, Qt::Key_Minus },
+ { 0xffae, Qt::Key_Period },
+ { 0xffaf, Qt::Key_Slash },
+
+ { 0xff95, Qt::Key_Home },
+ { 0xff96, Qt::Key_Left },
+ { 0xff97, Qt::Key_Up },
+ { 0xff98, Qt::Key_Right },
+ { 0xff99, Qt::Key_Down },
+ { 0xff9a, Qt::Key_PageUp },
+ { 0xff9b, Qt::Key_PageDown },
+ { 0xff9c, Qt::Key_End },
+ { 0xff9e, Qt::Key_Insert },
+ { 0xff9f, Qt::Key_Delete },
+
{ 0, 0 }
};
@@ -483,6 +513,10 @@ bool QRfbKeyEvent::read(QTcpSocket *s)
keycode = keyMap[i].keycode;
i++;
}
+
+ if (keycode >= ' ' && keycode <= '~')
+ unicode = keycode;
+
if (!keycode) {
if (key <= 0xff) {
unicode = key;
diff --git a/src/plugins/sqldrivers/odbc/odbc.pro b/src/plugins/sqldrivers/odbc/odbc.pro
index 3de8ab2..2bf85f1 100644
--- a/src/plugins/sqldrivers/odbc/odbc.pro
+++ b/src/plugins/sqldrivers/odbc/odbc.pro
@@ -8,6 +8,7 @@ unix {
!contains( LIBS, .*odbc.* ) {
LIBS *= $$QT_LFLAGS_ODBC
}
+ DEFINES += UNICODE
}
win32 {