summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* 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>
| * Fix compilation with disabled deprecated APIsSona Kurazyan2019-07-092-2/+4
| | | | | | | | | | | | | | | | | | | | The QImageIOHandler::name() has been deprecated since 5.13, but its overrides weren't. Enabled compilation of the overrides only when the QImageIOHandler::name() is compiled. Task-number: QTBUG-76491 Change-Id: Ida625f19d61081cfd50ae11ab50cf7829aef80a5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | Convert uses of QTime as a timer to QElapsedTimerEdward Welbourne2019-06-132-12/+11
| | | | | | | | | | | | | | | | | | | | | | | | One was an easy replacement, the other changes its reference time, which isn't supported by QElapsedTimer. However, it was easy enough to reimplement in terms of QDateTime::currentMSecsSinceEpoch(); and, as it was previously using QTime as timer, this is presumably good enough (although a proper monotonic timer would be better). Change-Id: I90f8e08635e7d2bc364755efd93fce008b6a62c0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Fix rendering of SVGs with viewBoxesSimon Hausmann2019-05-242-9/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The presence of the viewBox attribute in the svg tag implies the presence of the preserveAspectRatio attribute as well. It defaults to scaling the view box to the view port while preserving the aspect ratio and the box is also centered. This patch does not implement the full preserveAspectRatio attribute, but it does implement the default of aspect ratio preservation and centering, as that is what caused the rendering error in the linked task. This causes some tests in the SVG Tiny 1.2 test suite to differ. This is visible using the rendertestsuite helper program (see other change). In particular it corrects the rendering of struct-svg-203-t.svg to correctly center the text and avoid scaling it. For animate-elem-38-t.svg the rendering improved by making the entire text visible, as in the reference. The same applies to media-video-216-t.svg. In both rendering the scaling changes slightly. Done-With: Rainer Keller <rainer.keller@qt.io> Fixes: QTBUG-70256 Change-Id: I9142c511890765993ee3e316f0383550919fdcd4 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | QtSvg: remove deprecated functions and enumerationsChristian Ehrlicher2019-05-271-1/+1
|/ | | | | | | | Replace QPainter::HighQualityAntialiasing with Antialiasing and remove defines needed for Qt4. Change-Id: I866decad7d9c10da15e5b0e0bd79033d574f6a08 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-273-16/+22
|\ | | | | | | Change-Id: I4a7a5ad6cd164f0d440217566bd647ecde4fddfb
| * Fix stack overflow on indirect self-referralAllan Sandfeld Jensen2019-04-242-9/+15
| | | | | | | | | | Change-Id: If2b13c3dc4a09ce6d18aff97855179172f92878b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * Fix leak in SVG font nodesAllan Sandfeld Jensen2019-04-241-7/+7
| | | | | | | | | | | | | | | | Their lifetime is controlled by the document, but the logic was confused and lost the node. Change-Id: Ib074dcf209d53ade894ee571a0bc08a1a7acfcab Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-202-2/+10
|\ \ | |/ | | | | Change-Id: Id1bdcd52b3c4553e882de825c769bd7643745dce
| * Merge remote-tracking branch 'origin/5.12.3' into 5.12Qt Forward Merge Bot2019-04-172-2/+10
| |\ | | | | | | | | | Change-Id: I73662000d1b52a4b61a9bd0a58af2fb9a7dc7b22
| | * Fix crash for recursive gradient referencesEirik Aavitsland2019-04-022-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | A reference loop with at least three elements would lead to endless recursion. Fixes: QTBUG-74189 Change-Id: Ie3c1b32da0e98e9218dc387dd3210666018a92e1 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | | Merge remote-tracking branch 'origin/5.12' into 5.13v5.13.0-beta3Qt Forward Merge Bot2019-04-131-0/+7
|\ \ \ | |/ / | | | | | | Change-Id: I6be198d51f5e4c617724bd9c4098bd2bed45b995
| * | Fix assert on misplaced tspan elementAllan Sandfeld Jensen2019-04-121-0/+7
| |/ | | | | | | | | Change-Id: I75b3a88aae3cbd7838474d7a78f29fcd58172fc2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13v5.13.0-beta1Qt Forward Merge Bot2019-03-092-3/+16
|\ \ | |/ | | | | Change-Id: I53ec3fb5c2aa7aa953628d2ef56fead24ce0160f
| * Fix IRI parsing, and use after freeAllan Sandfeld Jensen2019-03-042-3/+16
| | | | | | | | | | | | | | | | | | | | Make the parsing of IRI references tighter, and avoid freeing styles when inserting a duplicate id. Fixes: QTBUG-74104 Change-Id: I3a12fcf09ce1c55c135a4209817413ed8af75dec Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-022-5/+16
|\ \ | |/ | | | | Change-Id: I1c146c122f307cd6e985061b412ef2b50690561e
| * Fix heap overflow in path parsingAllan Sandfeld Jensen2019-03-011-1/+1
| | | | | | | | | | | | Fixes: QTBUG-74129 Change-Id: I871c144f1df288a310e82aef979af7cfd7a54095 Reviewed-by: Robert Loehning <robert.loehning@qt.io>
| * Don't leak nodes on parsing failuresAllan Sandfeld Jensen2019-02-272-4/+15
| | | | | | | | | | | | | | | | | | | | | | The QSvgHandler always expects the caller to handle ownership of the generated document, also when the parsing failed. QSvgHandler also failed to handle misplaced group elements. Fixes: QTBUG-74083 Change-Id: I8907117d4305ecd84e328b201791001cb877fc60 Reviewed-by: Robert Loehning <robert.loehning@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-02-093-11/+11
|\ \ | |/ | | | | Change-Id: Ieb656507bd67b147559c922ec0c7076e4b8b835a
| * Fix QSvgRenderer incorrect render of svg:imageDavid Crémoux2019-02-063-11/+11
| | | | | | | | | | | | | | | | | | | | The bounds of QSvgImage are integer based (QRect) which cause rounding issues when decimals values are used to define image (image shifted and with incorrect size). Changing the bounds to QRectF solves the issue. Fixes: QTBUG-73445 Change-Id: I49828e2c0b1917ec878844d520aac182581c23fb Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Fix deprecation warningsv5.13.0-alpha1Friedemann Kleint2019-02-051-1/+1
|/ | | | | | | | | | | | | | | | | Fix: qsvgiconengine.cpp: In member function ‘virtual QPixmap QSvgIconEngine::pixmap(const QSize&, QIcon::Mode, QIcon::State)’: qsvgiconengine.cpp:200:38: warning: ‘static bool QPixmapCache::find(const QString&, QPixmap&)’ is deprecated: Use bool find(const QString &, QPixmap *) instead [-Wdeprecated-declarations] tst_qsvgrenderer.cpp:479:54: warning: ‘const QMatrix& QPainter::worldMatrix() const’ is deprecated: Use worldTransform() instead [-Wdeprecated-declarations] ... glwidget.cpp: In member function ‘void GLWidget::draw()’: glwidget.cpp:231:41: warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] glwidget.cpp:232:41: warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] fluidlauncher.cpp:71:65: warning: ‘const QRect QDesktopWidget::screenGeometry(int) const’ is deprecated: Use QGuiApplication::screens() [-Wdeprecated-declarations] Change-Id: Iae20d950c3118d05f91202c8020dbd81fa73b48f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Allow <style> without type attributeChih-Hsuan Yen2019-01-291-1/+1
| | | | | | | | | | | | | | According to https://www.w3.org/TR/SVG/styling.html#StyleElement, `type` can be omitted. > If the attribute is not specified, then the style sheet language is assumed to be CSS. Original-Author: Christoph Feck Fixes: QTBUG-58326 Fixes: QTBUG-69378 Change-Id: Ic3d0e8db99da8c81e5a01c0dda33fb38428e38d5 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Consider relative path in image tagsLars Schmertmann2018-11-302-5/+20
| | | | | | Task-number: QTBUG-16198 Change-Id: I26bf48cbac39af0fae490ed21579e8de326cd1a3 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix parsing of forward referrals in use elementsEirik Aavitsland2018-08-203-15/+55
| | | | | | | | | | SVG <use> elements may refer to a node that is defined later in the file. The parser would then fail to resolve the link. Implement delayed link resolution in the parser to handle such cases. Task-number: QTBUG-69694 Change-Id: I94ffb3511dbd0fac822bb56991415b2d99ccf90e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Migrate QSvgHandler to use QRegularExpressionSamuel Gaist2018-08-121-11/+11
| | | | | | | | This patch updates the QSvgHandler class to use QRegularExpression in place of QRegExp which is to be considered deprecated. Change-Id: Ie35ff1e697741711440b6a99da26d435bc782d15 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-07-311-5/+6
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: Ic41094e6744df3d84d76bcfe701092e137660f80
| * Fix crash when parsing malformed url referenceEirik Aavitsland2018-07-301-5/+6
| | | | | | | | | | | | | | The parsing did not check for end of input. Change-Id: I56a478877d242146395977b767511425d2b8ced1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Fix transformation of gradients for svg objectBoundingBox coordinatesEirik Aavitsland2018-06-292-2/+2
| | | | | | | | | | | | | | | | | | | | | | QBrush transformations were not applied in the object coordinate space, even when using Qt's ObjectBoundingMode. Use the new ObjectMode instead to fix this. Task-number: QTBUG-59978 Task-number: QTBUG-67995 Change-Id: I79f529853ed8bca86b1811f4edf66244a026a27c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Make svg icons work as pixmap iconsThorbjørn Martsum2018-06-111-25/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes the svg icon code similar to the code for pixmap icons. We only style the code if we fetch a different mode (+it is not normal) and we try to find icons in same order as the pixmap icons. [ChangeLog][][QIcon/QSvgIconEngine] Made SVG icons behave like pixmap icons: An explicitly-set disabled icon is no longer additionally grayed out. Task-number: QTBUG-67452 Change-Id: I94b4146bae2e9d924a96b602bf23909bd7f0e934 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Morten Kristensen <msk@nullpointer.dk> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | SVG image handler: catch and warn about QImage allocation failureEirik Aavitsland2018-05-221-1/+6
|/ | | | | | | | | | | QImage allocation failure, typically because of out-of-range dimensions, was not immediately caught and reported. This could lead confusing error messages as QPainter would render on a null image. Task-number: QTBUG-68229 Change-Id: If99033244728f1cea635691c6a93564976962f09 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Interpret width or height specified in percent as relative to viewportFrederik Christiani2018-04-301-3/+6
| | | | | | | | | | | When width or height is specified in percent, it is supposed to be relative to the viewport. https://www.w3.org/TR/SVG/coords.html#Units Task-number: QTBUG-2279 Change-Id: Ia1597b88d4e1c705a6755db788a18cf790d5ee97 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix rotate animation freezing in wrong positionv5.11.0-beta4Friedemann Kleint2018-04-111-1/+1
| | | | | | | | | | | | In QSvgAnimateTransform::resolveMatrix(), the indexes into the vals array were previously calculated to be 1,1 in the final step, where currentPosition=1, by using qCeil()/qFloor(), resulting in rotationDiff=0 and the rotation snapping back. Fix by setting startElem to endElem - 1 when available. Task-number: QTBUG-67525 Change-Id: Ie1d7e8be6ea8dd9aa155ee8c479037bc269f6df7 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QSvgHandler: Change some usages of QString to QStringRefFriedemann Kleint2018-02-271-57/+54
| | | | | | | | QString allocation can be avoided in some places after the introduction of QStringRef::toInt()/toDouble(). Change-Id: Ib400f49df04847f85aeea0190215f864f71223bd Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>