summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* SVG Image reading: Reject oversize svgs as corruptEirik Aavitsland2021-11-081-0/+2
| | | | | | | | | | | Add an upper limit for height and width at 0xffff, same as jpeg. Fixes: QTBUG-95891 Change-Id: I0dbc80dab3aab9b4743548772fb63fa69ea21f8a Reviewed-by: Robert Löhning <robert.loehning@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit e544d8e457d52b543cae5c988f81237c7d6608da) Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Do stricter error checking when parsing path nodesEirik Aavitsland2021-10-271-34/+25
| | | | | | | | | | | | | | The SVG spec mandates that path parsing should terminate on the first error encountered, and an error be reported. To improve the handling of corrupt files, implement such error handling, and also limit the number of QPainterPath elements to a reasonable range. Fixes: QTBUG-96044 Change-Id: Ic5e65d6b658516d6f1317c72de365c8c7ad81891 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Robert Löhning <robert.loehning@qt.io> (cherry picked from commit 36cfd9efb9b22b891adee9c48d30202289cfa620) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Limit font size to avoid numerous overflowsRobert Löhning2021-07-271-1/+2
| | | | | | | | | | | | | The font size will be passed through a QFixed in QFontEngineBox::ascent() and overflow there as well as in further places. [ChangeLog] Avoid numerous overflows by limiting font size to 0xffff. This fixes oss-fuzz issue 31701. Change-Id: I2d00c5639804af9b056f0efc979e9899c5358cf7 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 76eeb072cdffc1a8c776ed01864e6751ccbfba85) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix parsing of arc elements in pathsEirik Aavitsland2021-07-161-3/+16
| | | | | | | | | | | The arc element takes some flag parameters, which could be mixed up with the float parameters since svg does not require delimiting characters here. Hence legal svg would be misread.. Fixes: QTBUG-92184 Change-Id: I5885c50d47e2e06ab0f02afefb7a5585c5c713ff Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit b313862fa04d9a5403c16670a0d911eb3c633ee5)
* Fix parsing of animation clock valuesEirik Aavitsland2021-07-131-35/+36
| | | | | | | | | | | | Color animation duration parsing mixed seconds and milliseconds. Factor out a common function for all clock value parsing, and add checking for overflow and illegal values as a driveby.. Fixes: QTBUG-94878 Change-Id: Ie1d974cd2db55a3d65d7ce02c373021021070489 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit 1da0a668e52994832d8a048772bed65b61cb0e9b)
* Make image handler accept UTF-16/UTF-32 encoded SVGsEirik Aavitsland2021-04-081-15/+22
| | | | | | | | | | The canRead() header checks assumed 8 bit encoding. Fixes: QTBUG-90744 Change-Id: Ibe934fe9ed31b89ee0fbfc4562aa66ab1b359225 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 45fb1f07eaa984af40fca9f12b8f3d27f7b0e9ac) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Clamp parsed doubles to float representable valuesAllan Sandfeld Jensen2021-03-041-1/+4
| | | | | | | | | | | | | Parts of our rendering assumes incoming doubles can still be sane floats. Fixes: QTBUG-91507 Change-Id: I7086a121e1b5ed47695a1251ea90e774dd8f148d Reviewed-by: Robert Löhning <robert.loehning@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit bfd6ee0d8cf34b63d32adf10ed93daa0086b359f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update commercial license headersTarja Sundqvist2021-01-2730-616/+616
| | | | | | | | | | | | | | | | Updated header.COMM to the files in tqtc-qtsvg. Examples, tests or documentation files are not updated. The commercial license header may contain some additional lines so that its line count equals with the earlier license header. Reason for this is that some autotests use hard coded line numbers and a change in the line count causes failures in tests. Task-number: QTQAINFRA-4162 Change-Id: Iedfe87d55dc1967f8340101279c647f1cf3534ca Reviewed-by: Antti Kokko <antti.kokko@qt.io>
* Improve handling of malformed numeric values in svg filesEirik Aavitsland2020-12-031-0/+3
| | | | | | | | | | | Catch cases where the input is not containable in a qreal, and avoid passing on inf values. Change-Id: I1ab8932d94473916815385240c29e03afb0e0c9e Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 428d56da9d5ed9bda51f7cc3c144996fb3a6a285) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Allow loading SVG files with a doctype declarationNicolas Fella2020-10-212-6/+6
| | | | | | | | | | | | | | | | SVGs may have a DOCTYPE declaration (https://www.w3.org/TR/2003/REC-SVGMobile-20030114/) in their first line. This patch makes sure those SVGs are loaded properly Fixes: QTBUG-87583 Change-Id: Ia3dcb519b6ee2b498dc81ef496764d99ea6c4a9a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 2f63ddc6afeb3d2c3c7a42add0129547acd61ede) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Reject corrupt svgs with invalid sizeEirik Aavitsland2020-10-161-0/+4
| | | | | | | | | | Fixes oss-fuzz-24735. Change-Id: I626905562d37b1e53bd346b13bd88894401818ca Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit fcbbc73a97fefacace630e83a5c6ee48fa8eec43) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Change classification of XSVG LicenseKai Koehne2020-09-071-2/+3
| | | | | | | | | | | | [ChangeLog][Third-Party Code] XSVG license was re-classified to HPND-sell-variant, "Historical Permission Notice and Disclaimer - sell variant" https://spdx.org/licenses/HPND-sell-variant.html Change-Id: Icff6d7f072f0d4b64bd1c5ce703c8c007184ad8a Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 8b7f3b4b6e6e2f1b6721af7ca6edeb83b3b3adf8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Avoid recursion when inflating compressed svgsEirik Aavitsland2020-08-281-10/+14
| | | | | | | | | | | | Avoid the possibility of recursion loop for corrupt compressed files, and generally simplify the code, particularly the handling of the QT_NO_COMPRESS flag. Change-Id: Ic21a4814a45c4303cc366152be65ae54fa973461 Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 3d67824828cf37a2357153e1c832b4cb06d3b485) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Implement basic format check also for compressed svgsEirik Aavitsland2020-08-271-6/+19
| | | | | | | | | | | | | | | | | For uncompressed files, QSvgIOhandler::canRead() will reject any file that does not start out with a svg or xml tag. That rudimentary check was never done for compressed files (svgz). Implement the check during the decompressing itself, so that we can fail early and not waste time and memory decompressing potentially huge files that are anyway not valid svgs. Fixes: oss-fuzz-24611 Change-Id: I154efd8adafe7f09307e8b28a66b536539b1e4bd Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 93466dad6613085a5044a862a3a84a4eba6fcef9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Don't return partially inflated QByteArrayRobert Loehning2020-08-261-1/+1
| | | | | | | | | | | We're already stopping the extraction because we're running out of memory. It's no use to return this provisional result. Task-number: oss-fuzz-24611 Change-Id: Iea5a65a0f30b7a03c5405017c21cd9495a7c2971 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 103aace3b30ede9e5f5621e14542f5369eac749d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Initialize QSvgHandler with QBuffer instead of QByteArrayRobert Loehning2020-08-241-1/+4
| | | | | | | | | | Reduces memory consumption significantly for huge files. Fixes: oss-fuzz-24347 Change-Id: Iebf58d5f73030336d219ad770e1d1d2798c10067 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit d71817248621651dc44d0ba67a74cd05d5f9619c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix check against division by zeroRobert Loehning2020-08-181-4/+5
| | | | | | | | | | | The squared values must not be zero. Since both are qreal, this can happen even when neither of them is zero itself. Fixes: oss-fuzz-24738 Change-Id: I61b2bc891e7e3831d4b6ee68b467db28c4f877d4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 7f1945c5fb492505db9a43853987eaf805291919) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Don't divide by zeroRobert Loehning2020-08-041-0/+2
| | | | | | | | Fixes: oss-fuzz-24308 Change-Id: I628f073cc2ec99b18333d2831c53cd888ebc5780 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 3206ab23a01ff19850ebdce6ac0338ddb29b5b95) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Avoid endless recursion in SvgStructureNode::boundsRobert Loehning2020-07-302-2/+8
| | | | | | | | Fixes: oss-fuzz-24028 Change-Id: I2ddfcd494747f2857d56ce54bc9c4ee3f986ac3e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 3f11586d79566c9ceb311c6c4a1ea12078deed5d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use qFuzzyIsNull instead of isEmpty() on QRectFRobert Loehning2020-07-301-1/+1
| | | | | | | | | | | Avoids an integer overflow in QOutlineMapper Fixes: oss-fuzz-24131 Change-Id: I77a280640df4971e440d3f8888d2e7036a1f2e6a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 21ae1e161c933ffae38d42fe8191975d5ad8ee6e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Avoid endless recursion when inflating gzipRobert Loehning2020-07-291-3/+5
| | | | | | | | Fixes: oss-fuzz-24146 Change-Id: I52a974e6a0694fb4afb50d932b2e99917c3034b2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 8368111c76471a7415c29ba293848003fca2a4af) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Return nullptr instead of 0Robert Loehning2020-07-241-1/+1
| | | | | | | Change-Id: I200214f90ce399034dabc61b00d20f7def8d923d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 0e1ea7b93388eca35814d3527584461074350f0f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix support for pattern brushes in svg generatorEirik Aavitsland2020-07-211-1/+1
| | | | | | | | | | A typo had left a stray semicolon in the id string. Fixes: QTBUG-84607 Change-Id: I8bd3e68ec2184a238ea949d555f88abb14cff2dc Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 625ca761c7c88f80ee8217c820f1e1f60ca7ef4f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Don't divide by zeroVolker Hilsheimer2020-07-171-0/+3
| | | | | | | | | Fixes: oss-fuzz-23731 Change-Id: Ib21a32a30f7a204d263e6710f17567d91c6aae79 Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit a7941a5b82e1b8397e9d5f20e5a68c8aac37fb51) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix stack overflow in dtor of QSvgTinyDocumentRobert Loehning2020-07-151-1/+10
| | | | | | | | | | | Add a maximum to how many unfinished elements will be parsed by QSvgHandler. Fixes: oss-fuzz-24000 Change-Id: I4cea0500d2bc503d2c509d091300dd1117170299 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 2fc2cb44b275c7c18c2db262eec443eb198b9cc6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add error handling to color parsingAllan Sandfeld Jensen2020-06-241-19/+22
| | | | | | | | | | | Also fixes undefined shift of negative values. Fixes oss-fuzz 23644 Change-Id: I08c998ebf2217cb8dc50fcb805603e01e67ad64b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 9a0d4ff631003a84205c61bd7a6ef843207f1675) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix stack overflow in QSvgHandler::resolveGradientsAllan Sandfeld Jensen2020-06-242-5/+7
| | | | | | | | | | | Add a maximum to how deep it will nest. Fixes oss-fuzz 23643 Change-Id: I6183c04f65a539a6c7df42bc7346a86ee58aca6c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 6b86b5de893e9885f8288af5a096444b30fa2628) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix oom in QSvgTinyDocument::loadAllan Sandfeld Jensen2020-06-231-0/+6
| | | | | | | | | | | | Avoid overflowing the size integer. Fixes ozz-fuzz 23606 Change-Id: Iaae2c1e78e59737bba0e34791de4a3a92677f319 Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 99a86c1bc347092d76f1288d901b30643b8eea6c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use QRect::isEmpty instead of QRect::isNullAllan Sandfeld Jensen2020-06-221-5/+5
| | | | | | | | | | | | Otherwise we can end up processing empty rects, and get divisions by zero. Fixes oss-fuzz issue 23633. Change-Id: I0415462712792cb6a00eadd510b1688e859c419c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit b5865df798323a63d8a89b8b50116888b930f3f0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Handle empty rectsAllan Sandfeld Jensen2020-06-221-10/+15
| | | | | | | | | | | | | Avoids a division by zero, also we don't appear to support auto sizes, so width and height are required attributes. Fixes oss-fuzz issue 23588. Change-Id: Ib3474c2ed4409977f6ffcf73088956c6c59ce4ad Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Robert Loehning <robert.loehning@qt.io> (cherry picked from commit 78cbbc1aa3a4802b2eeec8b5abfe196e05df1b16) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Merge remote-tracking branch 'origin/5.14' into 5.15v5.15.0-beta4v5.15.0-beta3Qt Forward Merge Bot2020-03-183-5/+8
|\ | | | | | | Change-Id: Ic4b8abc44f58b3d5d34cddf2743d0d172df4a374
| * Strip the quotes around the font familyAndy Shaw2020-03-103-5/+8
| | | | | | | | | | | | | | | | | | | | | | Due to changes in how QFont handles a family it should be given the whole string without quotes so it can find the family name correctly. Additionally, this changes it to use setFamilies instead of setFamily to make this more future-proof. Fixes: QTBUG-81926 Change-Id: I659950cf244c1f7a1a5dae6e7b0e136cfe274d47 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Remove overridden QSvgIOHandler::name()Shawn Rutledge2020-03-032-10/+0
| | | | | | | | | | | | | | | | We will remove the virtual base class function in Qt 6. For now, name() returns format(). Change-Id: Iee5bd4194d23178b3d8b602950cc5c01d097d44b Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Use Qt::SplitBehavior in preference to QString::SplitBehaviorEdward Welbourne2020-03-021-2/+2
| | | | | | | | | | | | | | | | The Qt version was added in 5.14 "for use as eventual replacement for QString::SplitBehavior." Move another step closer to that goal. Change-Id: Ieabf1eeb03b682f06344d0373de036f8f4534042 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-292-1/+18
|\ \ | |/ | | | | Change-Id: Ib7854f4ed3622f8545af5fa323350787229de921
| * Restrict nested use nodes processedAllan Sandfeld Jensen2020-02-262-1/+18
| | | | | | | | | | | | | | | | | | | | To avoid exponential blow up, limit the number of use nodes processed under a certain depth. This should still allow the common use of many shallow uses, but limit anything dangerous. Change-Id: I3af6dacb61c68350876fb03f056f02a287ea4e33 Fixes: QTBUG-82153 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add API to enable opt-in aspect ratio feature in QSvgRendererEirik Aavitsland2020-01-284-1/+47
| | | | | | | | | | | | | | | | | | [ChangeLog][QSvgRenderer] Introduced aspect ratio mode property, so that rendering may be set to preserve the view box aspect ratio. Task-number: QTBUG-81259 Change-Id: I9802788cdaf2c30974c1ffc34ad5b67cdc74ed57 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-01-281-7/+8
|\ \ | |/ | | | | Change-Id: I987599c388f414928aabf6a193a8250c27f4f60d
| * Revert the keep-aspectratio feature for 5.14.1v5.14.15.14.1Eirik Aavitsland2020-01-161-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was introduced as non-optional behavior for 5.14.0, but caused many regressions. This patch reverts that, and instead prepares for introducing it as an opt-in feature in Qt 5.15. [ChangeLog][QSVGRenderer] In Qt 5.14.0, rendering would keep aspect ratio implied by the viewbox, independently of the specified target area. This caused many regressions with existing code, so is reverted now in 5.14.1. The feature will instead be available as an opt-in in Qt 5.15. Task-number: QTBUG-81259 Change-Id: I3efa2db864eb80ee00e8a067e56d9912bab36442 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Don't use deprecated QMatrix class anymoreJarek Kobus2020-01-178-30/+67
| | | | | | | | | | | | Task-number: QTBUG-46653 Change-Id: I9944b62141d7054e3935000a819bebc5fd54df6c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-01-072-10/+10
|\ \ | |/ | | | | Change-Id: If6bf34ca3216ab9e0866d8c4eea7c4e92a7f3f4d
| * Fix yet another viewbox scaling issue, for render to boundsEirik Aavitsland2020-01-032-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The recent introduction of keepAspectRation scaling led to wrong output (outside bounds) in the case of an explicitly specified target bounds rect, i.e. QSVGRenderer::render(QPainter *p, QRectF bounds). Fix by reverting to old code path in this case, i.e. allow the user to override the keepAspectRatio behavior by explicitly specifying target bounds. As a driveby, also fix the keepAspectRatio code path in case of a target rect having non-zero x/y coordinates. Now the fix above means that this will never happen in the code as it stands, but it may come in handy later. [ChangeLog][QSVGRenderer] From Qt 5.14.0, normal rendering will keep aspect ratio implied by the viewbox. The render() methods taking an explicit target bounds QRectF parameter can now be used to override that behavior. They will scale the output to the bounds while ignoring aspect ratio, as was the default rendering prior to 5.14.0. Fixes: QTBUG-80888 Change-Id: I399b05ca50d290b8e4b01bdc47b5b6f74c890c9a Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* | Fix endl usage to contain prefixes and bump version to 6.0.0Alexandru Croitor2019-12-061-26/+26
| | | | | | | | | | | | Change-Id: Ia10879666a87dc4db596b75cfbf654379e75041b (cherry picked from commit 5c298ef5bea0930b68263ba84194250dbb9d26a9) Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Avoid initializing QFlags with 0 or nullptrFriedemann Kleint2019-11-252-5/+4
|/ | | | | | | It is being deprecated. Change-Id: Ia8306d3874dc21d431fcb621e1f487f55b2bed8d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Re-fix scaling when rendering a specific element by idAlessandro Portale2019-11-141-1/+3
| | | | | | | | | | | | | | | | | | | | | This is a modification of 14fa4591eb34a35cf3d485fd901e3f1e2caa7770 That patch corrected the handling of the view box when rendering an entire SVG document. However, contrary to intention stated in the comment of that patch, it turns out that the new viewbox handling code path can be taken also for the case of rendering only a single element by id. Instead, we want to keep the original behavior where the element's origin bounds are transformed to fit into the user requested target bounds, allowing non-proportional scaling. Since the render-single-element case is easily and uniqely identifiable by the sourceRect parameter being non-null, just add an explicit check for that to the code path branching. Done-with: Eirik Aavitsland <eirik.aavitsland@qt.io> Fixes: QTBUG-79933 Change-Id: I64a35bbb193db22c33670b48ea165a91df8e719e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QSvgRenderer: Allow to remove a viewBoxAlessandro Portale2019-11-131-1/+1
| | | | | | | | | | m_implicitViewBox needs to be true if the explicit viewBox is null. That relationship between m_viewBox and m_implicitViewBox can be see in QSvgTinyDocument::viewBox(). Task-number: QTBUG-79933 Change-Id: I6ea5a849479b10117128bcaf1799e3770b145e77 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix rendering of SVG with translating viewBoxEirik Aavitsland2019-11-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | This is a modification of14fa4591eb34a35cf3d485fd901e3f1e2caa7770. That change correctly implemented support for scaling and centering viewBox. However, the viewBox scaling and x-min/y-min translation was applied in the wrong order, so SVGs with a non-zero x-min/y-min viewBox would be rendered with an offset. The autotest reflected this error, and is also fixed here. (In user space, the black rectangle's upper left corner (0,0) is in the center of the viewBox and so should end up in the center of the produced image, independently of the scaling. All other tested SVG renderers place it there.) This change fixes all the reported regression cases from the above commit, while not re-breaking the original cases fixed by that commit. Fixes: QTBUG-79333 Fixes: QTBUG-78200 Task-number: QTBUG-70256 Change-Id: I0d3394e3caf6ec7edf16a10992c2fbfdac7398e5 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Small performance improvements suggested by clang-tidyv5.14.0-beta2Albert Astals Cid2019-10-074-4/+4
| | | | | | | | | | * Add const & to function parameters * std::move an brush * Add const & to variables assigned from functions returning const & Change-Id: If412b78cc0198e24ce1c611fcd2026d0d723be80 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-163-2/+5
|\ | | | | | | Change-Id: I2c1925759a489dc23edba9d082025efc33418d18
| * Doc: Replace example file lists with links to code.qt.ioTopi Reinio2019-07-091-0/+1
| | | | | | | | | | | | Task-number: QTBUG-74391 Change-Id: I398a01a5af7ef88c24886d1c5549bd1fdbe7784c Reviewed-by: Paul Wicking <paul.wicking@qt.io>