summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qbezier.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Adjust code format, add space after 'if'Zhang Sheng2020-11-161-1/+1
| | | | | | Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* QBezier: Don't try calculating a unit vector when length is nullRobert Loehning2020-08-071-0/+4
| | | | | | | | | It's undefined and causes a division by zero. Fixes: oss-fuzz-24273 Pick-to: 5.12 5.15 Change-Id: I3d34d5c43cccff9255abaf87af265ddea3fe6d95 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Use QList instead of QVector in gui implementationJarek Kobus2020-07-071-3/+1
| | | | | | | Task-number: QTBUG-84469 Change-Id: I366e845249203d80d640355a7780ac2f91a762f1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Liang Qi2019-09-041-18/+14
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/codecs/qicucodec.cpp src/dbus/qdbusserver.cpp src/gui/painting/qbezier.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp src/plugins/printsupport/cups/qppdprintdevice.cpp Change-Id: I2703128bb64baf5580fbc2c2061b55b0f0611d2a
| * Simplify QBezier::addPolygon() implementationEirik Aavitsland2019-08-191-18/+14
| | | | | | | | | | | | | | | | | | | | | | 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>
* | QBezier: replace out parameters by return-by-value in split()Marc Mutz2019-08-221-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At least QBezier itself is calling the old function with *this aliased to one of the arguments. Consequently, the implementation looks rather ... shuffled, to avoid writing into members that it will read once more later. Fix by returning a std::pair<QBezier, QBezier> instead. This simplifies the code that doesn't actually pass existing objects in, and avoids aliasing problems cropping up under seemingly innocuous reorderings of statements in the implementation going forward. While I'm usually vehemently against use std::pair or std::tuple in APIs, preferring simple structs with aptly-named members instead, this is one case where the .first and .second actually fit, and pair allows us to use std::tie, which was handy in qbezier.cpp. This patch preserves the body of the function as much as possible. A follow-up patch will clean it up. Change-Id: I017dfee4a0e69a2e171ce21b89ba04654772c33d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | QBezier: inline fromPoints()Marc Mutz2019-08-171-18/+0
|/ | | | | | | | | | | There's really no reason for it to be out-of-line, and we're going to use it in QBezier::split(), which is inline, and we want the optimizer to have a field day with the source, without a compiler firewall in the way. Change-Id: I49ae3a87fcce1e2dc87a9081f567503e5a98ef6b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix possible endless loop when stroking curvesEirik Aavitsland2019-05-081-3/+3
| | | | | | | | | | | The bezier shifting algorithm compared coordinates exactly, and so could end up in an endless loop when values were at the edge of the number resolution. Fix by using fuzzy comparison instead. Fixes: QTBUG-75522 Change-Id: I61346edbd87389f66965a906ac337fc1f5300e5c Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Don't split bezier curves that are already just a lineAllan Sandfeld Jensen2019-03-051-2/+3
| | | | | | | | | Otherwise we can end up in an infinite loop of splitting the curve and then discarding the half of the new curve, etc. Fixes: QTBUG-74172 Change-Id: I1984b7fd33cd98f65866f1c57c6ab20114615803 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into 5.5Oswald Buddenhagen2015-03-041-2/+2
|\ | | | | | | Change-Id: I556be99cc7ad3fc6f7177542b7444269616a7478
| * Painting: Avoid endless loop for certain bezier curvesEirik Aavitsland2015-03-041-2/+2
| | | | | | | | | | | | | | | | | | | | If the coordinates were too close (at the limit of the number accuracy), the splitting algorithm in QBezier::shifted() would never finish. Ref. testcase in bugreport. Task-number: QTBUG-44674 Change-Id: I2a575cdc6284504ef5e3eb2b749857576fe433c3 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | Remove some uses of the private Q_PI constantAllan Sandfeld Jensen2015-02-261-2/+1
| | | | | | | | | | | | | | | | | | The patch removes several uses of the private Q_PI constant and removes the qmath_p.h from the includes. A few places are optimized to multiply with reciprocals instead of dividing by Q_PI. Change-Id: I097af6a929e0609d6935563064e81c856005f4bc Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Update copyright headersJani Heikkinen2015-02-111-7/+7
|/ | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Remove unused function "quadraticRoots"Thiago Macieira2013-12-091-31/+0
| | | | | | | | | qbezier.cpp(122): warning #177: function "quadraticRoots" was declared but never referenced Change-Id: I590f59ed6e41462d0a14a9239adb8bd0acbeeae4 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Deal with unused functions, as found by the Intel compilerThiago Macieira2013-07-011-55/+0
| | | | | | | | | | | | | | | | | | | | Use Q_DECL_UNUSED for the one that is possibly unused (we have two overloads so that one gets selected): qglobal.cpp(2069): warning #177: function "<unnamed>::fromstrerror_helper(int, const QByteArray &)" was declared but never referenced Remove functions really not used: qbezier.cpp(153): warning #177: function "findInflections" was declared but never referenced qbezier.cpp(534): warning #177: function "splitBezierAt" was declared but never referenced qpathclipper.cpp(1039): warning #177: function "midPoint" was declared but never referenced qpainter.cpp(119): warning #177: function "check_gradient" was declared but never referenced qdockarealayout.cpp(2580): warning #177: function "qMin(int, int, int)" was declared but never referenced qmainwindowlayout.cpp(1019): warning #177: function "validateDockWidgetArea" was declared but never referenced qgraphicsanchorlayout_p.cpp(670): warning #177: function "checkAdd" was declared but never referenced qcups.cpp(481): warning #177: function "paperSize2String" was declared but never referenced complexwidgets.cpp(373): warning #177: function "removeInvisibleWidgetsFromList" was declared but never referenced Change-Id: I1e5558e206b04edea381442030dc69536198d966 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Remove definitions of INV_EPS and M_SQRT2.Robin Burchell2012-05-071-11/+0
| | | | | | | | The use of these went away in Qt 4 commit f7d61dab69308f0993c8a5f2232226d1713ac4a7. Change-Id: I0bcd52cf59f653e5b699fa7cfaf4be510bac6b88 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Limit Bezier curve subdivision to maximum 512 line segments.Kim Motoyoshi Kalland2012-01-061-4/+16
| | | | | | | | Avoid running out of time and memory for extreme cases. Task-number: QTBUG-23443 Change-Id: Iac7799097d61295bb7395a2efe48b3e7d9257919 Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Improved path filling performance in the raster paint engine.Kim Motoyoshi Kalland2011-12-161-0/+32
| | | | | | | | Convert bezier curves to polylines before rasterizing with gray raster. Change-Id: I353debd4338f2a3ce2fa1cfa1bff9dd2e36f05ab Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Fix typo in qbezier shift implementationKent Hansen2011-10-061-1/+1
| | | | | | | | | | Multiplying by zero was not the intention. Task-number: QTBUG-20482 Change-Id: I3c4dfd69da4d98ed65f318d1fa0c3cf827017688 Reviewed-on: http://codereview.qt-project.org/6048 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+702
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12