summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qfiledialog.cpp1
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp128
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp3
-rw-r--r--src/gui/gui.pro15
-rw-r--r--src/gui/image/qjpeghandler.cpp60
-rw-r--r--src/gui/image/qpixmap.cpp51
-rw-r--r--src/gui/image/qpixmap_x11.cpp3
-rw-r--r--src/gui/image/qpixmapfilter.cpp15
-rw-r--r--src/gui/itemviews/qtreeview.cpp4
-rw-r--r--src/gui/kernel/qapplication.cpp21
-rw-r--r--src/gui/kernel/qapplication_p.h4
-rw-r--r--src/gui/kernel/qapplication_s60.cpp4
-rw-r--r--src/gui/kernel/qapplication_x11.cpp1
-rw-r--r--src/gui/kernel/qdnd_win.cpp12
-rw-r--r--src/gui/painting/qbezier.cpp41
-rw-r--r--src/gui/painting/qprintengine_ps.cpp1
-rw-r--r--src/gui/painting/qprintengine_win.cpp2
-rw-r--r--src/gui/painting/qrasterizer.cpp180
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp20
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h6
-rw-r--r--src/gui/styles/qs60style.cpp3
-rw-r--r--src/gui/styles/qstylehelper_p.h2
-rw-r--r--src/gui/text/qstatictext.cpp5
-rw-r--r--src/gui/text/qtextcontrol.cpp6
-rw-r--r--src/gui/text/qtextdocumentfragment.cpp1
-rw-r--r--src/gui/text/qtexthtmlparser.cpp1
-rw-r--r--src/gui/widgets/qlabel.cpp27
-rw-r--r--src/gui/widgets/qlabel_p.h1
-rw-r--r--src/gui/widgets/qmenu_symbian.cpp8
-rw-r--r--src/gui/widgets/qsplashscreen.cpp7
30 files changed, 339 insertions, 294 deletions
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index cb74a3c..fc3c186 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -302,7 +302,6 @@ QT_BEGIN_INCLUDE_NAMESPACE
#endif
#include <qshortcut.h>
#ifdef Q_WS_MAC
-#include <private/qunicodetables_p.h>
#include <qmacstyle_mac.h>
#endif
QT_END_INCLUDE_NAMESPACE
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index c166c30..8dc15bf 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4751,7 +4751,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
ENSURE_TRANSFORM_PTR
QRect viewBoundingRect = translateOnlyTransform ? brect.translated(transformPtr->dx(), transformPtr->dy()).toAlignedRect()
: transformPtr->mapRect(brect).toAlignedRect();
- viewBoundingRect.adjust(-rectAdjust, -rectAdjust, rectAdjust, rectAdjust);
+ viewBoundingRect.adjust(-int(rectAdjust), -int(rectAdjust), rectAdjust, rectAdjust);
if (widget)
item->d_ptr->paintedViewBoundingRects.insert(widget, viewBoundingRect);
drawItem = exposedRegion ? exposedRegion->intersects(viewBoundingRect)
@@ -4814,6 +4814,27 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
}
}
+static inline void setClip(QPainter *painter, QGraphicsItem *item)
+{
+ painter->save();
+ QRectF clipRect;
+ const QPainterPath clipPath(item->shape());
+ if (QPathClipper::pathToRect(clipPath, &clipRect))
+ painter->setClipRect(clipRect, Qt::IntersectClip);
+ else
+ painter->setClipPath(clipPath, Qt::IntersectClip);
+}
+
+static inline void setWorldTransform(QPainter *painter, const QTransform *const transformPtr,
+ const QTransform *effectTransform)
+{
+ Q_ASSERT(transformPtr);
+ if (effectTransform)
+ painter->setWorldTransform(*transformPtr * *effectTransform);
+ else
+ painter->setWorldTransform(*transformPtr);
+}
+
void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const QTransform *const viewTransform,
const QTransform *const transformPtr, QRegion *exposedRegion, QWidget *widget,
qreal opacity, const QTransform *effectTransform,
@@ -4822,36 +4843,37 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q
const bool itemIsFullyTransparent = QGraphicsItemPrivate::isOpacityNull(opacity);
const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape);
const bool itemHasChildren = !item->d_ptr->children.isEmpty();
+ bool setChildClip = itemClipsChildrenToShape;
+ bool itemHasChildrenStackedBehind = false;
int i = 0;
if (itemHasChildren) {
+ if (itemClipsChildrenToShape)
+ setWorldTransform(painter, transformPtr, effectTransform);
+
item->d_ptr->ensureSortedChildren();
+ // Items with the 'ItemStacksBehindParent' flag are put in front of the list
+ // so all we have to do is to check the first item.
+ itemHasChildrenStackedBehind = (item->d_ptr->children.at(0)->d_ptr->flags
+ & QGraphicsItem::ItemStacksBehindParent);
- if (itemClipsChildrenToShape) {
- painter->save();
- Q_ASSERT(transformPtr);
- if (effectTransform)
- painter->setWorldTransform(*transformPtr * *effectTransform);
- else
- painter->setWorldTransform(*transformPtr);
- QRectF clipRect;
- const QPainterPath clipPath(item->shape());
- if (QPathClipper::pathToRect(clipPath, &clipRect))
- painter->setClipRect(clipRect, Qt::IntersectClip);
- else
- painter->setClipPath(clipPath, Qt::IntersectClip);
- }
+ if (itemHasChildrenStackedBehind) {
+ if (itemClipsChildrenToShape) {
+ setClip(painter, item);
+ setChildClip = false;
+ }
- // Draw children behind
- for (i = 0; i < item->d_ptr->children.size(); ++i) {
- QGraphicsItem *child = item->d_ptr->children.at(i);
- if (wasDirtyParentSceneTransform)
- child->d_ptr->dirtySceneTransform = 1;
- if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent))
- break;
- if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity))
- continue;
- drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform);
+ // Draw children behind
+ for (i = 0; i < item->d_ptr->children.size(); ++i) {
+ QGraphicsItem *child = item->d_ptr->children.at(i);
+ if (wasDirtyParentSceneTransform)
+ child->d_ptr->dirtySceneTransform = 1;
+ if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent))
+ break;
+ if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity))
+ continue;
+ drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform);
+ }
}
}
@@ -4864,38 +4886,50 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q
? *exposedRegion : QRegion(), exposedRegion == 0);
const bool itemClipsToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsToShape;
- const bool savePainter = itemClipsToShape || painterStateProtection;
- if (savePainter)
- painter->save();
+ bool restorePainterClip = false;
if (!itemHasChildren || !itemClipsChildrenToShape) {
- if (effectTransform)
- painter->setWorldTransform(*transformPtr * *effectTransform);
- else
- painter->setWorldTransform(*transformPtr);
+ // Item does not have children or clip children to shape.
+ setWorldTransform(painter, transformPtr, effectTransform);
+ if ((restorePainterClip = itemClipsToShape))
+ setClip(painter, item);
+ } else if (itemHasChildrenStackedBehind){
+ // Item clips children to shape and has children stacked behind, which means
+ // the painter is already clipped to the item's shape.
+ if (itemClipsToShape) {
+ // The clip is already correct. Ensure correct world transform.
+ setWorldTransform(painter, transformPtr, effectTransform);
+ } else {
+ // Remove clip (this also ensures correct world transform).
+ painter->restore();
+ setChildClip = true;
+ }
+ } else if (itemClipsToShape) {
+ // Item clips children and itself to shape. It does not have hildren stacked
+ // behind, which means the clip has not yet been set. We set it now and re-use it
+ // for the children.
+ setClip(painter, item);
+ setChildClip = false;
}
- if (itemClipsToShape) {
- QRectF clipRect;
- const QPainterPath clipPath(item->shape());
- if (QPathClipper::pathToRect(clipPath, &clipRect))
- painter->setClipRect(clipRect, Qt::IntersectClip);
- else
- painter->setClipPath(clipPath, Qt::IntersectClip);
- }
- painter->setOpacity(opacity);
+ if (painterStateProtection && !restorePainterClip)
+ painter->save();
+ painter->setOpacity(opacity);
if (!item->d_ptr->cacheMode && !item->d_ptr->isWidget)
item->paint(painter, &styleOptionTmp, widget);
else
drawItemHelper(item, painter, &styleOptionTmp, widget, painterStateProtection);
- if (savePainter)
+ if (painterStateProtection || restorePainterClip)
painter->restore();
}
// Draw children in front
if (itemHasChildren) {
+ if (setChildClip)
+ setClip(painter, item);
+
for (; i < item->d_ptr->children.size(); ++i) {
QGraphicsItem *child = item->d_ptr->children.at(i);
if (wasDirtyParentSceneTransform)
@@ -4904,11 +4938,11 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q
continue;
drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform);
}
- }
- // Restore child clip
- if (itemHasChildren && itemClipsChildrenToShape)
- painter->restore();
+ // Restore child clip
+ if (itemClipsChildrenToShape)
+ painter->restore();
+ }
}
void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, bool invalidateChildren,
@@ -5271,6 +5305,7 @@ void QGraphicsScene::drawItems(QPainter *painter,
if (!d->unpolishedItems.isEmpty())
d->_q_polishItems();
+ const qreal opacity = painter->opacity();
QTransform viewTransform = painter->worldTransform();
Q_UNUSED(options);
@@ -5304,6 +5339,7 @@ void QGraphicsScene::drawItems(QPainter *painter,
topLevelItems.at(i)->d_ptr->itemDiscovered = 0;
painter->setWorldTransform(viewTransform);
+ painter->setOpacity(opacity);
}
/*!
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index c8aca80..a566c8e 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -3475,7 +3475,8 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
// IndirectPainting (the else branch), because in that case we always save()
// and restore() in QGraphicsScene::drawItems().
if (!d->scene->d_func()->painterStateProtection)
- painter.setWorldTransform(viewTransform);
+ painter.setOpacity(1.0);
+ painter.setWorldTransform(viewTransform);
} else {
// Make sure we don't have unpolished items before we draw
if (!d->scene->d_func()->unpolishedItems.isEmpty())
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 13d2c77..90b5de5 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -60,21 +60,6 @@ symbian {
QMAKE_LFLAGS.ARMCC += --rw-base 0x800000
QMAKE_LFLAGS.GCCE += -Tdata 0xC00000
}
-
- # Partial upgrade SIS file
- vendorinfo = \
- "; Localised Vendor name" \
- "%{\"Nokia, Qt\"}" \
- " " \
- "; Unique Vendor name" \
- ":\"Nokia, Qt\"" \
- " "
- pu_header = "; Partial upgrade package for testing QtGui changes without reinstalling everything" \
- "$${LITERAL_HASH}{\"Qt gui\"}, (0x2001E61C), $${QT_MAJOR_VERSION},$${QT_MINOR_VERSION},$${QT_PATCH_VERSION}, TYPE=PU"
- partial_upgrade.pkg_prerules = pu_header vendorinfo
- partial_upgrade.sources = $$QMAKE_LIBDIR_QT/QtGui$${QT_LIBINFIX}.dll
- partial_upgrade.path = c:/sys/bin
- DEPLOYMENT = partial_upgrade $$DEPLOYMENT
}
neon:*-g++* {
diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp
index eda5efb..b9eda05 100644
--- a/src/gui/image/qjpeghandler.cpp
+++ b/src/gui/image/qjpeghandler.cpp
@@ -134,15 +134,18 @@ static void qt_init_source(j_decompress_ptr)
static boolean qt_fill_input_buffer(j_decompress_ptr cinfo)
{
my_jpeg_source_mgr* src = (my_jpeg_source_mgr*)cinfo->src;
+ qint64 num_read = 0;
if (src->memDevice) {
src->next_input_byte = (const JOCTET *)(src->memDevice->data().constData() + src->memDevice->pos());
- src->bytes_in_buffer = (size_t)(src->memDevice->data().size() - src->memDevice->pos());
- return true;
+ num_read = src->memDevice->data().size() - src->memDevice->pos();
+ src->device->seek(src->memDevice->data().size());
+ } else {
+ src->next_input_byte = src->buffer;
+ num_read = src->device->read((char*)src->buffer, max_buf);
}
- src->next_input_byte = src->buffer;
- int num_read = src->device->read((char*)src->buffer, max_buf);
if (num_read <= 0) {
// Insert a fake EOI marker - as per jpeglib recommendation
+ src->next_input_byte = src->buffer;
src->buffer[0] = (JOCTET) 0xFF;
src->buffer[1] = (JOCTET) JPEG_EOI;
src->bytes_in_buffer = 2;
@@ -183,13 +186,7 @@ static void qt_term_source(j_decompress_ptr cinfo)
{
my_jpeg_source_mgr* src = (my_jpeg_source_mgr*)cinfo->src;
if (!src->device->isSequential())
- {
- // read() isn't used for memDevice, so seek past everything that was used
- if (src->memDevice)
- src->device->seek(src->device->pos() + (src->memDevice->data().size() - src->memDevice->pos() - src->bytes_in_buffer));
- else
- src->device->seek(src->device->pos() - src->bytes_in_buffer);
- }
+ src->device->seek(src->device->pos() - src->bytes_in_buffer);
}
#if defined(Q_C_CALLBACKS)
@@ -518,29 +515,10 @@ inline my_jpeg_destination_mgr::my_jpeg_destination_mgr(QIODevice *device)
free_in_buffer = max_buf;
}
-static bool can_write_format(QImage::Format fmt)
-{
- switch (fmt) {
- case QImage::Format_Mono:
- case QImage::Format_MonoLSB:
- case QImage::Format_Indexed8:
- case QImage::Format_RGB888:
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- return true;
- break;
- default:
- break;
- }
- return false;
-}
-static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int sourceQuality)
+static bool write_jpeg_image(const QImage &image, QIODevice *device, int sourceQuality)
{
bool success = false;
- const QImage image = can_write_format(sourceImage.format()) ?
- sourceImage : sourceImage.convertToFormat(QImage::Format_RGB888);
const QVector<QRgb> cmap = image.colorTable();
struct jpeg_compress_struct cinfo;
@@ -617,7 +595,7 @@ static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int s
case QImage::Format_Mono:
case QImage::Format_MonoLSB:
if (gray) {
- const uchar* data = image.scanLine(cinfo.next_scanline);
+ const uchar* data = image.constScanLine(cinfo.next_scanline);
if (image.format() == QImage::Format_MonoLSB) {
for (int i=0; i<w; i++) {
bool bit = !!(*(data + (i >> 3)) & (1 << (i & 7)));
@@ -630,7 +608,7 @@ static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int s
}
}
} else {
- const uchar* data = image.scanLine(cinfo.next_scanline);
+ const uchar* data = image.constScanLine(cinfo.next_scanline);
if (image.format() == QImage::Format_MonoLSB) {
for (int i=0; i<w; i++) {
bool bit = !!(*(data + (i >> 3)) & (1 << (i & 7)));
@@ -650,13 +628,13 @@ static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int s
break;
case QImage::Format_Indexed8:
if (gray) {
- const uchar* pix = image.scanLine(cinfo.next_scanline);
+ const uchar* pix = image.constScanLine(cinfo.next_scanline);
for (int i=0; i<w; i++) {
*row = qRed(cmap[*pix]);
++row; ++pix;
}
} else {
- const uchar* pix = image.scanLine(cinfo.next_scanline);
+ const uchar* pix = image.constScanLine(cinfo.next_scanline);
for (int i=0; i<w; i++) {
*row++ = qRed(cmap[*pix]);
*row++ = qGreen(cmap[*pix]);
@@ -666,12 +644,12 @@ static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int s
}
break;
case QImage::Format_RGB888:
- memcpy(row, image.scanLine(cinfo.next_scanline), w * 3);
+ memcpy(row, image.constScanLine(cinfo.next_scanline), w * 3);
break;
case QImage::Format_RGB32:
case QImage::Format_ARGB32:
case QImage::Format_ARGB32_Premultiplied: {
- QRgb* rgb = (QRgb*)image.scanLine(cinfo.next_scanline);
+ const QRgb* rgb = (const QRgb*)image.constScanLine(cinfo.next_scanline);
for (int i=0; i<w; i++) {
*row++ = qRed(*rgb);
*row++ = qGreen(*rgb);
@@ -681,8 +659,12 @@ static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int s
break;
}
default:
- qWarning("QJpegHandler: unable to write image of format %i",
- image.format());
+ for (int i=0; i<w; i++) {
+ QRgb pix = image.pixel(i, cinfo.next_scanline);
+ *row++ = qRed(pix);
+ *row++ = qGreen(pix);
+ *row++ = qBlue(pix);
+ }
break;
}
jpeg_write_scanlines(&cinfo, row_pointer, 1);
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 66a861d..64d8ed2 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -664,14 +664,19 @@ void QPixmap::resize_helper(const QSize &s)
#if defined(Q_WS_X11)
if (x11Data && x11Data->x11_mask) {
- QX11PixmapData *pmData = static_cast<QX11PixmapData*>(pd);
- pmData->x11_mask = (Qt::HANDLE)XCreatePixmap(X11->display,
- RootWindow(x11Data->xinfo.display(),
- x11Data->xinfo.screen()),
- w, h, 1);
- GC gc = XCreateGC(X11->display, pmData->x11_mask, 0, 0);
- XCopyArea(X11->display, x11Data->x11_mask, pmData->x11_mask, gc, 0, 0, qMin(width(), w), qMin(height(), h), 0, 0);
- XFreeGC(X11->display, gc);
+ QPixmapData *newPd = pm.pixmapData();
+ QX11PixmapData *pmData = (newPd && newPd->classId() == QPixmapData::X11Class)
+ ? static_cast<QX11PixmapData*>(newPd) : 0;
+ if (pmData) {
+ pmData->x11_mask = (Qt::HANDLE)XCreatePixmap(X11->display,
+ RootWindow(x11Data->xinfo.display(),
+ x11Data->xinfo.screen()),
+ w, h, 1);
+ GC gc = XCreateGC(X11->display, pmData->x11_mask, 0, 0);
+ XCopyArea(X11->display, x11Data->x11_mask, pmData->x11_mask, gc, 0, 0,
+ qMin(width(), w), qMin(height(), h), 0, 0);
+ XFreeGC(X11->display, gc);
+ }
}
#endif
*this = pm;
@@ -836,7 +841,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
% HexString<quint64>(info.size())
% HexString<uint>(data ? data->pixelType() : QPixmapData::PixmapType);
- // Note: If no extension is provided, we try to match the
+ // Note: If no extension is provided, we try to match the
// file against known plugin extensions
if (!info.completeSuffix().isEmpty() && !info.exists())
return false;
@@ -1177,8 +1182,12 @@ Qt::HANDLE QPixmap::handle() const
{
#if defined(Q_WS_X11)
const QPixmapData *pd = pixmapData();
- if (pd && pd->classId() == QPixmapData::X11Class)
- return static_cast<const QX11PixmapData*>(pd)->handle();
+ if (pd) {
+ if (pd->classId() == QPixmapData::X11Class)
+ return static_cast<const QX11PixmapData*>(pd)->handle();
+ else
+ qWarning("QPixmap::handle(): Pixmap is not an X11 class pixmap");
+ }
#endif
return 0;
}
@@ -1789,13 +1798,27 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
Returns true if this pixmap has an alpha channel, \e or has a
mask, otherwise returns false.
- \warning This is potentially an expensive operation.
-
\sa hasAlphaChannel(), mask()
*/
bool QPixmap::hasAlpha() const
{
- return data && (data->hasAlphaChannel() || !data->mask().isNull());
+#if defined(Q_WS_X11)
+ if (data && data->hasAlphaChannel())
+ return true;
+ QPixmapData *pd = pixmapData();
+ if (pd && pd->classId() == QPixmapData::X11Class) {
+ QX11PixmapData *x11Data = static_cast<QX11PixmapData*>(pd);
+#ifndef QT_NO_XRENDER
+ if (x11Data->picture && x11Data->d == 32)
+ return true;
+#endif
+ if (x11Data->d == 1 || x11Data->x11_mask)
+ return true;
+ }
+ return false;
+#else
+ return data && data->hasAlphaChannel();
+#endif
}
/*!
diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp
index 3d9c363..01f2c11 100644
--- a/src/gui/image/qpixmap_x11.cpp
+++ b/src/gui/image/qpixmap_x11.cpp
@@ -1321,7 +1321,6 @@ QBitmap QX11PixmapData::mask() const
return mask;
}
-
/*!
Sets a mask bitmap.
@@ -1549,7 +1548,7 @@ QImage QX11PixmapData::toImage(const QRect &rect) const
if (!xiWrapper.xi)
return QImage();
- if (canTakeQImageFromXImage(xiWrapper))
+ if (!x11_mask && canTakeQImageFromXImage(xiWrapper))
return takeQImageFromXImage(xiWrapper);
QImage image = toImage(xiWrapper, rect);
diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp
index 70770c4..26bffcc 100644
--- a/src/gui/image/qpixmapfilter.cpp
+++ b/src/gui/image/qpixmapfilter.cpp
@@ -764,10 +764,17 @@ void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transp
}
if (transposed == 0) {
- qt_memrotate90(reinterpret_cast<const quint32*>(temp.bits()),
- temp.width(), temp.height(), temp.bytesPerLine(),
- reinterpret_cast<quint32*>(img.bits()),
- img.bytesPerLine());
+ if (img.depth() == 8) {
+ qt_memrotate90(reinterpret_cast<const quint8*>(temp.bits()),
+ temp.width(), temp.height(), temp.bytesPerLine(),
+ reinterpret_cast<quint8*>(img.bits()),
+ img.bytesPerLine());
+ } else {
+ qt_memrotate90(reinterpret_cast<const quint32*>(temp.bits()),
+ temp.width(), temp.height(), temp.bytesPerLine(),
+ reinterpret_cast<quint32*>(img.bits()),
+ img.bytesPerLine());
+ }
} else {
img = temp;
}
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index b797776..40b51fe 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -3435,6 +3435,10 @@ void QTreeViewPrivate::updateScrollBars()
if (!viewportSize.isValid())
viewportSize = QSize(0, 0);
+ if (viewItems.isEmpty()) {
+ q->doItemsLayout();
+ }
+
int itemsInViewport = 0;
if (uniformRowHeights) {
if (defaultItemHeight <= 0)
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 2fd2f46..fdacefc 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -494,6 +494,7 @@ bool QApplicationPrivate::fade_tooltip = false;
bool QApplicationPrivate::animate_toolbox = false;
bool QApplicationPrivate::widgetCount = false;
bool QApplicationPrivate::load_testability = false;
+QString QApplicationPrivate::qmljsDebugArguments;
#ifdef QT_KEYPAD_NAVIGATION
# ifdef Q_OS_SYMBIAN
Qt::NavigationMode QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadDirectional;
@@ -565,6 +566,8 @@ void QApplicationPrivate::process_cmdline()
QString s;
if (arg == "-qdevel" || arg == "-qdebug") {
// obsolete argument
+ } else if (arg.indexOf("-qmljsdebugger=", 0) != -1) {
+ qmljsDebugArguments = QString::fromLocal8Bit(arg.right(arg.length() - 15));
} else if (arg.indexOf("-style=", 0) != -1) {
s = QString::fromLocal8Bit(arg.right(arg.length() - 7).toLower());
} else if (arg == "-style" && i < argc-1) {
@@ -670,6 +673,9 @@ void QApplicationPrivate::process_cmdline()
Qt::RightToLeft
\o -graphicssystem, sets the backend to be used for on-screen widgets
and QPixmaps. Available options are \c{raster} and \c{opengl}.
+ \o -qmljsdebugger=, activates the QML/JS debugger with a specified port.
+ The value must be of format port:1234[,block], where block is optional
+ and will make the application wait until a debugger connects to it.
\endlist
The X11 version of Qt supports some traditional X11 command line options:
@@ -705,6 +711,12 @@ void QApplicationPrivate::process_cmdline()
done.
\endlist
+ \section1 X11 Notes
+
+ If QApplication fails to open the X11 display, it will terminate
+ the process. This behavior is consistent with most X11
+ applications.
+
\sa arguments()
*/
@@ -2391,8 +2403,13 @@ static const char *application_menu_strings[] = {
};
QString qt_mac_applicationmenu_string(int type)
{
- return qApp->translate("MAC_APPLICATION_MENU",
- application_menu_strings[type]);
+ QString menuString = QString::fromLatin1(application_menu_strings[type]);
+ QString translated = qApp->translate("QMenuBar", application_menu_strings[type]);
+ if (translated != menuString)
+ return translated;
+ else
+ return qApp->translate("MAC_APPLICATION_MENU",
+ application_menu_strings[type]);
}
#endif
#endif
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index 8dc16e0..9c5095d 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -446,6 +446,8 @@ public:
static bool animate_toolbox;
static bool widgetCount; // Coupled with -widgetcount switch
static bool load_testability; // Coupled with -testability switch
+ static QString qmljsDebugArguments; // a string containing arguments for js/qml debugging.
+
#ifdef Q_WS_MAC
static bool native_modal_dialog_active;
#endif
@@ -528,12 +530,12 @@ public:
#ifndef QT_NO_GESTURES
QGestureManager *gestureManager;
QWidget *gestureWidget;
+#endif
#if defined(Q_WS_X11) || defined(Q_WS_WIN)
QPixmap *move_cursor;
QPixmap *copy_cursor;
QPixmap *link_cursor;
#endif
-#endif
#if defined(Q_WS_WIN)
QPixmap *ignore_cursor;
#endif
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index e937918..2be3ed3 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1341,6 +1341,10 @@ void QSymbianControl::setFocusSafely(bool focus)
// focus in Symbian. If this is not executed, the control which happens to be on
// the top of the stack may randomly be assigned focus by Symbian, for example
// when creating new windows (specifically in CCoeAppUi::HandleStackChanged()).
+
+ // Close any popups.
+ CEikonEnv::Static()->EikAppUi()->StopDisplayingMenuBar();
+
if (focus) {
S60->appUi()->RemoveFromStack(this);
// Symbian doesn't automatically remove focus from the last focused control, so we need to
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index e7b7ed8..d8fb74c 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -74,7 +74,6 @@
#include "qevent_p.h"
#include "qvarlengtharray.h"
#include "qdebug.h"
-#include <private/qunicodetables_p.h>
#include <private/qcrashhandler_p.h>
#include <private/qcolor_p.h>
#include <private/qcursor_p.h>
diff --git a/src/gui/kernel/qdnd_win.cpp b/src/gui/kernel/qdnd_win.cpp
index a164c2a..7083886 100644
--- a/src/gui/kernel/qdnd_win.cpp
+++ b/src/gui/kernel/qdnd_win.cpp
@@ -515,7 +515,7 @@ static inline Qt::MouseButtons keystate_to_mousebutton(DWORD grfKeyState)
//---------------------------------------------------------------------
// IDropSource Methods
//---------------------------------------------------------------------
-STDMETHODIMP
+QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState)
{
#ifdef QDND_DEBUG
@@ -545,7 +545,7 @@ QOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState)
}
}
-STDMETHODIMP
+QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QOleDropSource::GiveFeedback(DWORD dwEffect)
{
Qt::DropAction action = translateToQDragDropAction(dwEffect);
@@ -626,7 +626,7 @@ QOleDropTarget::Release(void)
// IDropTarget Methods
//---------------------------------------------------------------------
-STDMETHODIMP
+QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QOleDropTarget::DragEnter(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
{
#ifdef QDND_DEBUG
@@ -688,7 +688,7 @@ void QOleDropTarget::sendDragEnterEvent(QWidget *dragEnterWidget, DWORD grfKeySt
}
-STDMETHODIMP
+QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
{
#ifdef QDND_DEBUG
@@ -758,7 +758,7 @@ QOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
return NOERROR;
}
-STDMETHODIMP
+QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QOleDropTarget::DragLeave()
{
#ifdef QDND_DEBUG
@@ -785,7 +785,7 @@ QOleDropTarget::DragLeave()
#define KEY_STATE_BUTTON_MASK (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)
-STDMETHODIMP
+QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QOleDropTarget::Drop(LPDATAOBJECT /*pDataObj*/, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
{
#ifdef QDND_DEBUG
diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp
index 2a9b31a..54c81ba 100644
--- a/src/gui/painting/qbezier.cpp
+++ b/src/gui/painting/qbezier.cpp
@@ -293,36 +293,6 @@ static ShiftResult good_offset(const QBezier *b1, const QBezier *b2, qreal offse
return Ok;
}
-static inline QLineF qline_shifted(const QPointF &p1, const QPointF &p2, qreal offset)
-{
- QLineF l(p1, p2);
- QLineF ln = l.normalVector().unitVector();
- l.translate(ln.dx() * offset, ln.dy() * offset);
- return l;
-}
-
-static bool qbezier_is_line(QPointF *points, int pointCount)
-{
- Q_ASSERT(pointCount > 2);
-
- qreal dx13 = points[2].x() - points[0].x();
- qreal dy13 = points[2].y() - points[0].y();
-
- qreal dx12 = points[1].x() - points[0].x();
- qreal dy12 = points[1].y() - points[0].y();
-
- if (pointCount == 3) {
- return qFuzzyCompare(dx12 * dy13, dx13 * dy12);
- } else if (pointCount == 4) {
- qreal dx14 = points[3].x() - points[0].x();
- qreal dy14 = points[3].y() - points[0].y();
-
- return (qFuzzyCompare(dx12 * dy13, dx13 * dy12) && qFuzzyCompare(dx12 * dy14, dx14 * dy12));
- }
-
- return false;
-}
-
static ShiftResult shift(const QBezier *orig, QBezier *shifted, qreal offset, qreal threshold)
{
int map[4];
@@ -353,17 +323,6 @@ static ShiftResult shift(const QBezier *orig, QBezier *shifted, qreal offset, qr
if (np == 1)
return Discard;
- // We need to specialcase lines of 3 or 4 points due to numerical
- // instability in intersections below
- if (np > 2 && qbezier_is_line(points, np)) {
- if (points[0] == points[np-1])
- return Discard;
-
- QLineF l = qline_shifted(points[0], points[np-1], offset);
- *shifted = QBezier::fromPoints(l.p1(), l.pointAt(qreal(0.33)), l.pointAt(qreal(0.66)), l.p2());
- return Ok;
- }
-
QRectF b = orig->bounds();
if (np == 4 && b.width() < .1*offset && b.height() < .1*offset) {
qreal l = (orig->x1 - orig->x2)*(orig->x1 - orig->x2) +
diff --git a/src/gui/painting/qprintengine_ps.cpp b/src/gui/painting/qprintengine_ps.cpp
index 28e9a7a..ca694ae 100644
--- a/src/gui/painting/qprintengine_ps.cpp
+++ b/src/gui/painting/qprintengine_ps.cpp
@@ -64,7 +64,6 @@
#include "qbitmap.h"
#include "qregion.h"
#include "qimagewriter.h"
-#include <private/qunicodetables_p.h>
#include <private/qpainterpath_p.h>
#include <qdebug.h>
#include <private/qdrawhelper_p.h>
diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp
index dd4de99..afae0a5 100644
--- a/src/gui/painting/qprintengine_win.cpp
+++ b/src/gui/painting/qprintengine_win.cpp
@@ -851,7 +851,7 @@ void QWin32PrintEnginePrivate::strokePath_dev(const QPainterPath &path, const QC
HPEN pen = ExtCreatePen(((penWidth == 0) ? PS_COSMETIC : PS_GEOMETRIC)
| PS_SOLID | capStyle | joinStyle,
- penWidth, &brush, 0, 0);
+ (penWidth == 0) ? 1 : penWidth, &brush, 0, 0);
HGDIOBJ old_pen = SelectObject(hdc, pen);
StrokePath(hdc);
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp
index f8f8afb..4fded1f 100644
--- a/src/gui/painting/qrasterizer.cpp
+++ b/src/gui/painting/qrasterizer.cpp
@@ -65,6 +65,12 @@ typedef int Q16Dot16;
#define COORD_ROUNDING 1 // 0: round up, 1: round down
#define COORD_OFFSET 32 // 26.6, 32 is half a pixel
+static inline QT_FT_Vector PointToVector(const QPointF &p)
+{
+ QT_FT_Vector result = { QT_FT_Pos(p.x() * 64), QT_FT_Pos(p.y() * 64) };
+ return result;
+}
+
class QSpanBuffer {
public:
QSpanBuffer(ProcessSpans blend, void *data, const QRect &clipRect)
@@ -693,9 +699,9 @@ static Q16Dot16 intersectPixelFP(int x, Q16Dot16 top, Q16Dot16 bottom, Q16Dot16
}
}
-static inline bool q16Dot16Compare(qreal p1, qreal p2)
+static inline bool q26Dot6Compare(qreal p1, qreal p2)
{
- return FloatToQ16Dot16(p2 - p1) == 0;
+ return int((p2 - p1) * 64.) == 0;
}
static inline qreal qFloorF(qreal v)
@@ -708,6 +714,12 @@ static inline qreal qFloorF(qreal v)
return floor(v);
}
+static inline QPointF snapTo26Dot6Grid(const QPointF &p)
+{
+ return QPointF(qFloorF(p.x() * 64) * (1 / qreal(64)),
+ qFloorF(p.y() * 64) * (1 / qreal(64)));
+}
+
void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bool squareCap)
{
if (a == b || width == 0 || d->clipRect.isEmpty())
@@ -718,17 +730,21 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
QPointF pa = a;
QPointF pb = b;
- QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5;
- if (squareCap)
- offs += QPointF(offs.y(), offs.x());
+ if (squareCap) {
+ QPointF delta = pb - pa;
+ pa -= (0.5f * width) * delta;
+ pb += (0.5f * width) * delta;
+ }
+
+ QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5;
const QRectF clip(d->clipRect.topLeft() - offs, d->clipRect.bottomRight() + QPoint(1, 1) + offs);
- if (!clip.contains(a) || !clip.contains(b)) {
+ if (!clip.contains(pa) || !clip.contains(pb)) {
qreal t1 = 0;
qreal t2 = 1;
- const qreal o[2] = { a.x(), a.y() };
- const qreal d[2] = { b.x() - a.x(), b.y() - a.y() };
+ const qreal o[2] = { pa.x(), pa.y() };
+ const qreal d[2] = { pb.x() - pa.x(), pb.y() - pa.y() };
const qreal low[2] = { clip.left(), clip.top() };
const qreal high[2] = { clip.right(), clip.bottom() };
@@ -751,8 +767,12 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
if (t1 >= t2)
return;
}
- pa = a + (b - a) * t1;
- pb = a + (b - a) * t2;
+
+ QPointF npa = pa + (pb - pa) * t1;
+ QPointF npb = pa + (pb - pa) * t2;
+
+ pa = npa;
+ pb = npb;
}
if (!d->antialiased) {
@@ -763,15 +783,6 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
}
{
- const qreal gridResolution = 64;
- const qreal reciprocal = 1 / gridResolution;
-
- // snap to grid to prevent large slopes
- pa.rx() = qFloorF(pa.rx() * gridResolution) * reciprocal;
- pa.ry() = qFloorF(pa.ry() * gridResolution) * reciprocal;
- pb.rx() = qFloorF(pb.rx() * gridResolution) * reciprocal;
- pb.ry() = qFloorF(pb.ry() * gridResolution) * reciprocal;
-
// old delta
const QPointF d0 = a - b;
const qreal w0 = d0.x() * d0.x() + d0.y() * d0.y();
@@ -789,7 +800,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
QSpanBuffer buffer(d->blend, d->data, d->clipRect);
- if (q16Dot16Compare(pa.y(), pb.y())) {
+ if (q26Dot6Compare(pa.y(), pb.y())) {
const qreal x = (pa.x() + pb.x()) * 0.5f;
const qreal dx = qAbs(pb.x() - pa.x()) * 0.5f;
@@ -799,26 +810,16 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
pa = QPointF(x, y - dy);
pb = QPointF(x, y + dy);
- if (squareCap)
- width = 1 / width + 1.0f;
- else
- width = 1 / width;
-
- squareCap = false;
+ width = 1 / width;
}
- if (q16Dot16Compare(pa.x(), pb.x())) {
+ if (q26Dot6Compare(pa.x(), pb.x())) {
if (pa.y() > pb.y())
qSwap(pa, pb);
const qreal dy = pb.y() - pa.y();
const qreal halfWidth = 0.5f * width * dy;
- if (squareCap) {
- pa.ry() -= halfWidth;
- pb.ry() += halfWidth;
- }
-
qreal left = pa.x() - halfWidth;
qreal right = pa.x() + halfWidth;
@@ -828,7 +829,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
pa.ry() = qBound(qreal(d->clipRect.top()), pa.y(), qreal(d->clipRect.bottom() + 1));
pb.ry() = qBound(qreal(d->clipRect.top()), pb.y(), qreal(d->clipRect.bottom() + 1));
- if (q16Dot16Compare(left, right) || q16Dot16Compare(pa.y(), pb.y()))
+ if (q26Dot6Compare(left, right) || q26Dot6Compare(pa.y(), pb.y()))
return;
if (d->antialiased) {
@@ -899,11 +900,6 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
delta *= 0.5f * width;
const QPointF perp(delta.y(), -delta.x());
- if (squareCap) {
- pa -= delta;
- pb += delta;
- }
-
QPointF top;
QPointF left;
QPointF right;
@@ -921,14 +917,36 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
bottom = pb + perp;
}
+ top = snapTo26Dot6Grid(top);
+ bottom = snapTo26Dot6Grid(bottom);
+ left = snapTo26Dot6Grid(left);
+ right = snapTo26Dot6Grid(right);
+
const qreal topBound = qBound(qreal(d->clipRect.top()), top.y(), qreal(d->clipRect.bottom()));
const qreal bottomBound = qBound(qreal(d->clipRect.top()), bottom.y(), qreal(d->clipRect.bottom()));
- const qreal leftSlope = (left.x() - top.x()) / (left.y() - top.y());
- const qreal rightSlope = -1.0f / leftSlope;
+ const QPointF topLeftEdge = left - top;
+ const QPointF topRightEdge = right - top;
+ const QPointF bottomLeftEdge = bottom - left;
+ const QPointF bottomRightEdge = bottom - right;
+
+ const qreal topLeftSlope = topLeftEdge.x() / topLeftEdge.y();
+ const qreal bottomLeftSlope = bottomLeftEdge.x() / bottomLeftEdge.y();
+
+ const qreal topRightSlope = topRightEdge.x() / topRightEdge.y();
+ const qreal bottomRightSlope = bottomRightEdge.x() / bottomRightEdge.y();
+
+ const Q16Dot16 topLeftSlopeFP = FloatToQ16Dot16(topLeftSlope);
+ const Q16Dot16 topRightSlopeFP = FloatToQ16Dot16(topRightSlope);
- const Q16Dot16 leftSlopeFP = FloatToQ16Dot16(leftSlope);
- const Q16Dot16 rightSlopeFP = FloatToQ16Dot16(rightSlope);
+ const Q16Dot16 bottomLeftSlopeFP = FloatToQ16Dot16(bottomLeftSlope);
+ const Q16Dot16 bottomRightSlopeFP = FloatToQ16Dot16(bottomRightSlope);
+
+ const Q16Dot16 invTopLeftSlopeFP = FloatToQ16Dot16(1 / topLeftSlope);
+ const Q16Dot16 invTopRightSlopeFP = FloatToQ16Dot16(1 / topRightSlope);
+
+ const Q16Dot16 invBottomLeftSlopeFP = FloatToQ16Dot16(1 / bottomLeftSlope);
+ const Q16Dot16 invBottomRightSlopeFP = FloatToQ16Dot16(1 / bottomRightSlope);
if (d->antialiased) {
const Q16Dot16 iTopFP = IntToQ16Dot16(int(topBound));
@@ -936,16 +954,16 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
const Q16Dot16 iRightFP = IntToQ16Dot16(int(right.y()));
const Q16Dot16 iBottomFP = IntToQ16Dot16(int(bottomBound));
- Q16Dot16 leftIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * leftSlope);
- Q16Dot16 rightIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * rightSlope);
+ Q16Dot16 leftIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * topLeftSlope);
+ Q16Dot16 rightIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * topRightSlope);
Q16Dot16 leftIntersectBf = 0;
Q16Dot16 rightIntersectBf = 0;
if (iLeftFP < iTopFP)
- leftIntersectBf = FloatToQ16Dot16(left.x() + (int(topBound) - left.y()) * rightSlope);
+ leftIntersectBf = FloatToQ16Dot16(left.x() + (int(topBound) - left.y()) * bottomLeftSlope);
if (iRightFP < iTopFP)
- rightIntersectBf = FloatToQ16Dot16(right.x() + (int(topBound) - right.y()) * leftSlope);
+ rightIntersectBf = FloatToQ16Dot16(right.x() + (int(topBound) - right.y()) * bottomRightSlope);
Q16Dot16 rowTop, rowBottomLeft, rowBottomRight, rowTopLeft, rowTopRight, rowBottom;
Q16Dot16 topLeftIntersectAf, topLeftIntersectBf, topRightIntersectAf, topRightIntersectBf;
@@ -960,9 +978,9 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
rowTop = qMax(iTopFP, yTopFP);
topLeftIntersectAf = leftIntersectAf +
- Q16Dot16Multiply(leftSlopeFP, rowTop - iTopFP);
+ Q16Dot16Multiply(topLeftSlopeFP, rowTop - iTopFP);
topRightIntersectAf = rightIntersectAf +
- Q16Dot16Multiply(rightSlopeFP, rowTop - iTopFP);
+ Q16Dot16Multiply(topRightSlopeFP, rowTop - iTopFP);
Q16Dot16 yFP = iTopFP;
while (yFP <= iBottomFP) {
@@ -974,30 +992,30 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
if (yFP == iLeftFP) {
const int y = Q16Dot16ToInt(yFP);
- leftIntersectBf = FloatToQ16Dot16(left.x() + (y - left.y()) * rightSlope);
- topLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(rightSlopeFP, rowTopLeft - yFP);
- bottomLeftIntersectAf = leftIntersectAf + Q16Dot16Multiply(leftSlopeFP, rowBottomLeft - yFP);
+ leftIntersectBf = FloatToQ16Dot16(left.x() + (y - left.y()) * bottomLeftSlope);
+ topLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(bottomLeftSlopeFP, rowTopLeft - yFP);
+ bottomLeftIntersectAf = leftIntersectAf + Q16Dot16Multiply(topLeftSlopeFP, rowBottomLeft - yFP);
} else {
topLeftIntersectBf = leftIntersectBf;
- bottomLeftIntersectAf = leftIntersectAf + leftSlopeFP;
+ bottomLeftIntersectAf = leftIntersectAf + topLeftSlopeFP;
}
if (yFP == iRightFP) {
const int y = Q16Dot16ToInt(yFP);
- rightIntersectBf = FloatToQ16Dot16(right.x() + (y - right.y()) * leftSlope);
- topRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(leftSlopeFP, rowTopRight - yFP);
- bottomRightIntersectAf = rightIntersectAf + Q16Dot16Multiply(rightSlopeFP, rowBottomRight - yFP);
+ rightIntersectBf = FloatToQ16Dot16(right.x() + (y - right.y()) * bottomRightSlope);
+ topRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(bottomRightSlopeFP, rowTopRight - yFP);
+ bottomRightIntersectAf = rightIntersectAf + Q16Dot16Multiply(topRightSlopeFP, rowBottomRight - yFP);
} else {
topRightIntersectBf = rightIntersectBf;
- bottomRightIntersectAf = rightIntersectAf + rightSlopeFP;
+ bottomRightIntersectAf = rightIntersectAf + topRightSlopeFP;
}
if (yFP == iBottomFP) {
- bottomLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(rightSlopeFP, rowBottom - yFP);
- bottomRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(leftSlopeFP, rowBottom - yFP);
+ bottomLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(bottomLeftSlopeFP, rowBottom - yFP);
+ bottomRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(bottomRightSlopeFP, rowBottom - yFP);
} else {
- bottomLeftIntersectBf = leftIntersectBf + rightSlopeFP;
- bottomRightIntersectBf = rightIntersectBf + leftSlopeFP;
+ bottomLeftIntersectBf = leftIntersectBf + bottomLeftSlopeFP;
+ bottomRightIntersectBf = rightIntersectBf + bottomRightSlopeFP;
}
if (yFP < iLeftFP) {
@@ -1042,21 +1060,21 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
if (yFP <= iLeftFP)
excluded += intersectPixelFP(x, rowTop, rowBottomLeft,
bottomLeftIntersectAf, topLeftIntersectAf,
- leftSlopeFP, -rightSlopeFP);
+ topLeftSlopeFP, invTopLeftSlopeFP);
if (yFP >= iLeftFP)
excluded += intersectPixelFP(x, rowTopLeft, rowBottom,
topLeftIntersectBf, bottomLeftIntersectBf,
- rightSlopeFP, -leftSlopeFP);
+ bottomLeftSlopeFP, invBottomLeftSlopeFP);
if (x >= rightMin) {
if (yFP <= iRightFP)
excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight,
topRightIntersectAf, bottomRightIntersectAf,
- rightSlopeFP, -leftSlopeFP);
+ topRightSlopeFP, invTopRightSlopeFP);
if (yFP >= iRightFP)
excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom,
bottomRightIntersectBf, topRightIntersectBf,
- leftSlopeFP, -rightSlopeFP);
+ bottomRightSlopeFP, invBottomRightSlopeFP);
}
Q16Dot16 coverage = rowHeight - excluded;
@@ -1074,11 +1092,11 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
if (yFP <= iRightFP)
excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight,
topRightIntersectAf, bottomRightIntersectAf,
- rightSlopeFP, -leftSlopeFP);
+ topRightSlopeFP, invTopRightSlopeFP);
if (yFP >= iRightFP)
excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom,
bottomRightIntersectBf, topRightIntersectBf,
- leftSlopeFP, -rightSlopeFP);
+ bottomRightSlopeFP, invBottomRightSlopeFP);
Q16Dot16 coverage = rowHeight - excluded;
buffer.addSpan(x, 1, Q16Dot16ToInt(yFP),
@@ -1086,10 +1104,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
++x;
}
- leftIntersectAf += leftSlopeFP;
- leftIntersectBf += rightSlopeFP;
- rightIntersectAf += rightSlopeFP;
- rightIntersectBf += leftSlopeFP;
+ leftIntersectAf += topLeftSlopeFP;
+ leftIntersectBf += bottomLeftSlopeFP;
+ rightIntersectAf += topRightSlopeFP;
+ rightIntersectBf += bottomRightSlopeFP;
topLeftIntersectAf = leftIntersectAf;
topRightIntersectAf = rightIntersectAf;
@@ -1103,10 +1121,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
int iBottom = bottom.y() < 0.5f? -1 : int(bottom.y() - 0.5f);
int iMiddle = qMin(iLeft, iRight);
- Q16Dot16 leftIntersectAf = FloatToQ16Dot16(top.x() + 0.5f + (iTop + 0.5f - top.y()) * leftSlope);
- Q16Dot16 leftIntersectBf = FloatToQ16Dot16(left.x() + 0.5f + (iLeft + 1.5f - left.y()) * rightSlope);
- Q16Dot16 rightIntersectAf = FloatToQ16Dot16(top.x() - 0.5f + (iTop + 0.5f - top.y()) * rightSlope);
- Q16Dot16 rightIntersectBf = FloatToQ16Dot16(right.x() - 0.5f + (iRight + 1.5f - right.y()) * leftSlope);
+ Q16Dot16 leftIntersectAf = FloatToQ16Dot16(top.x() + 0.5f + (iTop + 0.5f - top.y()) * topLeftSlope);
+ Q16Dot16 leftIntersectBf = FloatToQ16Dot16(left.x() + 0.5f + (iLeft + 1.5f - left.y()) * bottomLeftSlope);
+ Q16Dot16 rightIntersectAf = FloatToQ16Dot16(top.x() - 0.5f + (iTop + 0.5f - top.y()) * topRightSlope);
+ Q16Dot16 rightIntersectBf = FloatToQ16Dot16(right.x() - 0.5f + (iRight + 1.5f - right.y()) * bottomRightSlope);
int ny;
int y = iTop;
@@ -1128,10 +1146,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
ri += rs; \
}
- DO_SEGMENT(iMiddle, leftIntersectAf, rightIntersectAf, leftSlopeFP, rightSlopeFP)
- DO_SEGMENT(iRight, leftIntersectBf, rightIntersectAf, rightSlopeFP, rightSlopeFP)
- DO_SEGMENT(iLeft, leftIntersectAf, rightIntersectBf, leftSlopeFP, leftSlopeFP)
- DO_SEGMENT(iBottom, leftIntersectBf, rightIntersectBf, rightSlopeFP, leftSlopeFP)
+ DO_SEGMENT(iMiddle, leftIntersectAf, rightIntersectAf, topLeftSlopeFP, topRightSlopeFP)
+ DO_SEGMENT(iRight, leftIntersectBf, rightIntersectAf, bottomLeftSlopeFP, topRightSlopeFP)
+ DO_SEGMENT(iLeft, leftIntersectAf, rightIntersectBf, topLeftSlopeFP, bottomRightSlopeFP);
+ DO_SEGMENT(iBottom, leftIntersectBf, rightIntersectBf, bottomLeftSlopeFP, bottomRightSlopeFP);
#undef DO_SEGMENT
}
}
@@ -1183,12 +1201,6 @@ void QRasterizer::rasterize(const QT_FT_Outline *outline, Qt::FillRule fillRule)
d->scanConverter.end();
}
-static inline QT_FT_Vector PointToVector(const QPointF &p)
-{
- QT_FT_Vector result = { QT_FT_Pos(p.x() * 64), QT_FT_Pos(p.y() * 64) };
- return result;
-}
-
void QRasterizer::rasterize(const QPainterPath &path, Qt::FillRule fillRule)
{
if (path.isEmpty())
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 631a9cf..b609f7b 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -47,10 +47,6 @@
#include "private/qnativeimage_p.h"
#include "private/qfontengine_ft_p.h"
-#ifndef QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH
-#define QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH 256
-#endif
-
QT_BEGIN_NAMESPACE
// #define CACHE_DEBUG
@@ -137,10 +133,18 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
m_currentRowHeight = qMax(m_currentRowHeight, c.h + margin * 2);
if (m_cx + c.w > m_w) {
- // no room on the current line, start new glyph strip
- m_cx = 0;
- m_cy += m_currentRowHeight + paddingDoubled;
- m_currentRowHeight = 0; // New row
+ int new_width = m_w*2;
+ while (new_width < m_cx + c.w)
+ new_width *= 2;
+ if (new_width <= maxTextureWidth()) {
+ resizeTextureData(new_width, m_h);
+ m_w = new_width;
+ } else {
+ // no room on the current line, start new glyph strip
+ m_cx = 0;
+ m_cy += m_currentRowHeight + paddingDoubled;
+ m_currentRowHeight = 0; // New row
+ }
}
if (m_cy + c.h > m_h) {
int new_height = m_h*2;
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index a818978..e6d2b22 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -64,6 +64,10 @@
# undef m_type
#endif
+#ifndef QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH
+#define QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH 256
+#endif
+
struct glyph_metrics_t;
typedef unsigned int glyph_t;
@@ -113,6 +117,8 @@ public:
QHash<glyph_t, Coord> coords;
QImage textureMapForGlyph(glyph_t g) const;
+ virtual int maxTextureWidth() const { return QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH; }
+ virtual int maxTextureHeight() const { return 32768; }
protected:
QFontEngine *m_current_fontengine;
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 5996032..bafc5f3 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -3436,8 +3436,7 @@ bool QS60Style::eventFilter(QObject *object, QEvent *event)
break;
}
case QEvent::MouseButtonRelease: {
- const QWidget *w = QApplication::widgetAt(QCursor::pos());
- if (w && d->m_pressedWidget) {
+ if (d->m_pressedWidget) {
d->m_pressedWidget->update();
d->m_pressedWidget = 0;
}
diff --git a/src/gui/styles/qstylehelper_p.h b/src/gui/styles/qstylehelper_p.h
index 71fce55..3759929 100644
--- a/src/gui/styles/qstylehelper_p.h
+++ b/src/gui/styles/qstylehelper_p.h
@@ -108,7 +108,7 @@ template <typename T>
{
typedef HexString<T> type;
enum { ExactSize = true };
- static int size(const HexString<T> &str) { return sizeof(str.val) * 2; }
+ static int size(const HexString<T> &) { return sizeof(T) * 2; }
static inline void appendTo(const HexString<T> &str, QChar *&out) { str.write(out); }
};
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index 7a5dec4..9506006 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -43,6 +43,7 @@
#include "qstatictext_p.h"
#include <private/qtextengine_p.h>
#include <private/qfontengine_p.h>
+#include <qabstracttextdocumentlayout.h>
#include <QtGui/qapplication.h>
@@ -654,7 +655,9 @@ void QStaticTextPrivate::paintText(const QPointF &topLeftPosition, QPainter *p)
p->save();
p->translate(topLeftPosition);
- document.drawContents(p);
+ QAbstractTextDocumentLayout::PaintContext ctx;
+ ctx.palette.setColor(QPalette::Text, p->pen().color());
+ document.documentLayout()->draw(p, ctx);
p->restore();
if (textWidth >= 0.0)
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index 5fe0c0c..7f2c4e9 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -404,12 +404,6 @@ void QTextControlPrivate::init(Qt::TextFormat format, const QString &text, QText
Q_Q(QTextControl);
setContent(format, text, document);
- QWidget *parentWidget = qobject_cast<QWidget*>(parent);
- if (parentWidget) {
- QTextOption opt = doc->defaultTextOption();
- opt.setTextDirection(parentWidget->layoutDirection());
- doc->setDefaultTextOption(opt);
- }
doc->setUndoRedoEnabled(interactionFlags & Qt::TextEditable);
q->setCursorWidth(-1);
}
diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp
index 7c5f973..26346ca 100644
--- a/src/gui/text/qtextdocumentfragment.cpp
+++ b/src/gui/text/qtextdocumentfragment.cpp
@@ -43,7 +43,6 @@
#include "qtextdocumentfragment_p.h"
#include "qtextcursor_p.h"
#include "qtextlist.h"
-#include "private/qunicodetables_p.h"
#include <qdebug.h>
#include <qtextcodec.h>
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index e190379..ca0942e 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -53,7 +53,6 @@
#include "qtextdocument_p.h"
#include "qtextcursor.h"
#include "qfont_p.h"
-#include "private/qunicodetables_p.h"
#include "private/qfunctions_p.h"
#ifndef QT_NO_TEXTHTMLPARSER
diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp
index bdbd0b0..42be03b 100644
--- a/src/gui/widgets/qlabel.cpp
+++ b/src/gui/widgets/qlabel.cpp
@@ -635,7 +635,7 @@ QSize QLabelPrivate::sizeForWidth(int w) const
br = movie->currentPixmap().rect();
#endif
else if (isTextLabel) {
- int align = QStyle::visualAlignment(q->layoutDirection(), QFlag(this->align));
+ int align = QStyle::visualAlignment(textDirection(), QFlag(this->align));
// Add indentation
int m = indent;
@@ -1059,7 +1059,8 @@ void QLabel::paintEvent(QPaintEvent *)
drawFrame(&painter);
QRect cr = contentsRect();
cr.adjust(d->margin, d->margin, -d->margin, -d->margin);
- int align = QStyle::visualAlignment(layoutDirection(), QFlag(d->align));
+ int align = QStyle::visualAlignment(d->isTextLabel ? d->textDirection()
+ : layoutDirection(), QFlag(d->align));
#ifndef QT_NO_MOVIE
if (d->movie) {
@@ -1119,7 +1120,8 @@ void QLabel::paintEvent(QPaintEvent *)
d->control->drawContents(&painter, QRectF(), this);
painter.restore();
} else {
- int flags = align;
+ int flags = align | (d->textDirection() == Qt::LeftToRight ? Qt::TextForceLeftToRight
+ : Qt::TextForceRightToLeft);
if (d->hasShortcut) {
flags |= Qt::TextShowMnemonic;
if (!style->styleHint(QStyle::SH_UnderlineShortcut, &opt, this))
@@ -1447,10 +1449,6 @@ void QLabel::changeEvent(QEvent *ev)
d->control->setPalette(palette());
} else if (ev->type() == QEvent::ContentsRectChange) {
d->updateLabel();
- } else if (ev->type() == QEvent::LayoutDirectionChange) {
- if (d->isTextLabel && d->control) {
- d->sendControlEvent(ev);
- }
}
QFrame::changeEvent(ev);
}
@@ -1486,6 +1484,15 @@ void QLabel::setScaledContents(bool enable)
update(contentsRect());
}
+Qt::LayoutDirection QLabelPrivate::textDirection() const
+{
+ if (control) {
+ QTextOption opt = control->document()->defaultTextOption();
+ return opt.textDirection();
+ }
+
+ return text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight;
+}
/*!
\fn void QLabel::setAlignment(Qt::AlignmentFlag flag)
@@ -1503,7 +1510,8 @@ QRect QLabelPrivate::documentRect() const
Q_ASSERT_X(isTextLabel, "documentRect", "document rect called for label that is not a text label!");
QRect cr = q->contentsRect();
cr.adjust(margin, margin, -margin, -margin);
- const int align = QStyle::visualAlignment(q->layoutDirection(), QFlag(this->align));
+ const int align = QStyle::visualAlignment(isTextLabel ? textDirection()
+ : q->layoutDirection(), QFlag(this->align));
int m = indent;
if (m < 0 && q->frameWidth()) // no indent, but we do have a frame
m = q->fontMetrics().width(QLatin1Char('x')) / 2 - margin;
@@ -1564,7 +1572,6 @@ void QLabelPrivate::ensureTextLayouted() const
if (!textLayoutDirty)
return;
ensureTextPopulated();
- Q_Q(const QLabel);
if (control) {
QTextDocument *doc = control->document();
QTextOption opt = doc->defaultTextOption();
@@ -1576,8 +1583,6 @@ void QLabelPrivate::ensureTextLayouted() const
else
opt.setWrapMode(QTextOption::ManualWrap);
- opt.setTextDirection(q->layoutDirection());
-
doc->setDefaultTextOption(opt);
QTextFrameFormat fmt = doc->rootFrame()->frameFormat();
diff --git a/src/gui/widgets/qlabel_p.h b/src/gui/widgets/qlabel_p.h
index fba7224..83624c7 100644
--- a/src/gui/widgets/qlabel_p.h
+++ b/src/gui/widgets/qlabel_p.h
@@ -132,6 +132,7 @@ public:
QRectF layoutRect() const;
QRect documentRect() const;
QPoint layoutPoint(const QPoint& p) const;
+ Qt::LayoutDirection textDirection() const;
#ifndef QT_NO_CONTEXTMENU
QMenu *createStandardContextMenu(const QPoint &pos);
#endif
diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp
index ab2bdea..83ba15a 100644
--- a/src/gui/widgets/qmenu_symbian.cpp
+++ b/src/gui/widgets/qmenu_symbian.cpp
@@ -168,11 +168,11 @@ static void qt_symbian_insert_action(QSymbianMenuAction* action, QList<SymbianMe
if (action->action->menu()->actions().size() > 0) {
for (int c2= 0; c2 < action->action->menu()->actions().size(); ++c2) {
- QSymbianMenuAction *symbianAction2 = new QSymbianMenuAction;
+ QScopedPointer<QSymbianMenuAction> symbianAction2(new QSymbianMenuAction);
symbianAction2->action = action->action->menu()->actions().at(c2);
QMenu * menu = symbianAction2->action->menu();
symbianAction2->command = qt_symbian_menu_static_cmd_id++;
- qt_symbian_insert_action(symbianAction2, &(menuItem->children));
+ qt_symbian_insert_action(symbianAction2.data(), &(menuItem->children));
}
}
@@ -432,11 +432,11 @@ void QMenuBarPrivate::QSymbianMenuBarPrivate::removeAction(QSymbianMenuAction *a
void QMenuBarPrivate::QSymbianMenuBarPrivate::insertNativeMenuItems(const QList<QAction*> &actions)
{
for (int i = 0; i <actions.size(); ++i) {
- QSymbianMenuAction *symbianActionTopLevel = new QSymbianMenuAction;
+ QScopedPointer<QSymbianMenuAction> symbianActionTopLevel(new QSymbianMenuAction);
symbianActionTopLevel->action = actions.at(i);
symbianActionTopLevel->parent = 0;
symbianActionTopLevel->command = qt_symbian_menu_static_cmd_id++;
- qt_symbian_insert_action(symbianActionTopLevel, &symbianMenus);
+ qt_symbian_insert_action(symbianActionTopLevel.data(), &symbianMenus);
}
}
diff --git a/src/gui/widgets/qsplashscreen.cpp b/src/gui/widgets/qsplashscreen.cpp
index 8be0cf8..d1fb686 100644
--- a/src/gui/widgets/qsplashscreen.cpp
+++ b/src/gui/widgets/qsplashscreen.cpp
@@ -186,6 +186,13 @@ void QSplashScreen::repaint()
Draws the \a message text onto the splash screen with color \a
color and aligns the text according to the flags in \a alignment.
+ To make sure the splash screen is repainted immediately, you can
+ call \l{QCoreApplication}'s
+ \l{QCoreApplication::}{processEvents()} after the call to
+ showMessage(). You usually want this to make sure that the message
+ is kept up to date with what your application is doing (e.g.,
+ loading files).
+
\sa Qt::Alignment, clearMessage()
*/
void QSplashScreen::showMessage(const QString &message, int alignment,