The DSA emulator functions query which texture is currently bound
to a given target, then bind the new one, perform an operation,
and bind the old one back.
The problem is that in order to query what's currently bound to the
GL_TEXTURE_<X> target one needs to call glGetIntegerv passing
GL_BINDING_TEXTURE_<X>. Since both GL_TEXTURE_X and GL_BINDING_TEXTURE_X
values are completely arbitrary (not contiguous nor related in any way)
we need to pass *both* them to the functions.
The right GL_BINDING_TEXTURE_X was getting already chosen (and stored)
at texture creation time by QOpenGLTexture, so it's just a matter
of passing it around.
For the "real" DSA functions, the binding target is ignored.
Change-Id: Ida823abbfb142d4a22bf9f9a762b160b7e281c6d
Reviewed-by: James Turner <james.turner@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Remove reference to released font-engine so we don't risk returning it
later.
Change-Id: I741a741567a079818c7f414ac1f9c0b5a9677322
Task-number: QTBUG-36522
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
If the user code installs a message handler that uses
any API that prints logs (handled by qt_message_print)
then this will lead to an infinite loop.
This patch adds a thread local storage to check
if the message handler is done before the thread
is calling it again.
Note: This check is performed only if the compiler
supports thread_local (__declspec(thread) for MSVC).
Change-Id: I43b0460b8f39b26a18de48a5652a5e55f0b336f8
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
If an egl surface can not be created (e.g. when out of memory) the
application should not crash. In this case we will not be able to make
the egl surface current and have to return false in the makeCurrent call
in QQnxGlContext.
Change-Id: If9b5a82a0f64dc0a42bee687d351bea43fb05d51
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
setGeometry will adjust the buffer for an egl window when a egl surface is created.
Adjusting the buffer somewhere else can be potentially harmful. Another reason is that
every egl window has a buffer on its own (unlike raster windows) so we do not have to
check if we have to create a buffer after reparanting.
Change-Id: I01406867a0dab598dac7d86e1f1e28ca9736a299
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
The overload used an evil hack to work around a flaw in the QSslCipher
API rather than fixing the API. The hack was broken by the addition of
support for newer versions of TLS. This change solves the issue properly
by fixing the QSslCipher API then using the fixed version.
Task-Number: QTBUG-34688
Change-Id: Ibf677c374f837f705395741e730d40d8f912d7c6
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
There's no loss of data when converting a Unicode string to UTF-8,
so don't state that in the docs.
Change-Id: If26914ec674a994d9c59136448e8e4292d0412e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QGraphicsSceneIndexIntersector was used as a kind of polymorpic predicate in
items_helper(). But it had only one function and the instances of it, which
were kept around in QGraphicsSceneIndexPrivate, were re-initialised on every
call to items_helper(), which means that one can just as well pass that
miniscule amount of data to the function itself.
Replaced the polymorphism with a function pointer and the comparison state
(which is conceptually const if it wasn't for the requirement to assign
to it all the time) with a const void * argument.
Effects on Linux AMD64 GCC 4.9-trunk release stripped:
text: -1584B
data: -376B
relocs: -26
I've wrapped the functions in a namespace. The only reason for this is
to keep the functions, previously defined in class bodies, at the same
indentation level so as not to destroy the git-blame history for them.
Change-Id: I8e1f48030047a3c54e881de7c77a3325b3e1f509
Reviewed-by: Alexis Menard <alexis@webkit.org>
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
It was impossible to hide/show the close button after a QMdiSubWindow
was created.
Task-number: QTBUG-9933
Task-number: QTBUG-27274
[ChangeLog][QtWidgets][QMdiSubWindow] Fixed setWindowFlags() for QMdiSubWindow.
Change-Id: I7db9a1bef5ba8a8ace729acb85682c8b3de9c33c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This avoids "change of sign" warnings as found by ICC when the high
bit is set. This often happens when you do
X & ~Y
as ~Y probably has bit 31 on. If the enum is unsigned, then there's a sign conversion.
Change-Id: Ia5f221d928ac0155f4504a70c4046e60c25fbf3b
Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When MSVC supports ref-qualified members, we need to ensure that
qstring_compat.cpp can see the non-qualified definitions in qstring.h,
which means no precompiled header.
Alternatively, for a bootstrapped build we could not compile
qstring_compat.cpp or #ifndef the functions.
Change-Id: I8ece34503060f0b4b0f8f2df2fb9b0fb1311e269
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
http://msdn.microsoft.com/en-us/library/b0084kay(v=vs.120).aspx says:
__AVX__ Defined when /arch:AVX is specified.
Now we know what flag it is, we don't need to use our _M_AVX flag
anymore. We're also now assuming that Microsoft will follow the same
pattern for AVX2 (i.e., __AVX2__), so this commit also removes the
check for _M_AVX2.
The other defines that were defined alongside AVX2 are removed because
they have no use currently in Qt.
Change-Id: I64a026b2206dbd0d2dffa7c803bee969c9b94a94
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This way, the same codebase works for x86, x86-64 LP64 and x86-64 ILP32
(a.k.a. x32).
Task-number: QTBUG-35463
Change-Id: Iffcecc6a4c03267fb64e287c2d6226d078d7d115
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add overloads to the find() methods in QPlainTextEdit and QTextEdit
that find the next occurrence matching the passed regular expression.
These are convenience methods that eliminate the need to use the
document() method and the need to handle the QTextCursor return value.
[ChangeLog][QtWidgets][QPlainTextEdit] Added find method overload using QRegExp
[ChangeLog][QtWidgets][QTextEdit] Added find method overload using QRegExp
Change-Id: Ia6139b771e3ae4ca02e4b8ea7fde19e5dc71b9d8
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Just so it's closer to the code that does the inverse.
Change-Id: Iecaab20adad2cb7f4a55818c687aecc76f0523e7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Amazing how many places had the conversion duplicated. When compiling
with GCC under -O3 (which enables -ftree-vectorize), GCC would use SIMD
by using the PMOVZXBW instruction, but only if the -msse4.1 was passed
(or equivalent -march= switch), which almost no one did.
Also, the two lastIndexOf and the qt_find_latin1_string updates are also
fixing bugs because the old code forgot to cast the input to uchar
first. That meant the compiler was generating sign-extension from 8 to
16 bits, as opposed to zero-extension.
Change-Id: I4e2430a51dfc337994834524d3540382157509ef
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
We have quite a few versions of this code in qstring.cpp, which means
that it's hard to optimize them all. Instead, create two functions to
do the comparisons, one case-sensitive (ucstrncmp & ucstrcmp) and one
case-insensitive (ucstricmp).
Change-Id: I55c6588ade160bc8d16e19727b8f3dca523b38bf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This updates only the case-sensitive searching. The case-insensitive
part requires quite a few Unicode transformations.
The benchmarks tried are the plain word-by-word comparison used in Qt
5.2 and in builds without SSE2; the SSE2 benchmark; a benchmark using
the SSE4.2 "strchr" instruction. I've run the benchmark both for CPU
cyles used as well as bytes/sec scanning strings.
Improvement over the Qt 5.2 code:
GCC 4.7 GCC 4.9 Clang 3.4 ICC 14
cycles MB/s cycles MB/s cycles MB/s cycles MB/s
SSE2 2.1x 2.9x 2.2x 2.9x 2.1x 3.1x 2.2x 3.1x
SSE4.2 1.5x 1.7x 1.5x 1.7x 1.5x 1.7x 1.6x 1.8x
Once again, the SSE4.2 instruction wasn't as effective as I'd hoped
(not to mention that Clang seems to have some bugs emitting it).
Change-Id: I57c6e65e91791bb5265965cbd1af7fbd8fe7f588
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
qMemEquals is the same as ucstrncmp and checking that the comparison
was 0, so implement it like that. Meanwhile, it already had code for
doing 32-bit comparisons in the absence of higher SIMD optimizations,
which we can now make use of.
Change-Id: If26b446856e3b756efabc98b471fcdc344a8e732
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
The benchmarks showed that the basic SSE2-based building block
improves performance by about 50% with data extracted from a Qt
Creator run. None of the other alternatives provide clear better
results -- the best was 3.8% and with only one compiler.
Change-Id: I77314785afecfacaf21c41fd79c97cadf357f895
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Decoding from UTF-8 is easy: if the high bit is set, we fall back to
the byte-by-byte decoding. Encoding to UTF-8 requires a little bit
more work: to detect anything between 0x0080 and 0xffff, we have
several options but none as easy as above. Multiple alternatives are
in the benchmark code.
In both loops, we do two things once we run into a non-ASCII
character: first, we continue the loop for the remainder of ASCII
characters in the buffer (which we can tell by checking the bits set
in the mask), then we find the last non-ASCII character in that
16-character group, so we don't reenter the SSE code too soon.
For the UTF-8 encoding, I have chosen the alternative that results in
the best performance. It's closely tied to the alternative running the
PMIN instruction, but that requires SSE 4.1. It's not worth the
complexity. And quite counter-intuitively, the dedicated string
instruction from SSE 4.2 performs most poorly of all solutions. This
begs re-visiting the performance of the toLatin1 encoder.
The best of 10 benchmark runs of this code were measured on my
SandyBridge CPU @ 2.66 GHz (turbo @ 3.3 GHz), both as CPU cycles and
as CPU ticks:
Compared to: ICU Qt 4.7 non-SSE Qt 5.3
Data set fromUtf8 toUtf8 fromUtf8 toUtf8 fromUtf8 toUtf8
ASCII only 7.50x 6.22x 6.94x 7.60x 4.45x 4.90x
2-char UTF-8 1.17x 1.33x 1.64x 1.56x 1.01x 1.02x
3-char UTF-8 1.08x 1.18x 1.48x 1.33x 0.97x 0.92x
4-char UTF-8 1.05x 1.19x 1.20x 1.21x 0.97x 0.97x
Creator data 3.62x 2.16x 2.60x 1.25x 1.78x 1.23x
As shown by the numbers, the SSE-based code is slightly worse than the
non-SSE code for dense non-ASCII strings. However, as evident in the
Qt Creator data, most strings manipulated by applications are either
pure ASCII or mostly so, so there's a net gain.
Done-with: H. Peter Anvin <hpa@linux.intel.com>
Change-Id: Ia74fbdfdcd7b088f6cba5048c03a153c01f5dbc1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
If the image is already in the right format, converting it to RGBA8888
will be just a refcount increment; but calling bits() will then cause
an unnecessary detach.
Change-Id: I3b06139cd86b74a9082bd0b401a9a14bd4992a10
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
An API oversight caused the image upload methods to take a "void *",
which is not necessary at all. The underlying texture uploading calls
(i.e. the gl(Compressed)Tex(Sub)Image<N>D family) all take a "const void *".
The methods taking a "void *" get deprecated.
Change-Id: Idfda58d4d7d0af1f335e5cbad7d700f4ccad652c
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Initialize wizStyle and other variables, silencing a purify warning
about uninitialized memory read; use std::fill to initialize the
button array.
Change-Id: I29ad90a29d406be62179fd33688f05bb5f6b7368
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
The screenshots were taken on Windows 7 with the Aero theme.
Change-Id: I2517664e25389f4fb87408daec7b720dfb785bf0
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Make QWindowsDirect2DPaintEngine a subclass of QPaintEngineEx instead of
QPaintEngine like the other paint engines inside Qt. This should both be
faster and better supported, as the code paths handling QPaintEngineEx in
QPainter are tested more.
Additionally the visual output is closer to the raster engine, as all
primitives are drawn using the same mechanism, resulting in fewer
off-by-one-pixel errors.
This change also makes designer work mostly correctly, apart from some
remaining clipping bugs.
Change-Id: I53d36c08e73883ff35e389d57f9d30b482fc6721
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
The screenshots were taken on Windows 7 with the Aero theme.
Change-Id: Ief04c3a9c0084a778606ba72f1f3199119d5c64e
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Since we will later have frameless NSWindow child QWindows, it makes
sense to be able to keep and reuse the instantiated NSWindows in cases
like QDockWidgets. If we keep these 2 different classes, it becomes
impossible to morph one into the other.
Task-number: QTBUG-33082
Change-Id: I351c628b887101b1cfd67689afbf689f119554de
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Currently setting the WindowStaysOnTopHint makes the window appear over
its children e.g. a QMessageBox.
This patch aims to provide a more sensible level for stay on top widget
[ChangeLog][QtWidget][OS X] Fixes an issue where stay on top widgets
would cover their own children
Task-number: QTBUG-36178
Change-Id: Ie86b0e0244d2fdee3638d4ab576445ef190d4bc6
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Since we dropped all platform-related shapers during the
QPA refactoring, thus making HarfBuzz the only shaper on all
platforms, we can not deal with AAT-capable fonts anymore.
HarBuzz-NG now supports it's own shaper backend infrastructure,
so the decision was to enable HB's CoreText shaper backend on Mac
and simply make HB-NG the default shaper there.
Task-number: QTBUG-36056
Change-Id: If22e24fd5cc00c25952934332a2f4123f38135a4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Prerequisite for making the SDK version (API level) available through
QtAndroidExtras and to other modules.
Change-Id: Iffd7540c1a85f60d6b6a3e658faa69e095d87afa
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
On Embedded Linux with libudev support hotplugging was already working,
except that the mouse cursor was not shown and hidden. This is now
corrected so that the cursor disappears when all mice become disconnected
and reappears if a mouse gets plugged in later on.
[ChangeLog][QtGui] Mouse hotplugging is now fully supported in eglfs
when running on Embedded Linux systems with libudev support enabled.
Task-number: QTBUG-36374
Change-Id: Iec7c1557ba6085e3958dd357460cc032896fb174
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
The geometry is used to set the dirty region of the screen, so it must be
translated in screen coordinates.
Change-Id: Ic559a0a0d0e840cb2aa27ae1b02dcc140b29556f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Remove the native bitmap and paint directly on the surface instead.
Change-Id: Ie7010d97aa934a170c079de549903fc3391df4d9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
ANativeWindow_fromSurface already acquires the surface, no need to
call ANativeWindow_acquire.
Remove unused variables.
Change-Id: I563573072687927256aef76fab20f645f35778a2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>