summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Emit ScreenChanged events on X11Allan Sandfeld Jensen2014-02-061-0/+10
| | | | | | | | | | | | | We do not currently emit screenchanged events when a window is moved to another screen on X11. This patch emits the event when a window no longer intersects with its current screen, and switches to the first intersecting screen. Change-Id: Ie40d6eb67b85bd961eeb348bc43e4f308ee22dba Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Uli Schlachter <psychon@znc.in>
* Remove TableFormat as FormatType from QTextFormatLars Knoll2014-02-062-1/+3
| | | | | | | | | | The enum value is unused, a QTextTableFormat is actually documented to have a FormatType of FrameFormat, and isTableFormat() etc. do the right thing. Task-number: QTBUG-35114 Change-Id: I2f3305630b92f117c1f89b85460457265e5af126 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cocoa: Add improved cursor updating code path.Morten Johan Sørvig2014-02-062-6/+22
| | | | | | | | | | | It's possible to use the cursorRect API in the cases where QCocoaWindow has a NSWindow. This is true for all top-level QCococaWindows today. Task-number: QTBUG-35659 Change-Id: Iefb2c1c022448e19a9c005a808e0c81abe9281ea Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com>
* Remove unused private member (fixes compilation with Clang 3.4)Thiago Macieira2014-02-062-2/+0
| | | | | | | qkmsscreen.h:114:18: error: private field 'm_refreshTime' is not used Change-Id: Id9c802c5c3ae2ffdf61238f083bfe875e7b613a8 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* QOpenGLTextureHelper: de-inline the DSA / DSA emulator wrappersGiuseppe D'Angelo2014-02-062-383/+482
| | | | | | | | | | | | There's no advantage at keeping them inline because we never call them directly: we take pointers to them. This can actually cause multiple copies of the function to be emitted, then the linker may or may not decide to discard N-1 copies. Just avoid this route and deinline them. Change-Id: I5adc704b50ec7f26498846fcbb86cb5b5d016b4b Reviewed-by: James Turner <james.turner@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Cocoa: Allow frameless NSWindow child QWindowsGabriel de Dietrich2014-02-053-48/+331
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Showing, moving and resizing Contrarily to what an NSWindow does to its NSViews, child NSWindows need to be explicitly shown and hidden, and clipped if the parent NSWindow changes geometry. Also, hiding an NSWindow will not hide its child windows. This needed to be managed manually, adding 2 additional states to QCocoaWindow to reflect whether a child window has been clipped out by any ancestor geometry change, or hidden by any ancestor being hid. Also, ordering out an NSWindow will remove it fromm its parent's child windows array, making necessary to maintain a parallel list of child windows in QCocoaWindow. Stack order Although child NSWindows can be ordered relatively to each other, they need to be added again to be moved lower in the window stack. This also means the windows above it need to be added on top. Key (focus) status One of the remaining issues, is to make sure the top level window keeps the "key status" while still forwarding key events to the child window. Keeping same event propagation This use case is best illustrated with undocking QDockWidgets (if these are child NSWindows). The main issue is to make sure the QDockArea will get the mouse events right after undocking a dock widget. We used a similar workaround as the "key status" problem, and manually forward the mouse events to the dock area's QWindow. Manual test, by Morten Johan Sørvig, included. Task-number: QTBUG-33082 Task-number: QTBUG-22815 Change-Id: I50e34936fb82bff013e99f4bcb3bd0db0704c6ae Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* QPrinter - Enable changing of Orientation on MacJohn Layt2014-02-052-15/+10
| | | | | | | | | | Since OSX 10.4 it has been possible to change the page orientation during a print job. Task-number: QTBUG-27630 Change-Id: Ic3c69e83afebbb9267ef6f435f968aeef2b72963 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrinter - Fix PaperSourcesJohn Layt2014-02-053-10/+4
| | | | | | | | | | | An earlier commit add new PaperSources for First and Last, but after looking at wingdi.h it turns out these are just the first and last DMBIN values, and Upper is equal to OnlyOne. Remove First and Last, but keep the Upper and CustomSource for use later by PPD based printer systems. Change-Id: I298472a1f54efcc584e73dec944b96fc91426c1b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrinter - Fix Printer Selection option on WindowsJohn Layt2014-02-052-14/+10
| | | | | | | | | Make the printer selection option api public on Windows to be consistent with Mac, and with the print program api which is already public. Change-Id: I3da9684288348eaa43276ca8534a1d5809f7027b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrintEngne - Fix PPK_CreatorJohn Layt2014-02-054-12/+16
| | | | | | | | Add support to the Mac and Windows print engines to preserve the creator name when switching between native and pdf format. Change-Id: Ie036af3140f24d8e34aa886f091384f93aa0157b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrintEngine - Fix PPK_CollateCopiesJohn Layt2014-02-054-13/+16
| | | | | | | | | | | | | | | | | Mac supports Collate Copies using native api, so add support. Note this is mostly only useful for setting the print dialog default, as Mac supports server-side multiple copies so the app will never need to collate the copies itself. Change PDF and Windows to default to collate true to match Mac as this is the behavior users expect. Task-number: QTBUG-27724 Task-number: QTBUG-35251 Task-number: QTBUG-22144 Change-Id: Ia43dbc260b3a71aa5b267cca54c168ffbea794fc Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrintEngine - Fix PPK_DocumentNameJohn Layt2014-02-052-10/+13
| | | | | | | | | | | | | | | | Add support to the Mac print engine for set/get the Document Name using the Job Name setting. Our documentation states this is one use that the document name will be put to so is appropriate to be used. Change the Windows print engine to default to a blank Docuemnt Name consistent with the other print engines. If still blank when printing then use a default value. Task-number: QTBUG-27724 Task-number: QTBUG-22144 Change-Id: If590811b5720e6f759eabc290b578b94e221f9f4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrinter - Clean up Print Engine Key defaults and testsJohn Layt2014-02-054-34/+180
| | | | | | | | | | | | | | | | | | | | The PrintEngine keys are not consistently treated across the platforms and are not properly tested. Start the process of making the print engines behave consistently by documenting and testing the current behavior. Ensure all unsupported features return a consistent default value. The auto test for valuePreservation() has been flaky depending on the platform and installed printers so remove it and replace it with more complete testing. If no native printers available then don't test the native engines. Fixes for the individual inconsistent keys will follow. Task-number: QTBUG-26430 Change-Id: Iab914d7e0a5ae4a2cdc24c8645751f0910cf440c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move documentation of AA_MSWindowsUseDirect3DByDefault into obsolete section.Friedemann Kleint2014-02-051-2/+3
| | | | | Change-Id: Id45ddb760d1ec56741314f1125ad03d172c8e1a9 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Adds the ability to not have an activity on AndroidThierry Bastian2014-02-051-31/+43
| | | | | | | | | That code allows for not having an activity on Android. In my case I've made some java code to handle an Android service. The code is mainly about not dereferencing null pointers. Change-Id: Ia7fda03cbbc55e6afeacd928445a4b72b51c679e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Support empty inline elements in block tags in QTextDocumentEskil Abrahamsen Blomfeldt2014-02-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following case: <blockquote> <span />Foobar </blockquote> Qt would see the end of <span>, and consider the current block tag as closed, thus resetting the block format, thus losing the margin set for the current block (due to blockquote). If you do <blockquote> <span>Foo</span>Foobar </blockquote> instead, then the same would not happen, since hasBlock is set to false when we append text to the current inline node. [ChangeLog][QTextDocument] Add support for empty inline elements in block tags. Task-number: QTBUG-33336 Change-Id: Ic566edfec96cb8d44d1c02932bb195bc921d1580 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove some left-over +1 in font height calculationEskil Abrahamsen Blomfeldt2014-02-052-2/+2
| | | | | | | | | | | | | | In change cb8445f0323b0eefbb04f1d8adad81a00b53abd8, I tried to remove all the historical +1s when calculating the font height from the ascent and descent, but I missed a couple. These are used when drawing the background for the text, the height of which would no longer match the height returned from QFontMetrics. [ChangeLog][Text] Fixed off-by-one in the height of text background. Task-number: QTBUG-36444 Change-Id: If6d87f903e246f9faed2298bb1693b2556906eed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Obsolete AA_ImmediateWidgetCreation.Friedemann Kleint2014-02-053-17/+14
| | | | | | | | | This attribute is not guaranteed to fully work with QPA. Task-number: QTBUG-36489 Change-Id: I638a8e00851288012be553b5316aa6088dd67cff Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Cocoa: Establish pattern for accessing globalsMorten Johan Sørvig2014-02-046-30/+50
| | | | | | | | | | Use a static QCocoaIntegration pointer instead of QGuiApplication. This removes the need to call out of the platform plugin as well as the casting from "platform" to "cocoa" types. Change-Id: If432b3567811223b73a67548e475e07d63635b73 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Add suspend and resume event handling for WinRTMaurice Kalinowski2014-02-042-0/+39
| | | | | | | Task-number: QTBUG-35952 Change-Id: Icb4edb0f55c1d02dfbb5501df311b0fff87d2dc1 Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* Fix character mirroring issue with HarfBuzz-NGKonstantin Ritt2014-02-048-63/+44
| | | | | | | | | | HarfBuzz-NG does character mirroring where appropriate. A simple solution is to unset RightToLeft shaper flag when text gets shaped with HB-NG. Instead, move the mirroring code right to HB-old proxy function and decrease code duplication. Change-Id: Icdcd50b73b3e6a43da4b85addc7d8f51edf86512 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Logging: Don't use for loop in qCDebug macrosKai Koehne2014-02-041-3/+3
| | | | | | | | | | | | The local 'enabled' variable might cause dubious MSVC warnings if a local variable name 'enabled' exists. Just replace the whole loop with the if (...); else idiom, as Thiago once suggested on the mailing list. Task-number: QTBUG-36605 Change-Id: I0b8959a29d4432296961493fe2b7827c5b860d00 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Clean up QXCBSessionManagerSamuel Gaist2014-02-032-25/+2
| | | | | | | | | Removed useless overrides and inline simple functions. Change-Id: I69df0ec8446fe2c8bb904c7d4d9cc2e1d269533b Reviewed-by: Teo Mrnjavac <teo@kde.org> Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Clean up QPlatformSessionManagerSamuel Gaist2014-02-031-3/+3
| | | | | | | Remove virtual from appCommitData and appSaveData and make them public Change-Id: Ifd605742c6552b7a407de9bf482f8f0f0aa125ca Reviewed-by: David Faure <david.faure@kdab.com>
* Windows: Silence QWindowsOleDataObject::GetData().Friedemann Kleint2014-02-031-1/+1
| | | | | Change-Id: Iad97a35af334f951f56a7bf02ec1bf2873901aa1 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* QOpenGLTexture: remove typos in the docsGiuseppe D'Angelo2014-02-031-2/+2
| | | | | Change-Id: Ia842c7f91eadefc6b5328d7d951c4e265c2c7432 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QOpenGLTextureHelper: fix the DSA emulationGiuseppe D'Angelo2014-02-032-217/+241
| | | | | | | | | | | | | | | | | | | | | | 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>
* QGuiApplication: Check if window exists before sending double click event.Friedemann Kleint2014-02-031-6/+8
| | | | | | | | Task-number: QTBUG-36364 Change-Id: I0be40e8f920f0210ba4e99e83d138f82ce3a69f2 Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* [QNX] Handle the case when an egl surface can not be createdFabian Bumberger2014-02-022-3/+5
| | | | | | | | | | 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>
* [QNX} Remove adjustBufferSize from the egl windowFabian Bumberger2014-02-026-12/+8
| | | | | | | | | | 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>
* [QNX] Fix crash when creating eglSurfaceFabian Bumberger2014-02-021-2/+2
| | | | | Change-Id: I9cf9d56003a5f237dcf00b621fddf74e8d0ca190 Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* Fix the QSslSocket::setCiphers(const QString &) overload.Richard J. Moore2014-02-023-6/+24
| | | | | | | | | | | 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>
* QGraphicsSceneIndex: replace polymorphism with a function pointerMarc Mutz2014-02-012-67/+36
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix setWindowFlags() for QMdiSubWindow.Bastiaan Veelo2014-02-013-15/+25
| | | | | | | | | | | | | | 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>
* Add other integer overloads to QFlag's constructorThiago Macieira2014-02-012-3/+37
| | | | | | | | | | | | 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>
* Fix configure & qmake compilation with a future MSVC versionThiago Macieira2014-02-011-2/+1
| | | | | | | | | | | | 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>
* Update the macro that MSVC 2013 defines for AVX code generationThiago Macieira2014-02-011-11/+7
| | | | | | | | | | | | | | | | | | 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>
* Use qregister(u)int in qsimd.cpp x86 codeThiago Macieira2014-02-011-3/+3
| | | | | | | | | | 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>
* Q(Plain)TextEdit: Add find() overload with QRegExpChristian Loose2014-01-316-0/+64
| | | | | | | | | | | | | | | 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>
* Move the code that converts from UTF-16 to Latin1 to the topThiago Macieira2014-01-311-122/+118
| | | | | | | | 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>
* Merge all conversions from Latin-1 in qstring.cpp into a single functionThiago Macieira2014-01-311-62/+60
| | | | | | | | | | | | | | | 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>
* Unroll the tail loops of the SSE2-improved codeThiago Macieira2014-01-311-0/+53
| | | | | Change-Id: I1a51ceab3bdabd39bdb9dc2714debb3ad2c2380c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Improve the QString/QLatin1String ucstrncmp with SSE2Thiago Macieira2014-01-311-0/+51
| | | | | Change-Id: I6a7ce281096bb99352132f775ae32fcaf55bd32c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Centralize the UTF16-Latin1 comparisons in one placeThiago Macieira2014-01-311-63/+29
| | | | | | | | | | 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>
* Improve qstring.cpp:findChar with SSE2Thiago Macieira2014-01-311-1/+19
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge qMemEquals and ucstrncmpThiago Macieira2014-01-311-84/+38
| | | | | | | | | | 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>
* Improve ucstrncmp with SSE2Thiago Macieira2014-01-312-0/+65
| | | | | | | | | | 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>
* Add support for UTF-8 encoding/decoding with SIMDThiago Macieira2014-01-312-20/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* QOpenGLTexture: avoid a QImage detach when uploading texture data from itGiuseppe D'Angelo2014-01-311-1/+1
| | | | | | | | | 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>
* QOpenGLTexture: Introduce const void * image upload methodsGiuseppe D'Angelo2014-01-313-12/+155
| | | | | | | | | | 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>