From b7a7959cebb9e4dc13cda0f0d23ff16a110c5838 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 24 Jun 2009 14:12:15 -0700 Subject: Make sure simplePen gets set properly The logic regarding whether or not a pen was simple was broken. Essentially the pen is sonly simple if it should en up as a single pixel line. Reviewed-by: Donald --- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 3425d08..c77cd78 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -913,11 +913,17 @@ void QDirectFBPaintEnginePrivate::end() void QDirectFBPaintEnginePrivate::setPen(const QPen &p) { pen = p; - simplePen = (pen.style() == Qt::NoPen) || - (pen.style() == Qt::SolidLine - && !antialiased - && (pen.brush().style() == Qt::SolidPattern) - && (pen.widthF() <= 1 && scale != NoScale)); + if (pen.style() == Qt::NoPen) { + simplePen = true; + } else if (pen.style() == Qt::SolidLine + && !antialiased + && pen.brush().style() == Qt::SolidPattern + && pen.widthF() <= 1.0 + && (scale == NoScale || pen.isCosmetic())) { + simplePen = true; + } else { + simplePen = false; + } } void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode mode) -- cgit v0.12 From 592d9767f4299d7ad8a3b923cf0d272ec9c32861 Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Thu, 25 Jun 2009 07:15:18 +1000 Subject: Fixup ibase. delete -> delete [] --- src/sql/drivers/ibase/qsql_ibase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index ef48ec0..0033418 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -157,8 +157,8 @@ static void delDA(XSQLDA *&sqlda) if (!sqlda) return; for (int i = 0; i < sqlda->sqld; ++i) { - delete sqlda->sqlvar[i].sqlind; - delete sqlda->sqlvar[i].sqldata; + delete [] sqlda->sqlvar[i].sqlind; + delete [] sqlda->sqlvar[i].sqldata; } free(sqlda); sqlda = 0; -- cgit v0.12 From 9d66697a72dd3c26ed744ffecab50722eb9adaee Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 24 Jun 2009 14:29:32 -0700 Subject: Fix a rendering issue Make sure surfaces always are locked when used as source for something. Reviewed-by: TrustMe --- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 5 +++++ src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index c77cd78..3edef8f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -567,6 +567,7 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, QPixmapData *data = pixmap.pixmapData(); Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); QDirectFBPixmapData *dfbData = static_cast(data); + dfbData->unlockDirectFB(); IDirectFBSurface *s = dfbData->directFBSurface(); d->blit(r, s, sr); } @@ -598,6 +599,10 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r, QRasterPaintEngine::drawTiledPixmap(r, pix, sp); } else { d->unlock(); + QPixmapData *data = pixmap.pixmapData(); + Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); + QDirectFBPixmapData *dfbData = static_cast(data); + dfbData->unlockDirectFB(); d->drawTiledPixmap(r, pixmap); } } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index c2048d8..ce3d6e4 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -81,11 +81,9 @@ void QDirectFBPixmapData::resize(int width, int height) qWarning("QDirectFBPixmapData::resize(): Unable to allocate surface"); return; } - setSerialNumber(++global_ser_no); } - // mostly duplicated from qimage.cpp (QImageData::checkForAlphaPixels) static bool checkForAlphaPixels(const QImage &img) { @@ -200,6 +198,7 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect) QPixmapData::copy(data, rect); return; } + unlockDirectFB(); IDirectFBSurface *src = static_cast(data)->directFBSurface(); alpha = data->hasAlphaChannel(); @@ -282,10 +281,10 @@ void QDirectFBPixmapData::fill(const QColor &color) QPixmap QDirectFBPixmapData::transformed(const QTransform &transform, Qt::TransformationMode mode) const { + QDirectFBPixmapData *that = const_cast(this); if (!dfbSurface || transform.type() != QTransform::TxScale || mode != Qt::FastTransformation) { - QDirectFBPixmapData *that = const_cast(this); const QImage *image = that->buffer(); Q_ASSERT(image); const QImage transformed = image->transformed(transform, mode); @@ -294,6 +293,7 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform, data->fromImage(transformed, Qt::AutoColor); return QPixmap(data); } + that->unlockDirectFB(); int w, h; dfbSurface->GetSize(dfbSurface, &w, &h); -- cgit v0.12 From 74e782be57f22e41aeb6aa4bbec4e2921243097c Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 24 Jun 2009 14:40:39 -0700 Subject: Fix off by one bug in DirectFBPaintEngine This bug made us call lock more than we needed to. Reviewed-by: Donald --- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 3edef8f..40bec0e 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -378,7 +378,7 @@ void QDirectFBPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) Q_D(QDirectFBPaintEngine); d->dirtyClip = true; const QPoint bottom = d->transform.map(QPoint(0, int(path.controlPointRect().y2))); - if (bottom.y() >= d->lastLockedHeight) + if (bottom.y() > d->lastLockedHeight) d->lock(); QRasterPaintEngine::clip(path, op); } @@ -389,7 +389,7 @@ void QDirectFBPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) d->dirtyClip = true; if (d->clip() && !d->clip()->hasRectClip && d->clip()->enabled) { const QPoint bottom = d->transform.map(QPoint(0, rect.bottom())); - if (bottom.y() >= d->lastLockedHeight) + if (bottom.y() > d->lastLockedHeight) d->lock(); } -- cgit v0.12 From 10977eb209e743cf0010fd43ecf66f96815fad2f Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Thu, 25 Jun 2009 08:24:50 +1000 Subject: save on a couple of mallocs --- src/sql/drivers/psql/qsql_psql.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index ed9b98c..770df4c 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -834,7 +834,7 @@ bool QPSQLDriver::commitTransaction() if (d->pro == QPSQLDriver::Version8 || d->pro == QPSQLDriver::Version81 || d->pro == QPSQLDriver::Version82) { - transaction_failed = QByteArray(PQcmdStatus(res)) == QByteArray("ROLLBACK")?true:false; + transaction_failed = qstrcmp(PQcmdStatus(res), "ROLLBACK") == 0; } if (!res || PQresultStatus(res) != PGRES_COMMAND_OK || transaction_failed) { -- cgit v0.12 From 4b9784fcdd7321a5d82b8ae73edd1ae52786d7ad Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 25 Jun 2009 11:32:06 +0200 Subject: Change QSharedPointer to track (or not) pointers when the #define is enabled. This allows mixing of debug and non-debug code (possible on Unix systems) without causing assertion failures. Reviewed-by: Bradley T. Hughes --- src/corelib/tools/qsharedpointer_impl.h | 6 ++++-- src/corelib/tools/tools.pri | 2 ++ tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 928805a..0471a1b 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -48,6 +48,8 @@ #pragma qt_sync_stop_processing #endif +#include + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -138,14 +140,14 @@ namespace QtSharedPointer { inline void internalConstruct(T *ptr) { -#ifndef QT_NO_DEBUG +#ifdef QT_SHAREDPOINTER_TRACK_POINTERS if (ptr) internalSafetyCheckAdd(ptr); #endif value = ptr; } inline void internalDestroy() { -#ifndef QT_NO_DEBUG +#ifdef QT_SHAREDPOINTER_TRACK_POINTERS if (value) internalSafetyCheckRemove(value); #endif } diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index e5bf7e4..b70c7df 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -26,6 +26,8 @@ HEADERS += \ tools/qregexp.h \ tools/qringbuffer_p.h \ tools/qshareddata.h \ + tools/qsharedpointer.h \ + tools/qsharedpointer_impl.h \ tools/qset.h \ tools/qsize.h \ tools/qstack.h \ diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index 795ce76..a11164f 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ - +#define QT_SHAREDPOINTER_TRACK_POINTERS #include "qsharedpointer.h" #include "externaltests.h" #include @@ -995,6 +995,7 @@ void tst_QSharedPointer::invalidConstructs() test.setDebugMode(true); test.setQtModules(QTest::QExternalTest::QtCore); test.setProgramHeader( + "#define QT_SHAREDPOINTER_TRACK_POINTERS\n" "#include \n" "\n" "struct Data { int i; };\n" -- cgit v0.12