summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/configure.json9
-rw-r--r--src/gui/gui.pro1
-rw-r--r--src/gui/image/image.pri2
-rw-r--r--src/gui/image/qiconloader_p.h17
-rw-r--r--src/gui/image/qimage.cpp2
-rw-r--r--src/gui/image/qimage_conversions.cpp4
-rw-r--r--src/gui/kernel/qclipboard.cpp5
-rw-r--r--src/gui/kernel/qguiapplication.cpp10
-rw-r--r--src/gui/kernel/qplatformscreen.cpp4
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp12
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp47
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h12
-rw-r--r--src/gui/opengl/KHRONOS_LICENSE.txt20
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp1
-rw-r--r--src/gui/opengl/qt_attribution.json32
-rw-r--r--src/gui/painting/qdrawhelper.cpp185
-rw-r--r--src/gui/painting/qdrawhelper_p.h2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp53
-rw-r--r--src/gui/painting/qpainter.cpp3
-rw-r--r--src/gui/painting/qpathclipper.cpp21
-rw-r--r--src/gui/painting/qpdf.cpp13
-rw-r--r--src/gui/painting/qpdf_p.h2
-rw-r--r--src/gui/painting/qt_attribution.json14
-rw-r--r--src/gui/text/qcssparser.cpp9
-rw-r--r--src/gui/text/qfontdatabase.cpp25
-rw-r--r--src/gui/text/qfontengine_ft.cpp2
-rw-r--r--src/gui/text/text.pri2
27 files changed, 345 insertions, 164 deletions
diff --git a/src/gui/configure.json b/src/gui/configure.json
index 318efe5401..f4e2faf08b 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -7,6 +7,7 @@
"commandline": {
"options": {
+ "android-style-assets": "boolean",
"angle": "boolean",
"directfb": "boolean",
"directwrite": "boolean",
@@ -164,7 +165,6 @@
},
"mirclient": {
"label": "Mir client libraries",
- "export": "",
"test": "qpa/mirclient",
"sources": [
{ "type": "pkgConfig", "args": "egl mirclient ubuntu-platform-api" }
@@ -172,7 +172,6 @@
},
"mtdev": {
"label": "mtdev",
- "export": "",
"test": "unix/mtdev",
"sources": [
{ "type": "pkgConfig", "args": "mtdev" }
@@ -203,7 +202,6 @@
},
"wayland_server": {
"label": "Wayland Server",
- "export": "",
"test": "qpa/wayland-server",
"sources": [
{ "type": "pkgConfig", "args": "wayland-server" }
@@ -414,6 +412,11 @@
"condition": "features.accessibility && features.xcb && features.dbus",
"output": [ "privateFeature", "feature" ]
},
+ "android-style-assets": {
+ "label": "Android Style Assets",
+ "condition": "config.android",
+ "output": [ "privateFeature" ]
+ },
"angle": {
"label": "ANGLE",
"autoDetect": "features.opengles2 || features.opengl-dynamic",
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index a6eaadd6c5..5f8cbe2cbe 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -9,6 +9,7 @@ QMAKE_DOCS = $$PWD/doc/qtgui.qdocconf
MODULE_PLUGIN_TYPES = \
platforms \
+ platforms/darwin \
xcbglintegrations \
platformthemes \
platforminputcontexts \
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index 3c4d2c0bbf..bac00f7e95 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -74,7 +74,7 @@ SOURCES += \
qtConfig(png) {
HEADERS += image/qpnghandler_p.h
SOURCES += image/qpnghandler.cpp
- include($$PWD/../../3rdparty/png_dependency.pri)
+ QMAKE_USE_PRIVATE += libpng
}
# SIMD
diff --git a/src/gui/image/qiconloader_p.h b/src/gui/image/qiconloader_p.h
index 583499be76..ed7b7ff7ae 100644
--- a/src/gui/image/qiconloader_p.h
+++ b/src/gui/image/qiconloader_p.h
@@ -95,7 +95,6 @@ public:
QIcon::State state) = 0;
QString filename;
QIconDirInfo dir;
- static int count;
};
struct ScalableEntry : public QIconLoaderEngineEntry
@@ -124,18 +123,18 @@ public:
QIconLoaderEngine(const QString& iconName = QString());
~QIconLoaderEngine();
- void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state);
- QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state);
- QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state);
- QIconEngine *clone() const;
- bool read(QDataStream &in);
- bool write(QDataStream &out) const;
+ void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
+ QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
+ QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
+ QIconEngine *clone() const Q_DECL_OVERRIDE;
+ bool read(QDataStream &in) Q_DECL_OVERRIDE;
+ bool write(QDataStream &out) const Q_DECL_OVERRIDE;
private:
- QString key() const;
+ QString key() const Q_DECL_OVERRIDE;
bool hasIcon() const;
void ensureLoaded();
- void virtual_hook(int id, void *data);
+ void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
QIconLoaderEngineEntry *entryForSize(const QSize &size);
QIconLoaderEngine(const QIconLoaderEngine &other);
QThemeIconInfo m_info;
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 8bbcfa612d..9e911bdcea 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -5062,7 +5062,7 @@ static Q_CONSTEXPR QPixelFormat pixelformats[] = {
/*ALPHA USAGE*/ QPixelFormat::IgnoresAlpha,
/*ALPHA POSITION*/ QPixelFormat::AtBeginning,
/*PREMULTIPLIED*/ QPixelFormat::NotPremultiplied,
- /*INTERPRETATION*/ QPixelFormat::UnsignedInteger,
+ /*INTERPRETATION*/ QPixelFormat::UnsignedByte,
/*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian),
//QImage::Format_RGB444:
QPixelFormat(QPixelFormat::RGB,
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index 9bd098b7b1..c646ee96b4 100644
--- a/src/gui/image/qimage_conversions.cpp
+++ b/src/gui/image/qimage_conversions.cpp
@@ -930,12 +930,12 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers
const int dest_pad = (dst_bytes_per_line >> 1) - width;
quint16 colorTableRGB16[256];
- if (data->colortable.isEmpty()) {
+ const int tableSize = data->colortable.size();
+ if (tableSize == 0) {
for (int i = 0; i < 256; ++i)
colorTableRGB16[i] = qConvertRgb32To16(qRgb(i, i, i));
} else {
// 1) convert the existing colors to RGB16
- const int tableSize = data->colortable.size();
for (int i = 0; i < tableSize; ++i)
colorTableRGB16[i] = qConvertRgb32To16(data->colortable.at(i));
data->colortable = QVector<QRgb>();
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index 21127eebbd..f14355bc01 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -425,8 +425,9 @@ void QClipboard::setPixmap(const QPixmap &pixmap, Mode mode)
/*!
\fn QMimeData *QClipboard::mimeData(Mode mode) const
- Returns a reference to a QMimeData representation of the current
- clipboard data.
+ Returns a pointer to a QMimeData representation of the current
+ clipboard data (can be NULL if the given \a mode is not
+ supported by the platform).
The \a mode argument is used to control which part of the system
clipboard is used. If \a mode is QClipboard::Clipboard, the
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 76386a30a0..14f94951d0 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -352,6 +352,16 @@ void QWindowGeometrySpecification::applyTo(QWindow *window) const
static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOMETRY_SPECIFICATION_INITIALIZER;
/*!
+ \macro qGuiApp
+ \relates QGuiApplication
+
+ A global pointer referring to the unique application object.
+ Only valid for use when that object is a QGuiApplication.
+
+ \sa QCoreApplication::instance(), qApp
+*/
+
+/*!
\class QGuiApplication
\brief The QGuiApplication class manages the GUI application's control
flow and main settings.
diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp
index 3c1552c31e..1d519e84f9 100644
--- a/src/gui/kernel/qplatformscreen.cpp
+++ b/src/gui/kernel/qplatformscreen.cpp
@@ -342,6 +342,10 @@ void QPlatformScreen::resizeMaximizedWindows()
for (int i = 0; i < windows.size(); ++i) {
QWindow *w = windows.at(i);
+ // Skip non-platform windows, e.g., offscreen windows.
+ if (!w->handle())
+ continue;
+
if (platformScreenForWindow(w) != this)
continue;
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp
index d7dc0faceb..000d727380 100644
--- a/src/gui/kernel/qsurfaceformat.cpp
+++ b/src/gui/kernel/qsurfaceformat.cpp
@@ -41,6 +41,8 @@
#include <QtCore/qatomic.h>
#include <QtCore/QDebug>
+#include <QOpenGLContext>
+#include <QtGui/qguiapplication.h>
#ifdef major
#undef major
@@ -761,6 +763,16 @@ Q_GLOBAL_STATIC(QSurfaceFormat, qt_default_surface_format)
*/
void QSurfaceFormat::setDefaultFormat(const QSurfaceFormat &format)
{
+#ifndef QT_NO_OPENGL
+ if (qApp) {
+ QOpenGLContext *globalContext = QOpenGLContext::globalShareContext();
+ if (globalContext && globalContext->isValid()) {
+ qWarning("Warning: Setting a new default format with a different version or profile "
+ "after the global shared context is created may cause issues with context "
+ "sharing.");
+ }
+ }
+#endif
*qt_default_surface_format() = format;
}
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 08aa625112..1f2528dd5c 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -165,11 +165,11 @@ void QWindowSystemInterface::handleEnterLeaveEvent(QWindow *enter, QWindow *leav
handleEnterEvent(enter, local, global);
}
-void QWindowSystemInterface::handleWindowActivated(QWindow *tlw, Qt::FocusReason r)
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowActivated, QWindow *tlw, Qt::FocusReason r)
{
QWindowSystemInterfacePrivate::ActivatedWindowEvent *e =
new QWindowSystemInterfacePrivate::ActivatedWindowEvent(tlw, r);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
void QWindowSystemInterface::handleWindowStateChanged(QWindow *tlw, Qt::WindowState newState)
@@ -197,10 +197,25 @@ void QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState
/*!
If \a oldRect is null, Qt will use the previously reported geometry instead.
*/
-void QWindowSystemInterface::handleGeometryChange(QWindow *tlw, const QRect &newRect, const QRect &oldRect)
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleGeometryChange, QWindow *tlw, const QRect &newRect, const QRect &oldRect)
{
QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(tlw, QHighDpi::fromNativePixels(newRect, tlw), QHighDpi::fromNativePixels(oldRect, tlw));
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+}
+
+QWindowSystemInterfacePrivate::ExposeEvent::ExposeEvent(QWindow *window, const QRegion &region)
+ : WindowSystemEvent(Expose)
+ , window(window)
+ , isExposed(window && window->handle() ? window->handle()->isExposed() : false)
+ , region(region)
+{
+}
+
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleExposeEvent, QWindow *tlw, const QRegion &region)
+{
+ QWindowSystemInterfacePrivate::ExposeEvent *e =
+ new QWindowSystemInterfacePrivate::ExposeEvent(tlw, QHighDpi::fromNativeLocalExposedRegion(region, tlw));
+ QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
void QWindowSystemInterface::handleCloseEvent(QWindow *tlw, bool *accepted)
@@ -405,15 +420,6 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, con
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
-
-QWindowSystemInterfacePrivate::ExposeEvent::ExposeEvent(QWindow *window, const QRegion &region)
- : WindowSystemEvent(Expose)
- , window(window)
- , isExposed(window && window->handle() ? window->handle()->isExposed() : false)
- , region(region)
-{
-}
-
int QWindowSystemInterfacePrivate::windowSystemEventsQueued()
{
return windowSystemEventQueue.count();
@@ -634,20 +640,20 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchEvent, QWindow *tlw, ulong timestam
QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
-void QWindowSystemInterface::handleTouchCancelEvent(QWindow *w, QTouchDevice *device,
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchCancelEvent, QWindow *w, QTouchDevice *device,
Qt::KeyboardModifiers mods)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleTouchCancelEvent(w, time, device, mods);
+ handleTouchCancelEvent<Delivery>(w, time, device, mods);
}
-void QWindowSystemInterface::handleTouchCancelEvent(QWindow *w, ulong timestamp, QTouchDevice *device,
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchCancelEvent, QWindow *w, ulong timestamp, QTouchDevice *device,
Qt::KeyboardModifiers mods)
{
QWindowSystemInterfacePrivate::TouchEvent *e =
new QWindowSystemInterfacePrivate::TouchEvent(w, timestamp, QEvent::TouchCancel, device,
QList<QTouchEvent::TouchPoint>(), mods);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
void QWindowSystemInterface::handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation orientation)
@@ -684,13 +690,6 @@ void QWindowSystemInterface::handleThemeChange(QWindow *tlw)
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleExposeEvent(QWindow *tlw, const QRegion &region)
-{
- QWindowSystemInterfacePrivate::ExposeEvent *e =
- new QWindowSystemInterfacePrivate::ExposeEvent(tlw, QHighDpi::fromNativeLocalExposedRegion(region, tlw));
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
-}
-
void QWindowSystemInterface::deferredFlushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)
{
Q_ASSERT(QThread::currentThread() == QGuiApplication::instance()->thread());
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index 6fade3cc4c..3be3c3188c 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -150,11 +150,19 @@ public:
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleTouchEvent(QWindow *w, ulong timestamp, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleTouchCancelEvent(QWindow *w, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleTouchCancelEvent(QWindow *w, ulong timestamp, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
// rect is relative to parent
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleGeometryChange(QWindow *w, const QRect &newRect, const QRect &oldRect = QRect());
+
+ // region is in local coordinates, do not confuse with geometry which is parent-relative
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
+ static void handleExposeEvent(QWindow *tlw, const QRegion &region);
+
static void handleCloseEvent(QWindow *w, bool *accepted = Q_NULLPTR);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
@@ -162,6 +170,7 @@ public:
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleLeaveEvent(QWindow *w);
static void handleEnterLeaveEvent(QWindow *enter, QWindow *leave, const QPointF &local = QPointF(), const QPointF& global = QPointF());
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleWindowActivated(QWindow *w, Qt::FocusReason r = Qt::OtherFocusReason);
static void handleWindowStateChanged(QWindow *w, Qt::WindowState newState);
@@ -169,9 +178,6 @@ public:
static void handleApplicationStateChanged(Qt::ApplicationState newState, bool forcePropagate = false);
- // region is in local coordinates, do not confuse with geometry which is parent-relative
- static void handleExposeEvent(QWindow *tlw, const QRegion &region);
-
#ifndef QT_NO_DRAGANDDROP
// Drag and drop. These events are sent immediately.
static QPlatformDragQtResponse handleDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions);
diff --git a/src/gui/opengl/KHRONOS_LICENSE.txt b/src/gui/opengl/KHRONOS_LICENSE.txt
new file mode 100644
index 0000000000..63b1e1f940
--- /dev/null
+++ b/src/gui/opengl/KHRONOS_LICENSE.txt
@@ -0,0 +1,20 @@
+Copyright (c) 2013-2014 The Khronos Group Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and/or associated documentation files (the
+"Materials"), to deal in the Materials without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Materials, and to
+permit persons to whom the Materials are furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Materials.
+
+THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index e0f469cbcb..4833617377 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -1492,6 +1492,7 @@ bool QOpenGLFramebufferObject::bindDefault()
if (ctx) {
ctx->functions()->glBindFramebuffer(GL_FRAMEBUFFER, ctx->defaultFramebufferObject());
QOpenGLContextPrivate::get(ctx)->qgl_current_fbo_invalid = true;
+ QOpenGLContextPrivate::get(ctx)->qgl_current_fbo = Q_NULLPTR;
}
#ifdef QT_DEBUG
else
diff --git a/src/gui/opengl/qt_attribution.json b/src/gui/opengl/qt_attribution.json
new file mode 100644
index 0000000000..d3ff10d803
--- /dev/null
+++ b/src/gui/opengl/qt_attribution.json
@@ -0,0 +1,32 @@
+[
+ {
+ "Id": "opengl-headers",
+ "Name": "OpenGL Headers",
+ "QDocModule": "qtgui",
+ "Description": "OpenGL header generated from the Khronos OpenGL / OpenGL ES XML API Registry.",
+ "QtUsage": "Used on Windows and Linux in the OpenGL related headers of Qt GUI.",
+ "Path": "qopenglext.h",
+
+ "Homepage": "https://www.khronos.org/",
+ "Version": "Revision 27684",
+ "License": "MIT License",
+ "LicenseId": "MIT",
+ "LicenseFile": "KHRONOS_LICENSE.txt",
+ "Copyright": "Copyright (c) 2013-2014 The Khronos Group Inc."
+ },
+ {
+ "Id": "opengl-es2-headers",
+ "Name": "OpenGL ES 2 Headers",
+ "QDocModule": "qtgui",
+ "Description": "OpenGL ES 2 header generated from the Khronos OpenGL / OpenGL ES XML API Registry.",
+ "QtUsage": "Used on Windows and Linux in the OpenGL related headers of Qt GUI.",
+ "Path": "qopengles2ext.h",
+
+ "Homepage": "https://www.khronos.org/",
+ "Version": "Revision 27673",
+ "License": "MIT License",
+ "LicenseId": "MIT",
+ "LicenseFile": "KHRONOS_LICENSE.txt",
+ "Copyright": "Copyright (c) 2013-2014 The Khronos Group Inc."
+ }
+]
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 928a56fd2f..2716d92d13 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -836,10 +836,7 @@ static const uint *QT_FASTCALL convertGrayscale8FromARGB32PM(uint *buffer, const
}
template <QPixelLayout::BPP bpp> static
-uint QT_FASTCALL fetchPixel(const uchar *, int)
-{
- Q_UNREACHABLE();
-}
+uint QT_FASTCALL fetchPixel(const uchar *src, int index);
template <>
inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP1LSB>(const uchar *src, int index)
@@ -1557,11 +1554,92 @@ static const QRgba64 *QT_FASTCALL fetchUntransformed64(QRgba64 *buffer, const Op
}
}
-template<TextureBlendType blendType, QPixelLayout::BPP bpp>
+// blendType is either BlendTransformed or BlendTransformedTiled
+template<TextureBlendType blendType>
+static const uint *QT_FASTCALL fetchTransformedARGB32PM(uint *buffer, const Operator *, const QSpanData *data,
+ int y, int x, int length)
+{
+ int image_width = data->texture.width;
+ int image_height = data->texture.height;
+
+ const qreal cx = x + qreal(0.5);
+ const qreal cy = y + qreal(0.5);
+
+ const uint *end = buffer + length;
+ uint *b = buffer;
+ if (data->fast_matrix) {
+ // The increment pr x in the scanline
+ int fdx = (int)(data->m11 * fixed_scale);
+ int fdy = (int)(data->m12 * fixed_scale);
+
+ int fx = int((data->m21 * cy
+ + data->m11 * cx + data->dx) * fixed_scale);
+ int fy = int((data->m22 * cy
+ + data->m12 * cx + data->dy) * fixed_scale);
+
+ while (b < end) {
+ int px = fx >> 16;
+ int py = fy >> 16;
+
+ if (blendType == BlendTransformedTiled) {
+ px %= image_width;
+ py %= image_height;
+ if (px < 0) px += image_width;
+ if (py < 0) py += image_height;
+ } else {
+ px = qBound(0, px, image_width - 1);
+ py = qBound(0, py, image_height - 1);
+ }
+ *b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px];
+
+ fx += fdx;
+ fy += fdy;
+ ++b;
+ }
+ } else {
+ const qreal fdx = data->m11;
+ const qreal fdy = data->m12;
+ const qreal fdw = data->m13;
+
+ qreal fx = data->m21 * cy + data->m11 * cx + data->dx;
+ qreal fy = data->m22 * cy + data->m12 * cx + data->dy;
+ qreal fw = data->m23 * cy + data->m13 * cx + data->m33;
+
+ while (b < end) {
+ const qreal iw = fw == 0 ? 1 : 1 / fw;
+ const qreal tx = fx * iw;
+ const qreal ty = fy * iw;
+ int px = int(tx) - (tx < 0);
+ int py = int(ty) - (ty < 0);
+
+ if (blendType == BlendTransformedTiled) {
+ px %= image_width;
+ py %= image_height;
+ if (px < 0) px += image_width;
+ if (py < 0) py += image_height;
+ } else {
+ px = qBound(0, px, image_width - 1);
+ py = qBound(0, py, image_height - 1);
+ }
+ *b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px];
+
+ fx += fdx;
+ fy += fdy;
+ fw += fdw;
+ //force increment to avoid /0
+ if (!fw) {
+ fw += fdw;
+ }
+ ++b;
+ }
+ }
+ return buffer;
+}
+
+template<TextureBlendType blendType> /* either BlendTransformed or BlendTransformedTiled */
static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, const QSpanData *data,
int y, int x, int length)
{
- Q_STATIC_ASSERT(blendType == BlendTransformed || blendType == BlendTransformedTiled);
int image_width = data->texture.width;
int image_height = data->texture.height;
@@ -1569,12 +1647,9 @@ static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *,
const qreal cy = y + qreal(0.5);
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
- if (bpp != QPixelLayout::BPPNone) // Like this to not ICE on GCC 5.3.1
- Q_ASSERT(layout->bpp == bpp);
- // When templated 'fetch' should be inlined at compile time:
- const FetchPixelFunc fetch = (bpp == QPixelLayout::BPPNone) ? qFetchPixel[layout->bpp] : fetchPixel<bpp>;
+ FetchPixelFunc fetch = qFetchPixel[layout->bpp];
- uint *const end = buffer + length;
+ const uint *end = buffer + length;
uint *b = buffer;
if (data->fast_matrix) {
// The increment pr x in the scanline
@@ -2510,17 +2585,12 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
}
// blendType = BlendTransformedBilinear or BlendTransformedBilinearTiled
-template<TextureBlendType blendType, QPixelLayout::BPP bpp>
+template<TextureBlendType blendType>
static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *,
const QSpanData *data, int y, int x, int length)
{
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
const QVector<QRgb> *clut = data->texture.colorTable;
- if (bpp != QPixelLayout::BPPNone) // Like this to not ICE on GCC 5.3.1
- Q_ASSERT(layout->bpp == bpp);
- // When templated 'fetch' should be inlined at compile time:
- const FetchPixelsFunc fetch = (bpp == QPixelLayout::BPPNone) ? qFetchPixels[layout->bpp] : fetchPixels<bpp>;
- const FetchPixelFunc fetch1 = (bpp == QPixelLayout::BPPNone) ? qFetchPixel[layout->bpp] : fetchPixel<bpp>;
int image_width = data->texture.width;
int image_height = data->texture.height;
@@ -2558,6 +2628,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
// The idea is first to do the interpolation between the row s1 and the row s2
// into an intermediate buffer, then we interpolate between two pixel of this buffer.
+ FetchPixelsFunc fetch = qFetchPixels[layout->bpp];
// +1 for the last pixel to interpolate with, and +1 for rounding errors.
uint buf1[buffer_size + 2];
uint buf2[buffer_size + 2];
@@ -2646,6 +2717,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
fx += fdx;
}
} else {
+ FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint buf1[buffer_size];
uint buf2[buffer_size];
uint *b = buffer;
@@ -2656,10 +2728,19 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
int x1 = (fx >> 16);
int x2;
fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2);
- buf1[i * 2 + 0] = fetch1(s1, x1);
- buf1[i * 2 + 1] = fetch1(s1, x2);
- buf2[i * 2 + 0] = fetch1(s2, x1);
- buf2[i * 2 + 1] = fetch1(s2, x2);
+
+ if (layout->bpp == QPixelLayout::BPP32) {
+ buf1[i * 2 + 0] = ((const uint*)s1)[x1];
+ buf1[i * 2 + 1] = ((const uint*)s1)[x2];
+ buf2[i * 2 + 0] = ((const uint*)s2)[x1];
+ buf2[i * 2 + 1] = ((const uint*)s2)[x2];
+ } else {
+ buf1[i * 2 + 0] = fetch(s1, x1);
+ buf1[i * 2 + 1] = fetch(s1, x2);
+ buf2[i * 2 + 0] = fetch(s2, x1);
+ buf2[i * 2 + 1] = fetch(s2, x2);
+ }
+
fx += fdx;
}
layout->convertToARGB32PM(buf1, buf1, len * 2, clut, 0);
@@ -2689,6 +2770,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
}
}
} else { //rotation
+ FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint buf1[buffer_size];
uint buf2[buffer_size];
uint *b = buffer;
@@ -2707,10 +2789,19 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
const uchar *s1 = data->texture.scanLine(y1);
const uchar *s2 = data->texture.scanLine(y2);
- buf1[i * 2 + 0] = fetch1(s1, x1);
- buf1[i * 2 + 1] = fetch1(s1, x2);
- buf2[i * 2 + 0] = fetch1(s2, x1);
- buf2[i * 2 + 1] = fetch1(s2, x2);
+
+ if (layout->bpp == QPixelLayout::BPP32) {
+ buf1[i * 2 + 0] = ((const uint*)s1)[x1];
+ buf1[i * 2 + 1] = ((const uint*)s1)[x2];
+ buf2[i * 2 + 0] = ((const uint*)s2)[x1];
+ buf2[i * 2 + 1] = ((const uint*)s2)[x2];
+ } else {
+ buf1[i * 2 + 0] = fetch(s1, x1);
+ buf1[i * 2 + 1] = fetch(s1, x2);
+ buf2[i * 2 + 0] = fetch(s2, x1);
+ buf2[i * 2 + 1] = fetch(s2, x2);
+ }
+
fx += fdx;
fy += fdy;
}
@@ -2757,6 +2848,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
qreal fy = data->m22 * cy + data->m12 * cx + data->dy;
qreal fw = data->m23 * cy + data->m13 * cx + data->m33;
+ FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint buf1[buffer_size];
uint buf2[buffer_size];
uint *b = buffer;
@@ -2784,10 +2876,18 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
const uchar *s1 = data->texture.scanLine(y1);
const uchar *s2 = data->texture.scanLine(y2);
- buf1[i * 2 + 0] = fetch1(s1, x1);
- buf1[i * 2 + 1] = fetch1(s1, x2);
- buf2[i * 2 + 0] = fetch1(s2, x1);
- buf2[i * 2 + 1] = fetch1(s2, x2);
+
+ if (layout->bpp == QPixelLayout::BPP32) {
+ buf1[i * 2 + 0] = ((const uint*)s1)[x1];
+ buf1[i * 2 + 1] = ((const uint*)s1)[x2];
+ buf2[i * 2 + 0] = ((const uint*)s2)[x1];
+ buf2[i * 2 + 1] = ((const uint*)s2)[x2];
+ } else {
+ buf1[i * 2 + 0] = fetch(s1, x1);
+ buf1[i * 2 + 1] = fetch(s1, x2);
+ buf2[i * 2 + 0] = fetch(s2, x1);
+ buf2[i * 2 + 1] = fetch(s2, x2);
+ }
fx += fdx;
fy += fdy;
@@ -3193,32 +3293,23 @@ static SourceFetchProc sourceFetchUntransformed[QImage::NImageFormats] = {
};
static const SourceFetchProc sourceFetchGeneric[NBlendTypes] = {
- fetchUntransformed, // Untransformed
- fetchUntransformed, // Tiled
- fetchTransformed<BlendTransformed, QPixelLayout::BPPNone>, // Transformed
- fetchTransformed<BlendTransformedTiled, QPixelLayout::BPPNone>, // TransformedTiled
- fetchTransformedBilinear<BlendTransformedBilinear, QPixelLayout::BPPNone>, // TransformedBilinear
- fetchTransformedBilinear<BlendTransformedBilinearTiled, QPixelLayout::BPPNone> // TransformedBilinearTiled
+ fetchUntransformed, // Untransformed
+ fetchUntransformed, // Tiled
+ fetchTransformed<BlendTransformed>, // Transformed
+ fetchTransformed<BlendTransformedTiled>, // TransformedTiled
+ fetchTransformedBilinear<BlendTransformedBilinear>, // Bilinear
+ fetchTransformedBilinear<BlendTransformedBilinearTiled> // BilinearTiled
};
static SourceFetchProc sourceFetchARGB32PM[NBlendTypes] = {
fetchUntransformedARGB32PM, // Untransformed
fetchUntransformedARGB32PM, // Tiled
- fetchTransformed<BlendTransformed, QPixelLayout::BPP32>, // Transformed
- fetchTransformed<BlendTransformedTiled, QPixelLayout::BPP32>, // TransformedTiled
+ fetchTransformedARGB32PM<BlendTransformed>, // Transformed
+ fetchTransformedARGB32PM<BlendTransformedTiled>, // TransformedTiled
fetchTransformedBilinearARGB32PM<BlendTransformedBilinear>, // Bilinear
fetchTransformedBilinearARGB32PM<BlendTransformedBilinearTiled> // BilinearTiled
};
-static SourceFetchProc sourceFetchAny32[NBlendTypes] = {
- fetchUntransformed, // Untransformed
- fetchUntransformed, // Tiled
- fetchTransformed<BlendTransformed, QPixelLayout::BPP32>, // Transformed
- fetchTransformed<BlendTransformedTiled, QPixelLayout::BPP32>, // TransformedTiled
- fetchTransformedBilinear<BlendTransformedBilinear, QPixelLayout::BPP32>, // TransformedBilinear
- fetchTransformedBilinear<BlendTransformedBilinearTiled, QPixelLayout::BPP32> // TransformedBilinearTiled
-};
-
static const SourceFetchProc64 sourceFetchGeneric64[NBlendTypes] = {
fetchUntransformed64, // Untransformed
fetchUntransformed64, // Tiled
@@ -3234,8 +3325,6 @@ static inline SourceFetchProc getSourceFetch(TextureBlendType blendType, QImage:
return sourceFetchARGB32PM[blendType];
if (blendType == BlendUntransformed || blendType == BlendTiled)
return sourceFetchUntransformed[format];
- if (qPixelLayouts[format].bpp == QPixelLayout::BPP32)
- return sourceFetchAny32[blendType];
return sourceFetchGeneric[blendType];
}
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 45a3174734..e537c343bb 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -335,6 +335,8 @@ struct QSpanData
QGradientData gradient;
QTextureData texture;
};
+ QExplicitlySharedDataPointer<const QSharedData> cachedGradient;
+
void init(QRasterBuffer *rb, const QRasterPaintEngine *pe);
void setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode);
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index dd6bcdebec..d8aa727328 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -2314,6 +2314,8 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
= QRectF(sr.x() + clippedTargetRect.x() - r.x(), sr.y() + clippedTargetRect.y() - r.y(),
clippedTargetRect.width(), clippedTargetRect.height()).toRect();
+ clippedSourceRect = clippedSourceRect.intersected(img.rect());
+
uint dbpl = d->rasterBuffer->bytesPerLine();
uint sbpl = img.bytesPerLine();
@@ -4178,7 +4180,8 @@ void QRasterBuffer::flushToARGBImage(QImage *target) const
class QGradientCache
{
- struct CacheInfo
+public:
+ struct CacheInfo : public QSharedData
{
inline CacheInfo(QGradientStops s, int op, QGradient::InterpolationMode mode) :
stops(qMove(s)), opacity(op), interpolationMode(mode) {}
@@ -4189,12 +4192,9 @@ class QGradientCache
QGradient::InterpolationMode interpolationMode;
};
- typedef QMultiHash<quint64, CacheInfo> QGradientColorTableHash;
-
-public:
- typedef QPair<const QRgb *, const QRgba64 *> ColorBufferPair;
+ typedef QMultiHash<quint64, QExplicitlySharedDataPointer<const CacheInfo> > QGradientColorTableHash;
- inline ColorBufferPair getBuffer(const QGradient &gradient, int opacity) {
+ inline QExplicitlySharedDataPointer<const CacheInfo> getBuffer(const QGradient &gradient, int opacity) {
quint64 hash_val = 0;
const QGradientStops stops = gradient.stops();
@@ -4208,10 +4208,9 @@ public:
return addCacheElement(hash_val, gradient, opacity);
else {
do {
- const CacheInfo &cache_info = it.value();
- if (cache_info.stops == stops && cache_info.opacity == opacity && cache_info.interpolationMode == gradient.interpolationMode())
- return qMakePair(reinterpret_cast<const QRgb *>(cache_info.buffer32),
- reinterpret_cast<const QRgba64 *>(cache_info.buffer64));
+ const QExplicitlySharedDataPointer<const CacheInfo> &cache_info = it.value();
+ if (cache_info->stops == stops && cache_info->opacity == opacity && cache_info->interpolationMode == gradient.interpolationMode())
+ return cache_info;
++it;
} while (it != cache.constEnd() && it.key() == hash_val);
// an exact match for these stops and opacity was not found, create new cache
@@ -4225,18 +4224,16 @@ protected:
inline void generateGradientColorTable(const QGradient& g,
QRgba64 *colorTable,
int size, int opacity) const;
- ColorBufferPair addCacheElement(quint64 hash_val, const QGradient &gradient, int opacity) {
+ QExplicitlySharedDataPointer<const CacheInfo> addCacheElement(quint64 hash_val, const QGradient &gradient, int opacity) {
if (cache.size() == maxCacheSize()) {
// may remove more than 1, but OK
cache.erase(cache.begin() + (qrand() % maxCacheSize()));
}
- CacheInfo cache_entry(gradient.stops(), opacity, gradient.interpolationMode());
- generateGradientColorTable(gradient, cache_entry.buffer64, paletteSize(), opacity);
+ QExplicitlySharedDataPointer<CacheInfo> cache_entry(new CacheInfo (gradient.stops(), opacity, gradient.interpolationMode()));
+ generateGradientColorTable(gradient, cache_entry->buffer64, paletteSize(), opacity);
for (int i = 0; i < GRADIENT_STOPTABLE_SIZE; ++i)
- cache_entry.buffer32[i] = cache_entry.buffer64[i].toArgb32();
- CacheInfo &cache_value = cache.insert(hash_val, cache_entry).value();
- return qMakePair(reinterpret_cast<const QRgb *>(cache_value.buffer32),
- reinterpret_cast<const QRgba64 *>(cache_value.buffer64));
+ cache_entry->buffer32[i] = cache_entry->buffer64[i].toArgb32();
+ return cache.insert(hash_val, cache_entry).value();
}
QGradientColorTableHash cache;
@@ -4455,6 +4452,7 @@ Q_GUI_EXPORT extern QImage qt_imageForBrush(int brushStyle, bool invert);
void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode)
{
Qt::BrushStyle brushStyle = qbrush_style(brush);
+ cachedGradient.reset();
switch (brushStyle) {
case Qt::SolidPattern: {
type = Solid;
@@ -4471,9 +4469,10 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
const QLinearGradient *g = static_cast<const QLinearGradient *>(brush.gradient());
gradient.alphaColor = !brush.isOpaque() || alpha != 256;
- QGradientCache::ColorBufferPair colorBuffers = qt_gradient_cache()->getBuffer(*g, alpha);
- gradient.colorTable64 = colorBuffers.second;
- gradient.colorTable32 = colorBuffers.first;
+ QExplicitlySharedDataPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
+ cachedGradient = cacheInfo;
+ gradient.colorTable32 = cacheInfo->buffer32;
+ gradient.colorTable64 = cacheInfo->buffer64;
gradient.spread = g->spread();
@@ -4492,9 +4491,10 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
const QRadialGradient *g = static_cast<const QRadialGradient *>(brush.gradient());
gradient.alphaColor = !brush.isOpaque() || alpha != 256;
- QGradientCache::ColorBufferPair colorBuffers = qt_gradient_cache()->getBuffer(*g, alpha);
- gradient.colorTable64 = colorBuffers.second;
- gradient.colorTable32 = colorBuffers.first;
+ QExplicitlySharedDataPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
+ cachedGradient = cacheInfo;
+ gradient.colorTable32 = cacheInfo->buffer32;
+ gradient.colorTable64 = cacheInfo->buffer64;
gradient.spread = g->spread();
@@ -4517,9 +4517,10 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
const QConicalGradient *g = static_cast<const QConicalGradient *>(brush.gradient());
gradient.alphaColor = !brush.isOpaque() || alpha != 256;
- QGradientCache::ColorBufferPair colorBuffers = qt_gradient_cache()->getBuffer(*g, alpha);
- gradient.colorTable64 = colorBuffers.second;
- gradient.colorTable32 = colorBuffers.first;
+ QExplicitlySharedDataPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
+ cachedGradient = cacheInfo;
+ gradient.colorTable32 = cacheInfo->buffer32;
+ gradient.colorTable64 = cacheInfo->buffer64;
gradient.spread = QGradient::RepeatSpread;
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 6472481e7a..74b961f042 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -6439,7 +6439,8 @@ void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QText
updateState(state);
if (!ti.glyphs.numGlyphs) {
- // nothing to do
+ drawTextItemDecoration(q, p, ti.fontEngine, textEngine, ti.underlineStyle,
+ ti.flags, ti.width.toReal(), ti.charFormat);
} else if (ti.fontEngine->type() == QFontEngine::Multi) {
QFontEngineMulti *multi = static_cast<QFontEngineMulti *>(ti.fontEngine);
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index f92a681eca..addd9c0c2c 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -1458,25 +1458,6 @@ QPathClipper::QPathClipper(const QPainterPath &subject,
bMask = clipPath.fillRule() == Qt::WindingFill ? ~0x0 : 0x1;
}
-template <typename Iterator, typename Equality>
-Iterator qRemoveDuplicates(Iterator begin, Iterator end, Equality eq)
-{
- if (begin == end)
- return end;
-
- Iterator last = begin;
- ++begin;
- Iterator insert = begin;
- for (Iterator it = begin; it != end; ++it) {
- if (!eq(*it, *last)) {
- *insert++ = *it;
- last = it;
- }
- }
-
- return insert;
-}
-
static void clear(QWingedEdge& list, int edge, QPathEdge::Traversal traversal)
{
QWingedEdge::TraversalStatus status;
@@ -1643,7 +1624,7 @@ bool QPathClipper::doClip(QWingedEdge &list, ClipperMode mode)
y_coords << list.vertex(i)->y;
std::sort(y_coords.begin(), y_coords.end());
- y_coords.resize(qRemoveDuplicates(y_coords.begin(), y_coords.end(), fuzzyCompare) - y_coords.begin());
+ y_coords.erase(std::unique(y_coords.begin(), y_coords.end(), fuzzyCompare), y_coords.end());
#ifdef QDEBUG_CLIPPER
printf("sorted y coords:\n");
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index d246c96da6..84e18a64dd 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1924,7 +1924,7 @@ int QPdfEnginePrivate::writeCompressed(const char *src, int len)
}
int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height, int depth,
- int maskObject, int softMaskObject, bool dct)
+ int maskObject, int softMaskObject, bool dct, bool isMono)
{
int image = addXrefEntry(-1);
xprintf("<<\n"
@@ -1934,8 +1934,13 @@ int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height,
"/Height %d\n", width, height);
if (depth == 1) {
- xprintf("/ImageMask true\n"
- "/Decode [1 0]\n");
+ if (!isMono) {
+ xprintf("/ImageMask true\n"
+ "/Decode [1 0]\n");
+ } else {
+ xprintf("/BitsPerComponent 1\n"
+ "/ColorSpace /DeviceGray\n");
+ }
} else {
xprintf("/BitsPerComponent 8\n"
"/ColorSpace %s\n", (depth == 32) ? "/DeviceRGB" : "/DeviceGray");
@@ -2453,7 +2458,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n
memcpy(rawdata, image.constScanLine(y), bytesPerLine);
rawdata += bytesPerLine;
}
- object = writeImage(data, w, h, d, 0, 0);
+ object = writeImage(data, w, h, d, 0, 0, false, is_monochrome(img.colorTable()));
} else {
QByteArray softMaskData;
bool dct = false;
diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h
index cb1a91e09f..a6aa2940c8 100644
--- a/src/gui/painting/qpdf_p.h
+++ b/src/gui/painting/qpdf_p.h
@@ -295,7 +295,7 @@ private:
int streampos;
int writeImage(const QByteArray &data, int width, int height, int depth,
- int maskObject, int softMaskObject, bool dct = false);
+ int maskObject, int softMaskObject, bool dct = false, bool isMono = false);
void writePage();
int addXrefEntry(int object, bool printostr = true);
diff --git a/src/gui/painting/qt_attribution.json b/src/gui/painting/qt_attribution.json
new file mode 100644
index 0000000000..f635cf98ac
--- /dev/null
+++ b/src/gui/painting/qt_attribution.json
@@ -0,0 +1,14 @@
+{
+ "Id": "grayraster",
+ "Name": "Anti-aliasing rasterizer from FreeType 2",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used in Qt GUI.",
+ "Path": "qgrayraster.c",
+
+ "Description": "FreeType is a freely available software library to render fonts.",
+ "Homepage": "http://www.freetype.org",
+ "License": "Freetype Project License or GNU General Public License v2.0 only",
+ "LicenseId": "FTL or GPL-2.0",
+ "LicenseFile": "../../3rdparty/freetype/docs/LICENSE.TXT",
+ "Copyright": "Copyright 2006-2015 by David Turner, Robert Wilhelm, and Werner Lemberg."
+}
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index cb19a42688..31d832a9ce 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -746,8 +746,9 @@ static ColorData parseColorValue(QCss::Value v)
QVector<QCss::Value> colorDigits;
if (!p.parseExpr(&colorDigits))
return ColorData();
+ const int tokenCount = colorDigits.count();
- for (int i = 0; i < qMin(colorDigits.count(), 7); i += 2) {
+ for (int i = 0; i < qMin(tokenCount, 7); i += 2) {
if (colorDigits.at(i).type == Value::Percentage) {
colorDigits[i].variant = colorDigits.at(i).variant.toReal() * (255. / 100.);
colorDigits[i].type = Value::Number;
@@ -756,11 +757,15 @@ static ColorData parseColorValue(QCss::Value v)
}
}
+
+ if (tokenCount < 5)
+ return ColorData();
+
int v1 = colorDigits.at(0).variant.toInt();
int v2 = colorDigits.at(2).variant.toInt();
int v3 = colorDigits.at(4).variant.toInt();
int alpha = 255;
- if (colorDigits.count() >= 7) {
+ if (tokenCount >= 7) {
int alphaValue = colorDigits.at(6).variant.toInt();
if (rgba && alphaValue <= 1)
alpha = colorDigits.at(6).variant.toReal() * 255.;
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 7fcac9b9f2..d2da24ca94 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -804,7 +804,8 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFo
Q_UNUSED(family);
Q_UNUSED(styleHint);
- QStringList retList;
+ QStringList preferredFallbacks;
+ QStringList otherFallbacks;
size_t writingSystem = std::find(scriptForWritingSystem,
scriptForWritingSystem + QFontDatabase::WritingSystemsCount,
@@ -825,18 +826,18 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFo
QtFontFoundry *foundry = f->foundries[j];
for (int k = 0; k < foundry->count; ++k) {
- if (style == foundry->styles[k]->key.style) {
- if (foundry->name.isEmpty())
- retList.append(f->name);
- else
- retList.append(f->name + QLatin1String(" [") + foundry->name + QLatin1Char(']'));
- break;
- }
+ QString name = foundry->name.isEmpty()
+ ? f->name
+ : f->name + QLatin1String(" [") + foundry->name + QLatin1Char(']');
+ if (style == foundry->styles[k]->key.style)
+ preferredFallbacks.append(name);
+ else
+ otherFallbacks.append(name);
}
}
}
- return retList;
+ return preferredFallbacks + otherFallbacks;
}
static void initializeDb();
@@ -1659,9 +1660,6 @@ bool QFontDatabase::isFixedPitch(const QString &family,
bool QFontDatabase::isBitmapScalable(const QString &family,
const QString &style) const
{
- if (QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable())
- return true;
-
bool bitmapScalable = false;
QString familyName, foundryName;
parseFontName(family, foundryName, familyName);
@@ -1702,9 +1700,6 @@ bool QFontDatabase::isBitmapScalable(const QString &family,
*/
bool QFontDatabase::isSmoothlyScalable(const QString &family, const QString &style) const
{
- if (QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable())
- return true;
-
bool smoothScalable = false;
QString familyName, foundryName;
parseFontName(family, foundryName, familyName);
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index d6af6d21a2..09b0475a84 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -1910,7 +1910,7 @@ void QFontEngineFT::unlockAlphaMapForGlyph()
static inline bool is2dRotation(const QTransform &t)
{
return qFuzzyCompare(t.m11(), t.m22()) && qFuzzyCompare(t.m12(), -t.m21())
- && qFuzzyCompare(t.m11()*t.m22() - t.m12()*t.m21(), 1.0);
+ && qFuzzyCompare(t.m11()*t.m22() - t.m12()*t.m21(), qreal(1.0));
}
QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g,
diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri
index 3fe47a6645..c1c52f2d1a 100644
--- a/src/gui/text/text.pri
+++ b/src/gui/text/text.pri
@@ -88,7 +88,7 @@ HEADERS += \
qtConfig(harfbuzz)|qtConfig(system-harfbuzz) {
DEFINES += QT_ENABLE_HARFBUZZ_NG
- include($$PWD/../../3rdparty/harfbuzz_dependency.pri)
+ QMAKE_USE_PRIVATE += harfbuzz
SOURCES += text/qharfbuzzng.cpp
HEADERS += text/qharfbuzzng_p.h