As a rule, we don't deliver touch events containing only stationary
touchpoints. To fix QTBUG-52510 we added an exception in
1bd0ab7050 : if the velocity changed,
deliver it anyway. Now we need to do the same if the pressure changed.
Also, on the customer's hardware, pressure is indicated via ABS_MT_PRESSURE.
Change-Id: If7f7088df055d686cdd86967b999e38024f8170f
Fixes: QTBUG-77142
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
If name argument is empty, e.g. an icon is created by
QIcon::fromTheme(""), then icon_name_hash() will access
a byte at index 1, which is outside of the string.
Change-Id: I109c476718939d7dd252007ebac48c3dbbeceb72
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This makes it visible also in the overview documentation of the module,
and can be used to automatically generate attribution documents.
The code actually mentions the names and file versions (CVS?) where things
got copied from; however, X11 seems to have stopped using CVS a long time
ago, and without a server it's hard to determine the exact X11 version that
was copied from. It arguably doesn't matter, anyhow, because we won't update
the code anymore.
Fixes: QTBUG-70556
Change-Id: Ib17117a1a3c4112b81982afbd51273048a43221a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The creation was made lazy in 18f415e46d, for those platforms (macOS) that
need a platform window to successfully create a platform backingstore. But we
don't need to delay creation if we actually have a platform window at the time
of constructing the QBackingStore.
Change-Id: I6367736ddca82900dec2751a85a8bc35cc742bb5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Just in case the image is larger than 2 GB (512 megapixels).
Change-Id: I343f2beed55440a7ac0bfffd15636cbc68dfa13d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 1e2bf51d3e)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Emitting a signal executes an unknowable amount of code. We shouldn't
hold a mutex while doing so. E.g., if the signal emission causes
another call to QGuiApplication::setFont(), the old code would
deadlock, since applicationFontMutex is not recursive.
Fix by taking a copy of the application font under mutex protection,
then dropping the lock for the emission of the signal.
Change-Id: Ib2569b3a08af6ef5f38459a19f74cb0db27b7772
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Makes the code a little cleaner, avoiding an issue caused
by UB and/or optimization bug in msvc2019.
Fixes: QTBUG-77119
Fixes: QTBUG-77230
Change-Id: I9bc8f427a90e6fe32b3c26301bbb703a3c4ad846
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
While there is likely no example of it in Qt itself, applications can
use QOpenGLShaderProgram instances on different threads. These instances
have nothing to do with each other but they do share a global cache object.
This becomes problematic without proper synchronization.
Change-Id: I80faf73f34af7e67349eee916bb3f216e22c07fd
Fixes: QTBUG-77469
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Add support for astc format files as an experimental feature.
To enable, configure with "-feature-texture_format_astc_experimental"
(Backported from commit 5a4db421bd94acd12a4ac1f77031996b95f85dbf)
Change-Id: I9a2f7b1fa20ba344b79637bafb50ff2bd0596747
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Avoid unreasonable threshold values for extremely wide pens, since
that can lead to a very high processing cost.
The rare usecases where this would make a noticeable difference will
necessarily also be using scaling, and so is anyway depending on
setting a suitable curve threshold manually.
Fixes: QTBUG-77241
Change-Id: I27cea7d566d144389bb430739fde4f6033c4a28c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Commit b6ded193 added an unconditional dereference
of the platformScreen pointer, for calls where nativePostion
is non-nullptr.
Change-Id: I4a6fbbd0337f91d4fcb76c17b4dc60e1b9ad10ed
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Simply return a Glyph pointer and not a QImage to avoid allocating and
deleting lots of d pointers for QImage when drawing text. Saves one
new/delete pair per glyph drawn and speeds up text drawing by 10% for
relatively large glyphs (probably more for smaller ones).
The qtext::paintLayoutToPixmap() benchmark shows a 16% improvement
in performance with this change.
Renamed the method to glyphData().
Change-Id: I7a353de521e4f4321c770fb1ac6043d33f6f332c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
We were missing attribution for the AGLFN tables.
Task-number: QTBUG-70968
Change-Id: Ib84cbd25c9f7c49611761c9eba16624de5b77dd2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
When calling QTextDocument::clearUndoRedoStacks() with UndoStack,
there were two bugs: The first was that we were retrieving
the item at "undoState" and deleting this. This is actually the
upper limit of the for loop. If the stack does not contain any
redos, then it would be == undoStack.size() and we would assert.
If there were redos, then we would delete the item at undoState
multiple times (actually undoState times).
In addition, when the loop exited, we first removed the dangling
pointers using remove() and then there was a weird resize() to
the new size minus the old undoState.
This would either assert because we tried to resize to a negative
number, or it would arbitrarily remove items from the stack.
[ChangeLog][QtGui][Text] Fixed a crash bug in
QTextDocument::clearUndoRedoStacks(QTextDocument::UndoStack).
Task-number: QTBUG-69546
Change-Id: I8a93e828ec27970763a2756071fa0b01678d2dcd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Also sanitize the initial WebAssembly hack. Both eglfs and wasm lack the concept
of true raster windows. A QWindow with RasterSurface is rendered with OpenGL
no matter what. The two platforms took two different approaches to work around
the rest of the machinery:
- wasm disabled the QOpenGLContext warning for non-OpenGL QWindows,
- eglfs forced the QWindow surfaceType to OpenGLSurface whenever it was
originally set to RasterSurface.
Now, the latter breaks since c4e9eabc30, leaving
all raster window applications failing on eglfs, because flush in the backingstore
is now checking the surface type and disallows OpenGLSurface windows. (just like
how QOpenGLContext disallows RasterSurface windows)
To solve all this correctly, introduce a new platform capability,
OpenGLOnRasterSurface, and remove the special handling in the platform plugins.
Change-Id: I7785dfb1c955577bbdccdc14ebaaac5babdec57c
Fixes: QTBUG-77100
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Change-Id: Iaa6eb4d64f549a31aa5c53145e8b37facec4ea78
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Added checking corner cases (more specific formulas) in
color_dodge_op()/color_dodge_op_rgb64() and color_burn_op()/color_burn_op_rgb64()
to produce correct results for any input.
Task-number: QTBUG-77231
Change-Id: I274f80b356bd4236a9176a84a95604c2eb01787a
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
For some reason, the overload resolution of the
High DPI scale() functions introduced by
b6ded193ee chose the
wrong overloads for QPointF and/or QPoint; it fell
back to the generic template intended for qreal,
QSize, etc, ignoring the origin. Remove the
template and spell out all overloads.
Fixes: QTBUG-77255
Change-Id: I5661f16f7326f65156f646f430f5a0c71d5302d2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
So that the context can be referenced during initialization.
Change-Id: I9ec69b2431ba1ac6256cb2e969a76f515497e247
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Depending on the active QPA plugin, QPixmaps may now be created and
used also in non-main threads. But QPixmapCache is not designed to be
used from such threads, so add guards to ignore such access attempts,
both from application code and from Qt library code.
Such unsafe access would often cause a cryptical "~QObject: Timers
cannot be stopped from another thread" warning; that also disappears
with this fix.
[ChangeLog][QtGui][QPixmapCache] Ignore unsafe access from non-main
threads
Task-number: QTBUG-76694
Task-number: QTBUG-72523
Change-Id: Ia2db37e528aec08bfb48808630bdf5e543689039
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This is an enabler for supporting pen color for color fonts in
Qt Quick.
Task-number: QTBUG-74761
Change-Id: I3e605f939e6677cbbd4a650ae7998dea8fd2d7a9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Color fonts may also contain regular alphabet characters that
should be rendered with the current pen. In Qt, however, these
characters were drawn into the cache with a default pen color
of black.
Since all characters in a font is currently backed by the same cache,
and it would require a lot of plumbing to get around this, a step
in the right direction is to include the current pen color in the
cache as long as it is an RGB cache. This means that drawing
text with the color font with different pen colors will create
different caches.
There is no API to select font color on Freetype currently, but
this problem has also not been observed there, as the fonts
in question, with both regular and color glyphs, are not being
detected as color fonts (so the text color will be correct).
So Freetype will be left out for now.
[ChangeLog][QtGui][Text] Fixed bug where regular text rendered
with a color font would always display in black.
Task-number: QTBUG-55096
Task-number: QTBUG-74761
Change-Id: Icc7dbf73241db1e7cc6a0de18c2de927aeecf713
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
7a7c722782 caused a regresssion in some
cases.
Change-Id: I1089a79534d811b195de663ff664d9ba5a6ac6c5
Fixes: QTBUG-74110
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Don't go through the doScaledRead path (i.e. calling read_image_scaled)
when reading an image that the target size is the image of the file we
are opening.
This makes the loading of the file much faster while keeping the output
correct.
[ChangeLog][QtGui][QImage] Improve loading time when loading png files
that have the same size as the target.
Change-Id: I2a33c49fe1ce52ec296c2175ee542b5bcdec2c4b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Calls like
QHighDpi::fromNativePixels(point, window)
would return device independent coordinates outside any
screen in cases where the window is spanning multiple
screens and the native point was not on the main screen.
Correct this by looking up the correct screen and use
its scale factor and origin when scaling coordinates.
Task-number: QTBUG-73231
Change-Id: I01a3a42f42121b8d9f4ced2bb0fb023d6ae6bfe7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
With Web Engine, QQuickWidget or similar, the code can hit on the offscreen
window, when its handle is null. Add a check.
Amends 3af7b27917.
Fixes: QTBUG-76440
Change-Id: I123633d18386efd3dbfb22aad6072e4f0877a62e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
On Linux this role is needed to make desktop notifications work.
There is no equivalent for Windows, iOS or macOS. On these platforms the
role will have no effect.
Fixes: QTBUG-76333
Change-Id: I4ef3b3321f7a0e2c09c1ce432a668428d14c52b7
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
We need one scale() function for each type: the scale factor can be
inverted by the caller for the fromNative case. Add a generic
templated implementation which will handle simple types. Add add
specialization functions for compound types that don't have
operator*(), as well as for position types (e.g. QPoint) which account
for the origin.
There's no need for fromNativePixels() and toNativePixels() overloads
for each type; replace with generic implementations which call
scale(). Do the same thing for fromNativeLocalPosition().
Some user code is calling fromNative()/toNative() directly, so leave a
definition of those functions around for now. Also leave a couple of
one-off scaling functions which do not fit the pattern.
Also fix “narrowing conversion scaleFactor to int” warning for the
QMargins scale function.
Change-Id: Ia67accbb670a80dc1747c2e264b97aab75b1251b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The code for generating round line joins is optimized with a shortcut
for the inner, normally invisible joins. For certain joins of a
tightly turning bezier, this optimization would lead to visible
painting error. Fix by avoiding the optimization if the next control
point is so close as to allow such tight turns.
As a driveby, make the angle > 90 test cheaper, since absolute
precision is not required in the optimization choice.
Fixes: QTBUG-75008
Change-Id: I293e0776003310dc36fa7f43fbcd9c25f1f8fa5d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
More aggressively skip processing empty spans.
Tested with the qpainter benchmark on armv7; yields
small but measurable improvement.
Change-Id: Ie0ed0f824a0be7bcc2de3a9aa98ebccb0e8accae
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
@3x is in use on iOS already, so extend the handling in QImageReader
to all single-digit factors, like QIcon does.
Fixes: QTBUG-76273
Change-Id: Ic9442731c0549dbe8f797e1ddb1a09d8447e8441
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Back in 36cb3f3f65, we started
properly reference counting font engines as they were entered into
the font cache. Prior to this, ref.load == 0 would mean that the
engine was essentially owned by the cache.
When the change was made, the condition that an engine must be in
use if its reference is != 0 remained, and the result of this was
used to calculate the limit for when the cache should be flushed.
Since this limit was miscalculated, the cache would keep growing,
even if it only contained unused font engines.
[ChangeLog][QtGui][Text] Fixed a bug which could cause the font
cache to grow larger than it was supposed to.
Task-number: QTBUG-76219
Change-Id: I4d1541756f3bdf5bd9b0301bf47c6db2e220716a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
If the start position of a backward string search was the at the start
of a paragraph, the code would start searching at an illegal position
(at the eol character) in the preceding paragraph. That caused
that whole paragraph to be skipped, so any matches there
would not be found. Fix by making sure the search starts at legal
position.
Fixes: QTBUG-48035
Change-Id: Id6c0159b6613ec75ec617a0a57096ceef2b4cbd0
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
It's cursor position not widget position, pos() is relative
to the widget, and 3 of these accessors return QPointF.
Amends e6ddae07e1.
Task-number: QTBUG-36985
Change-Id: Ide437f7496824f8cdd0d03fa38ad7b573e30feaa
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Clear QGuiApplication::focus_window (again) in the
QWindow destructor.
Task-number: QTBUG-75326
Change-Id: Ief00b6adfb267fcc7e3881fd728e12df07fc1094
Reviewed-by: Christian Andersen <csandersen3@gmail.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Many operations on and with QPainterPaths do calculations on the path
coordinates, e.g. computing the distance between points, which may cause
numerical overflow for extreme coordinate values. This patch
introduces a limit on the coordinate values and extends the previous
check against nan/inf coordinates to also check against out of range
coordinates.
Fixes: QTBUG-75574
Change-Id: I3a2fa88bfc6a9f19934c43d3dbbfb41855c78107
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
The value of NColorRoles got changed since 5.11. It introduced one more
role called "PlaceholderText" in the ColorRole enumeration.
When using QDataStream (5.12) to read QPalette objects from a file
written by 5.9 (<5.11), the processing results are inconsistent.
Fixes: QTBUG-74885
Change-Id: I14d57f9603a26e5890b4fd57c7e464c5b38eb3f2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Without this some readers will fail to display the image or position
the image at the start of a paragraph rather than inline.
Change-Id: I2b9257e3193e5e68eb20112017a0c23be1d06cb0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
If an embedded image is already encodeded as an png or jpg write the
data as is instead of decoding to a QImage and re-encoding as a new
image.
Change-Id: I479ae1fddbf59900a500497dd1bdf7449c21f273
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Replace QWindow / QScreen / QPlatformScreen overloads with template
functions that take a generic context argument.
The API now no longer supports implicit conversions from
QPointer<QWindow> to QWindow *, add explicit data()
call to usage in qxcbdrag.cpp.
Change-Id: I63d7f16f6356873280df58f4e7c924bf0b0eca5b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>