Merge remote-tracking branch 'origin/release' into stable
Conflicts: src/gui/painting/qdrawhelper.cpp src/gui/painting/qdrawhelper_avx.cpp src/gui/painting/qdrawhelper_x86_p.h Change-Id: I09352d05119f6fd000319074a2705b38361b2c90
This commit is contained in:
commit
a2850e54d5
@ -5937,7 +5937,7 @@ static void qt_gradient_quint16(int count, const QSpan *spans, void *userData)
|
||||
}
|
||||
}
|
||||
|
||||
inline static void qt_bitmapblit_quint32(QRasterBuffer *rasterBuffer,
|
||||
inline static void qt_bitmapblit_argb32(QRasterBuffer *rasterBuffer,
|
||||
int x, int y, quint32 color,
|
||||
const uchar *map,
|
||||
int mapWidth, int mapHeight, int mapStride)
|
||||
@ -5946,6 +5946,15 @@ inline static void qt_bitmapblit_quint32(QRasterBuffer *rasterBuffer,
|
||||
map, mapWidth, mapHeight, mapStride);
|
||||
}
|
||||
|
||||
inline static void qt_bitmapblit_rgba8888(QRasterBuffer *rasterBuffer,
|
||||
int x, int y, quint32 color,
|
||||
const uchar *map,
|
||||
int mapWidth, int mapHeight, int mapStride)
|
||||
{
|
||||
qt_bitmapblit_template<quint32>(rasterBuffer, x, y, ARGB2RGBA(color),
|
||||
map, mapWidth, mapHeight, mapStride);
|
||||
}
|
||||
|
||||
inline static void qt_bitmapblit_quint16(QRasterBuffer *rasterBuffer,
|
||||
int x, int y, quint32 color,
|
||||
const uchar *map,
|
||||
@ -6057,11 +6066,11 @@ static inline void grayBlendPixel(quint32 *dst, int coverage, int sr, int sg, in
|
||||
}
|
||||
#endif
|
||||
|
||||
static void qt_alphamapblit_quint32(QRasterBuffer *rasterBuffer,
|
||||
int x, int y, quint32 color,
|
||||
const uchar *map,
|
||||
int mapWidth, int mapHeight, int mapStride,
|
||||
const QClipData *clip)
|
||||
static void qt_alphamapblit_argb32(QRasterBuffer *rasterBuffer,
|
||||
int x, int y, quint32 color,
|
||||
const uchar *map,
|
||||
int mapWidth, int mapHeight, int mapStride,
|
||||
const QClipData *clip)
|
||||
{
|
||||
const quint32 c = color;
|
||||
const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint32);
|
||||
@ -6152,10 +6161,19 @@ static void qt_alphamapblit_quint32(QRasterBuffer *rasterBuffer,
|
||||
}
|
||||
}
|
||||
|
||||
static void qt_alphargbblit_quint32(QRasterBuffer *rasterBuffer,
|
||||
int x, int y, quint32 color,
|
||||
const uint *src, int mapWidth, int mapHeight, int srcStride,
|
||||
const QClipData *clip)
|
||||
static void qt_alphamapblit_rgba8888(QRasterBuffer *rasterBuffer,
|
||||
int x, int y, quint32 color,
|
||||
const uchar *map,
|
||||
int mapWidth, int mapHeight, int mapStride,
|
||||
const QClipData *clip)
|
||||
{
|
||||
qt_alphamapblit_argb32(rasterBuffer, x, y, ARGB2RGBA(color), map, mapWidth, mapHeight, mapStride, clip);
|
||||
}
|
||||
|
||||
static void qt_alphargbblit_argb32(QRasterBuffer *rasterBuffer,
|
||||
int x, int y, quint32 color,
|
||||
const uint *src, int mapWidth, int mapHeight, int srcStride,
|
||||
const QClipData *clip)
|
||||
{
|
||||
const quint32 c = color;
|
||||
|
||||
@ -6297,27 +6315,27 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
|
||||
{
|
||||
blend_color_argb,
|
||||
qt_gradient_argb32,
|
||||
qt_bitmapblit_quint32,
|
||||
qt_alphamapblit_quint32,
|
||||
qt_alphargbblit_quint32,
|
||||
qt_bitmapblit_argb32,
|
||||
qt_alphamapblit_argb32,
|
||||
qt_alphargbblit_argb32,
|
||||
qt_rectfill_argb32
|
||||
},
|
||||
// Format_ARGB32,
|
||||
{
|
||||
blend_color_generic,
|
||||
qt_gradient_argb32,
|
||||
qt_bitmapblit_quint32,
|
||||
qt_alphamapblit_quint32,
|
||||
qt_alphargbblit_quint32,
|
||||
qt_bitmapblit_argb32,
|
||||
qt_alphamapblit_argb32,
|
||||
qt_alphargbblit_argb32,
|
||||
qt_rectfill_nonpremul_argb32
|
||||
},
|
||||
// Format_ARGB32_Premultiplied
|
||||
{
|
||||
blend_color_argb,
|
||||
qt_gradient_argb32,
|
||||
qt_bitmapblit_quint32,
|
||||
qt_alphamapblit_quint32,
|
||||
qt_alphargbblit_quint32,
|
||||
qt_bitmapblit_argb32,
|
||||
qt_alphamapblit_argb32,
|
||||
qt_alphargbblit_argb32,
|
||||
qt_rectfill_argb32
|
||||
},
|
||||
// Format_RGB16
|
||||
@ -6381,42 +6399,39 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
|
||||
{
|
||||
blend_color_generic,
|
||||
blend_src_generic,
|
||||
qt_bitmapblit_quint32,
|
||||
qt_bitmapblit_rgba8888,
|
||||
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
|
||||
qt_alphamapblit_quint32,
|
||||
qt_alphargbblit_quint32,
|
||||
qt_alphamapblit_rgba8888,
|
||||
#else
|
||||
0,
|
||||
0,
|
||||
#endif
|
||||
0,
|
||||
qt_rectfill_rgba
|
||||
},
|
||||
// Format_RGBA8888
|
||||
{
|
||||
blend_color_generic,
|
||||
blend_src_generic,
|
||||
qt_bitmapblit_quint32,
|
||||
qt_bitmapblit_rgba8888,
|
||||
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
|
||||
qt_alphamapblit_quint32,
|
||||
qt_alphargbblit_quint32,
|
||||
qt_alphamapblit_rgba8888,
|
||||
#else
|
||||
0,
|
||||
0,
|
||||
#endif
|
||||
0,
|
||||
qt_rectfill_nonpremul_rgba
|
||||
},
|
||||
// Format_RGB8888_Premultiplied
|
||||
{
|
||||
blend_color_generic,
|
||||
blend_src_generic,
|
||||
qt_bitmapblit_quint32,
|
||||
qt_bitmapblit_rgba8888,
|
||||
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
|
||||
qt_alphamapblit_quint32,
|
||||
qt_alphargbblit_quint32,
|
||||
qt_alphamapblit_rgba8888,
|
||||
#else
|
||||
0,
|
||||
0,
|
||||
#endif
|
||||
0,
|
||||
qt_rectfill_rgba
|
||||
}
|
||||
};
|
||||
@ -6502,9 +6517,9 @@ void qInitDrawhelperAsm()
|
||||
qDrawHelper[QImage::Format_ARGB32].bitmapBlit = qt_bitmapblit32_sse2;
|
||||
qDrawHelper[QImage::Format_ARGB32_Premultiplied].bitmapBlit = qt_bitmapblit32_sse2;
|
||||
qDrawHelper[QImage::Format_RGB16].bitmapBlit = qt_bitmapblit16_sse2;
|
||||
qDrawHelper[QImage::Format_RGBX8888].bitmapBlit = qt_bitmapblit32_sse2;
|
||||
qDrawHelper[QImage::Format_RGBA8888].bitmapBlit = qt_bitmapblit32_sse2;
|
||||
qDrawHelper[QImage::Format_RGBA8888_Premultiplied].bitmapBlit = qt_bitmapblit32_sse2;
|
||||
qDrawHelper[QImage::Format_RGBX8888].bitmapBlit = qt_bitmapblit8888_sse2;
|
||||
qDrawHelper[QImage::Format_RGBA8888].bitmapBlit = qt_bitmapblit8888_sse2;
|
||||
qDrawHelper[QImage::Format_RGBA8888_Premultiplied].bitmapBlit = qt_bitmapblit8888_sse2;
|
||||
|
||||
extern void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,
|
||||
const uchar *srcPixels, int sbpl,
|
||||
|
@ -476,6 +476,13 @@ void qt_bitmapblit32_sse2(QRasterBuffer *rasterBuffer, int x, int y,
|
||||
}
|
||||
}
|
||||
|
||||
void qt_bitmapblit8888_sse2(QRasterBuffer *rasterBuffer, int x, int y,
|
||||
quint32 color,
|
||||
const uchar *src, int width, int height, int stride)
|
||||
{
|
||||
qt_bitmapblit32_sse2(rasterBuffer, x, y, ARGB2RGBA(color), src, width, height, stride);
|
||||
}
|
||||
|
||||
void qt_bitmapblit16_sse2(QRasterBuffer *rasterBuffer, int x, int y,
|
||||
quint32 color,
|
||||
const uchar *src, int width, int height, int stride)
|
||||
|
@ -63,6 +63,9 @@ void qt_memfill16(quint16 *dest, quint16 value, int count);
|
||||
void qt_bitmapblit32_sse2(QRasterBuffer *rasterBuffer, int x, int y,
|
||||
quint32 color,
|
||||
const uchar *src, int width, int height, int stride);
|
||||
void qt_bitmapblit8888_sse2(QRasterBuffer *rasterBuffer, int x, int y,
|
||||
quint32 color,
|
||||
const uchar *src, int width, int height, int stride);
|
||||
void qt_bitmapblit16_sse2(QRasterBuffer *rasterBuffer, int x, int y,
|
||||
quint32 color,
|
||||
const uchar *src, int width, int height, int stride);
|
||||
|
@ -508,7 +508,7 @@ const quint64 PseudoClass_EditFocus = Q_UINT64_C(0x0000080000000000);
|
||||
const quint64 PseudoClass_Alternate = Q_UINT64_C(0x0000100000000000);
|
||||
// The Any specifier is never generated, but can be used as a wildcard in searches.
|
||||
const quint64 PseudoClass_Any = Q_UINT64_C(0x0000ffffffffffff);
|
||||
const int NumPseudos = 46;
|
||||
const int NumPseudos = 45;
|
||||
|
||||
struct Pseudo
|
||||
{
|
||||
|
@ -127,6 +127,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaMenuDelegate);
|
||||
{
|
||||
QCocoaMenuItem *cocoaItem = reinterpret_cast<QCocoaMenuItem *>([item tag]);
|
||||
QScopedLoopLevelCounter loopLevelCounter(QGuiApplicationPrivate::instance()->threadData);
|
||||
QGuiApplicationPrivate::modifier_buttons = [QNSView convertKeyModifiers:[NSEvent modifierFlags]];
|
||||
cocoaItem->activated();
|
||||
}
|
||||
|
||||
@ -268,7 +269,7 @@ void QCocoaMenu::insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *
|
||||
QCocoaMenuItem *cocoaItem = static_cast<QCocoaMenuItem *>(menuItem);
|
||||
QCocoaMenuItem *beforeItem = static_cast<QCocoaMenuItem *>(before);
|
||||
|
||||
menuItem->setParent(this);
|
||||
SET_COCOA_MENU_ANCESTOR(menuItem, this);
|
||||
cocoaItem->sync();
|
||||
if (beforeItem) {
|
||||
int index = m_menuItems.indexOf(beforeItem);
|
||||
@ -325,8 +326,8 @@ void QCocoaMenu::removeMenuItem(QPlatformMenuItem *menuItem)
|
||||
return;
|
||||
}
|
||||
|
||||
if (menuItem->parent() == this)
|
||||
menuItem->setParent(0);
|
||||
if (COCOA_MENU_ANCESTOR(menuItem) == this)
|
||||
SET_COCOA_MENU_ANCESTOR(menuItem, 0);
|
||||
|
||||
m_menuItems.removeOne(cocoaItem);
|
||||
if (!cocoaItem->isMerged()) {
|
||||
@ -550,7 +551,7 @@ void QCocoaMenu::syncModalState(bool modal)
|
||||
void QCocoaMenu::setMenuBar(QCocoaMenuBar *menuBar)
|
||||
{
|
||||
m_menuBar = menuBar;
|
||||
setParent(menuBar);
|
||||
SET_COCOA_MENU_ANCESTOR(this, menuBar);
|
||||
}
|
||||
|
||||
QCocoaMenuBar *QCocoaMenu::menuBar() const
|
||||
|
@ -118,6 +118,9 @@ private:
|
||||
quintptr m_tag;
|
||||
};
|
||||
|
||||
#define COCOA_MENU_ANCESTOR(m) ((m)->property("_qCocoaMenuAncestor").value<QObject *>())
|
||||
#define SET_COCOA_MENU_ANCESTOR(m, ancestor) (m)->setProperty("_qCocoaMenuAncestor", QVariant::fromValue<QObject *>(ancestor))
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
@ -126,13 +126,13 @@ void QCocoaMenuItem::setMenu(QPlatformMenu *menu)
|
||||
{
|
||||
if (menu == m_menu)
|
||||
return;
|
||||
if (m_menu && m_menu->parent() == this)
|
||||
m_menu->setParent(0);
|
||||
if (m_menu && COCOA_MENU_ANCESTOR(m_menu) == this)
|
||||
SET_COCOA_MENU_ANCESTOR(m_menu, 0);
|
||||
|
||||
QCocoaAutoReleasePool pool;
|
||||
m_menu = static_cast<QCocoaMenu *>(menu);
|
||||
if (m_menu) {
|
||||
m_menu->setParent(this);
|
||||
SET_COCOA_MENU_ANCESTOR(m_menu, this);
|
||||
} else {
|
||||
// we previously had a menu, but no longer
|
||||
// clear out our item so the nexy sync() call builds a new one
|
||||
@ -217,12 +217,12 @@ NSMenuItem *QCocoaMenuItem::sync()
|
||||
mergeItem = [loader preferencesMenuItem];
|
||||
break;
|
||||
case TextHeuristicRole: {
|
||||
QObject *p = parent();
|
||||
QObject *p = COCOA_MENU_ANCESTOR(this);
|
||||
int depth = 1;
|
||||
QCocoaMenuBar *menubar = 0;
|
||||
while (depth < 3 && p && !(menubar = qobject_cast<QCocoaMenuBar *>(p))) {
|
||||
++depth;
|
||||
p = p->parent();
|
||||
p = COCOA_MENU_ANCESTOR(p);
|
||||
}
|
||||
if (depth == 3 || !menubar)
|
||||
break; // Menu item too deep in the hierarchy, or not connected to any menubar
|
||||
|
@ -87,6 +87,7 @@ private slots:
|
||||
|
||||
void plainTextVsRichText();
|
||||
|
||||
void setPenPlainText_data();
|
||||
void setPenPlainText();
|
||||
void setPenRichText();
|
||||
void richTextOverridesPen();
|
||||
@ -106,6 +107,8 @@ private:
|
||||
QImage const m_whiteSquare;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QImage::Format);
|
||||
|
||||
void tst_QStaticText::initTestCase()
|
||||
{
|
||||
// a "blank" square; we compare against in our testfunctions to verify
|
||||
@ -615,30 +618,41 @@ void tst_QStaticText::plainTextVsRichText()
|
||||
QCOMPARE(imagePlainText, imageRichText);
|
||||
}
|
||||
|
||||
void tst_QStaticText::setPenPlainText_data()
|
||||
{
|
||||
QTest::addColumn<QImage::Format>("format");
|
||||
|
||||
QTest::newRow("argb32pm") << QImage::Format_ARGB32_Premultiplied;
|
||||
QTest::newRow("rgb32") << QImage::Format_RGB32;
|
||||
QTest::newRow("rgba8888pm") << QImage::Format_RGBA8888_Premultiplied;
|
||||
QTest::newRow("rgbx8888") << QImage::Format_RGBX8888;
|
||||
}
|
||||
|
||||
void tst_QStaticText::setPenPlainText()
|
||||
{
|
||||
QFETCH(QImage::Format, format);
|
||||
|
||||
QFont font = QGuiApplication::font();
|
||||
font.setStyleStrategy(QFont::NoAntialias);
|
||||
|
||||
QFontMetricsF fm(font);
|
||||
QPixmap image(qCeil(fm.width("XXXXX")), qCeil(fm.height()));
|
||||
QImage image(qCeil(fm.width("XXXXX")), qCeil(fm.height()), format);
|
||||
image.fill(Qt::white);
|
||||
{
|
||||
QPainter p(&image);
|
||||
p.setFont(font);
|
||||
p.setPen(Qt::green);
|
||||
p.setPen(Qt::yellow);
|
||||
|
||||
QStaticText staticText("XXXXX");
|
||||
staticText.setTextFormat(Qt::PlainText);
|
||||
p.drawStaticText(0, 0, staticText);
|
||||
}
|
||||
|
||||
QImage img = image.toImage();
|
||||
for (int x=0; x<img.width(); ++x) {
|
||||
for (int y=0; y<img.height(); ++y) {
|
||||
QRgb pixel = img.pixel(x, y);
|
||||
for (int x=0; x<image.width(); ++x) {
|
||||
for (int y=0; y<image.height(); ++y) {
|
||||
QRgb pixel = image.pixel(x, y);
|
||||
QVERIFY(pixel == QColor(Qt::white).rgba()
|
||||
|| pixel == QColor(Qt::green).rgba());
|
||||
|| pixel == QColor(Qt::yellow).rgba());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,6 +99,7 @@ private slots:
|
||||
void task232085_spinBoxLineEditBg();
|
||||
void changeStyleInChangeEvent();
|
||||
void QTBUG15910_crashNullWidget();
|
||||
void QTBUG36933_brokenPseudoClassLookup();
|
||||
|
||||
//at the end because it mess with the style.
|
||||
void widgetStyle();
|
||||
@ -1656,6 +1657,37 @@ void tst_QStyleSheetStyle::QTBUG15910_crashNullWidget()
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&w));
|
||||
}
|
||||
|
||||
void tst_QStyleSheetStyle::QTBUG36933_brokenPseudoClassLookup()
|
||||
{
|
||||
const int rowCount = 10;
|
||||
const int columnCount = 10;
|
||||
|
||||
QTableWidget widget(rowCount, columnCount);
|
||||
|
||||
for (int row = 0; row < rowCount; ++row) {
|
||||
for (int column = 0; column < columnCount; ++column)
|
||||
widget.setItem(row, column, new QTableWidgetItem(QStringLiteral("row %1 column %2").arg(row + 1).arg(column + 1)));
|
||||
|
||||
// put no visible text for the vertical headers, but still put some text or they will collapse
|
||||
widget.setVerticalHeaderItem(row, new QTableWidgetItem(QStringLiteral(" ")));
|
||||
}
|
||||
|
||||
// parsing of this stylesheet must not crash, and it must be correctly applied
|
||||
widget.setStyleSheet(QStringLiteral("QHeaderView::section:vertical { background-color: #FF0000 }"));
|
||||
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
|
||||
widget.activateWindow();
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||
|
||||
QHeaderView *verticalHeader = widget.verticalHeader();
|
||||
QImage image(verticalHeader->size(), QImage::Format_ARGB32);
|
||||
verticalHeader->render(&image);
|
||||
QVERIFY(testForColors(image, QColor(0xFF, 0x00, 0x00)));
|
||||
}
|
||||
|
||||
|
||||
QTEST_MAIN(tst_QStyleSheetStyle)
|
||||
#include "tst_qstylesheetstyle.moc"
|
||||
|
Loading…
Reference in New Issue
Block a user