summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/configure.json6
-rw-r--r--src/gui/image/qpnghandler.cpp8
-rw-r--r--src/gui/kernel/qguiapplication.cpp8
-rw-r--r--src/gui/kernel/qt_gui_pch.h31
-rw-r--r--src/gui/painting/qblendfunctions_p.h119
-rw-r--r--src/gui/painting/qbrush.cpp4
-rw-r--r--src/gui/qtgui.tracepoints6
7 files changed, 54 insertions, 128 deletions
diff --git a/src/gui/configure.json b/src/gui/configure.json
index b7baf15571..5bcfbc88bf 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -749,7 +749,8 @@
},
"headers": [ "xkbcommon/xkbcommon.h" ],
"sources": [
- { "type": "pkgConfig", "args": "xkbcommon >= 0.5.0" }
+ { "type": "pkgConfig", "args": "xkbcommon >= 0.5.0" },
+ "-lxkbcommon"
]
},
"xkbcommon_x11": {
@@ -759,7 +760,8 @@
},
"headers": [ "xkbcommon/xkbcommon-x11.h" ],
"sources": [
- { "type": "pkgConfig", "args": "xkbcommon-x11" }
+ { "type": "pkgConfig", "args": "xkbcommon-x11" },
+ "-lxkbcommon -lxkbcommon-x11"
]
},
"xrender": {
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 93635a051d..39d0807606 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -242,8 +242,8 @@ void qpiw_flush_fn(png_structp /* png_ptr */)
static
void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scaledSize, bool *doScaledRead)
{
- png_uint_32 width;
- png_uint_32 height;
+ png_uint_32 width = 0;
+ png_uint_32 height = 0;
int bit_depth = 0;
int color_type = 0;
png_bytep trans_alpha = 0;
@@ -251,7 +251,7 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
int num_trans;
png_colorp palette = 0;
int num_palette;
- int interlace_method;
+ int interlace_method = PNG_INTERLACE_LAST;
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_method, 0, 0);
png_set_interlace_handling(png_ptr);
@@ -749,7 +749,7 @@ bool QPngHandlerPrivate::readPngImage(QImage *outImage)
QImage::Format QPngHandlerPrivate::readImageFormat()
{
QImage::Format format = QImage::Format_Invalid;
- png_uint_32 width, height;
+ png_uint_32 width = 0, height = 0;
int bit_depth = 0, color_type = 0;
png_colorp palette;
int num_palette;
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 8e587f6b39..429446829e 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1425,7 +1425,7 @@ void QGuiApplicationPrivate::eventDispatcherReady()
void QGuiApplicationPrivate::init()
{
- Q_TRACE(QGuiApplicationPrivate_init_entry);
+ Q_TRACE_SCOPE(QGuiApplicationPrivate_init);
#if defined(Q_OS_MACOS)
QMacAutoReleasePool pool;
@@ -1589,8 +1589,6 @@ void QGuiApplicationPrivate::init()
if (!QGuiApplicationPrivate::displayName)
QObject::connect(q, &QGuiApplication::applicationNameChanged,
q, &QGuiApplication::applicationDisplayNameChanged);
-
- Q_TRACE(QGuiApplicationPrivate_init_exit);
}
extern void qt_cleanupFontDatabase();
@@ -1836,7 +1834,7 @@ bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArra
void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
{
- Q_TRACE(QGuiApplicationPrivate_processWindowSystemEvent_entry, e->type);
+ Q_TRACE_SCOPE(QGuiApplicationPrivate_processWindowSystemEvent, e->type);
switch(e->type) {
case QWindowSystemInterfacePrivate::Mouse:
@@ -1946,8 +1944,6 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
qWarning() << "Unknown user input event type:" << e->type;
break;
}
-
- Q_TRACE(QGuiApplicationPrivate_processWindowSystemEvent_exit, e->type);
}
/*! \internal
diff --git a/src/gui/kernel/qt_gui_pch.h b/src/gui/kernel/qt_gui_pch.h
index aa5d3f0572..5e07fa45e7 100644
--- a/src/gui/kernel/qt_gui_pch.h
+++ b/src/gui/kernel/qt_gui_pch.h
@@ -45,37 +45,20 @@
* UNSUPPORTED.
*/
-// from corelib/global/qt_pch.h
+#include "../../corelib/global/qt_pch.h"
+
#if defined __cplusplus
#include <qtguiglobal.h>
-
-
-#ifdef Q_OS_WIN
-# define _POSIX_
-# include <limits.h>
-# undef _POSIX_
-#endif
-
-#include <qcoreapplication.h>
-#include <qlist.h>
-#include <qvariant.h> // All moc genereated code has this include
-#include <qobject.h>
-#include <qregexp.h>
-#include <qstring.h>
-#include <qstringlist.h>
-#if QT_CONFIG(textcodec)
-#include <qtextcodec.h>
-#endif
-
#include <qguiapplication.h>
#include <qbitmap.h>
+#include <qclipboard.h>
#include <qcursor.h>
#include <qevent.h>
+#include <qfont.h>
#include <qimage.h>
#include <qpainter.h>
#include <qpixmap.h>
-#include <qtimer.h>
-
-#include <stdlib.h>
-
+#include <qscreen.h>
+#include <qsurface.h>
+#include <qwindow.h>
#endif
diff --git a/src/gui/painting/qblendfunctions_p.h b/src/gui/painting/qblendfunctions_p.h
index dc7a4dfe8c..5ea78cdde2 100644
--- a/src/gui/painting/qblendfunctions_p.h
+++ b/src/gui/painting/qblendfunctions_p.h
@@ -65,11 +65,11 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl,
const QRect &clip,
T blender)
{
- qreal sx = targetRect.width() / (qreal) srcRect.width();
- qreal sy = targetRect.height() / (qreal) srcRect.height();
+ qreal sx = srcRect.width() / (qreal) targetRect.width();
+ qreal sy = srcRect.height() / (qreal) targetRect.height();
- int ix = 0x00010000 / sx;
- int iy = 0x00010000 / sy;
+ const int ix = 0x00010000 * sx;
+ const int iy = 0x00010000 * sy;
// qDebug() << "scale:" << endl
// << " - target" << targetRect << endl
@@ -77,59 +77,30 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl,
// << " - clip" << clip << endl
// << " - sx=" << sx << " sy=" << sy << " ix=" << ix << " iy=" << iy;
- int cx1 = clip.x();
- int cx2 = clip.x() + clip.width();
- int cy1 = clip.top();
- int cy2 = clip.y() + clip.height();
-
- int tx1 = qRound(targetRect.left());
- int tx2 = qRound(targetRect.right());
- int ty1 = qRound(targetRect.top());
- int ty2 = qRound(targetRect.bottom());
-
- if (tx2 < tx1)
- qSwap(tx2, tx1);
-
- if (ty2 < ty1)
- qSwap(ty2, ty1);
-
- if (tx1 < cx1)
- tx1 = cx1;
-
- if (tx2 >= cx2)
- tx2 = cx2;
-
- if (tx1 >= tx2)
+ QRect tr = targetRect.normalized().toRect();
+ tr = tr.intersected(clip);
+ if (tr.isEmpty())
return;
-
- if (ty1 < cy1)
- ty1 = cy1;
-
- if (ty2 >= cy2)
- ty2 = cy2;
-
- if (ty1 >= ty2)
- return;
-
- int h = ty2 - ty1;
- int w = tx2 - tx1;
-
+ const int tx1 = tr.left();
+ const int ty1 = tr.top();
+ int h = tr.height();
+ int w = tr.width();
quint32 basex;
quint32 srcy;
if (sx < 0) {
- int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1;
+ int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * sx * 65536) + 1;
basex = quint32(srcRect.right() * 65536) + dstx;
} else {
- int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * ix) - 1;
+ int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * sx * 65536) - 1;
basex = quint32(srcRect.left() * 65536) + dstx;
}
if (sy < 0) {
- int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * iy) + 1;
+ int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * sy * 65536) + 1;
srcy = quint32(srcRect.bottom() * 65536) + dsty;
} else {
- int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * iy) - 1;
+ int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * sy * 65536) - 1;
srcy = quint32(srcRect.top() * 65536) + dsty;
}
@@ -185,11 +156,11 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl,
const QRect &clip,
T blender)
{
- qreal sx = targetRect.width() / (qreal) srcRect.width();
- qreal sy = targetRect.height() / (qreal) srcRect.height();
+ qreal sx = srcRect.width() / (qreal) targetRect.width();
+ qreal sy = srcRect.height() / (qreal) targetRect.height();
- int ix = 0x00010000 / sx;
- int iy = 0x00010000 / sy;
+ const int ix = 0x00010000 * sx;
+ const int iy = 0x00010000 * sy;
// qDebug() << "scale:" << endl
// << " - target" << targetRect << endl
@@ -197,60 +168,30 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl,
// << " - clip" << clip << endl
// << " - sx=" << sx << " sy=" << sy << " ix=" << ix << " iy=" << iy;
- int cx1 = clip.x();
- int cx2 = clip.x() + clip.width();
- int cy1 = clip.top();
- int cy2 = clip.y() + clip.height();
-
- int tx1 = qRound(targetRect.left());
- int tx2 = qRound(targetRect.right());
- int ty1 = qRound(targetRect.top());
- int ty2 = qRound(targetRect.bottom());
-
- if (tx2 < tx1)
- qSwap(tx2, tx1);
-
- if (ty2 < ty1)
- qSwap(ty2, ty1);
-
- if (tx1 < cx1)
- tx1 = cx1;
-
- if (tx2 >= cx2)
- tx2 = cx2;
-
- if (tx1 >= tx2)
- return;
-
- if (ty1 < cy1)
- ty1 = cy1;
-
- if (ty2 >= cy2)
- ty2 = cy2;
-
- if (ty1 >= ty2)
- return;
-
- int h = ty2 - ty1;
- int w = tx2 - tx1;
- if (!w || !h)
+ QRect tr = targetRect.normalized().toRect();
+ tr = tr.intersected(clip);
+ if (tr.isEmpty())
return;
+ const int tx1 = tr.left();
+ const int ty1 = tr.top();
+ int h = tr.height();
+ int w = tr.width();
quint32 basex;
quint32 srcy;
if (sx < 0) {
- int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1;
+ int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * sx * 65536) + 1;
basex = quint32(srcRect.right() * 65536) + dstx;
} else {
- int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * ix) - 1;
+ int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * sx * 65536) - 1;
basex = quint32(srcRect.left() * 65536) + dstx;
}
if (sy < 0) {
- int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * iy) + 1;
+ int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * sy * 65536) + 1;
srcy = quint32(srcRect.bottom() * 65536) + dsty;
} else {
- int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * iy) - 1;
+ int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * sy * 65536) - 1;
srcy = quint32(srcRect.top() * 65536) + dsty;
}
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 1aa0ee14be..49b40aa756 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -1378,10 +1378,8 @@ QGradient::QGradient(Preset preset)
}();
const QJsonValue presetData = jsonPresets[preset - 1];
- if (!presetData.isObject()) {
- qWarning("QGradient: Undefined preset %i", preset);
+ if (!presetData.isObject())
return;
- }
m_type = LinearGradient;
setCoordinateMode(ObjectMode);
diff --git a/src/gui/qtgui.tracepoints b/src/gui/qtgui.tracepoints
index aed6c35c03..0a96a589b1 100644
--- a/src/gui/qtgui.tracepoints
+++ b/src/gui/qtgui.tracepoints
@@ -1,3 +1,9 @@
+{
+QT_BEGIN_NAMESPACE
+class QImageReader;
+QT_END_NAMESPACE
+}
+
QGuiApplicationPrivate_init_entry()
QGuiApplicationPrivate_init_exit()