16 Commits
Author SHA1 Message Date
Eskil Abrahamsen BlomfeldtandQt Cherry-pick Bot 8bdaa95e8b Don't add outlines to text when there is none
Qt SVG would indiscriminately add outlines to text. Since the pen
has Qt::NoBrush, the outline would not be visible with a normal
QPainter, but it did always trigger the QPainterPath code path which
is taken when the text uses features we don't support through the
native rasterizer backend.

In turn, this would cause all text to be unsearchable when printing
the SVG to a PDF. In addition, all text would be too thick in this
case because the PDF generator adds the outline even if the brush
is Qt::NoBrush.

Fixes: QTBUG-123817
Change-Id: Icff637e65ea9f0c867a374fcbba3f6ad4a6756fc
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
(cherry picked from commit 4d9bd9572f340fb9bc2f96f55ea6836386ac0b0d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 09918e3da44f80bff8bb13cd65984bd7e00c95e6)
(cherry picked from commit 07b3434f91c95d196f687c51e1a58a95a0b1ef2e)
2025-06-03 23:25:40 +00:00
Eskil Abrahamsen BlomfeldtandRobert Löhning cc46be11b6 Fix cycle detection in <use> elements
In 0332df304f013ded362537c1f61556098b875352, the cycle
detection was moved to an earlier point in parsing, which
broke cycle detection for the <use> element, since the links
in <use> are not resolved until the end of parsing,
when resolveNodes() is called.

This adds an additional cycle check at the end of parsing
as well.

Change-Id: I13278aa187020df70673f388d76ab609c1ec168b
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 6e27565a3bfb0fc56005f6d7c8cf970b1dd0007f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit b2527e3606d817b262181255590bab53d01e10ed)
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2025-01-23 16:49:01 +01:00
Eskil Abrahamsen BlomfeldtandQt Cherry-pick Bot 36f8bb21ca Factor out code to select QSvgSwitch child to render
This enables other renderers to reuse the logic which detects the
branch to take in a switch.

Task-number: QTBUG-121645
Change-Id: I14d24ff4203ad64ec462ab38d30a7a524cb827a7
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 655b73999f847d5ff04a8e9365371538182caf4d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-07 14:25:03 +00:00
Eskil Abrahamsen Blomfeldt 59bbe94c21 Enabler: Pass filename through QSvgImage node
If the image is loaded from a file and not from encoded data,
it can be useful to access the data later for the svgtoqml
tool, allowing the generated code to reference the original
source path for instance.

Change-Id: Ibce8169fb649f3c172b9bbf5bf9212be9521e280
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2024-04-29 15:14:27 +03:00
Eskil Abrahamsen Blomfeldt 3117386a40 Support loading image file whose name begin with "data"
We would assume all filenames beginning with "data" indicated
embedded base64, and even if this failed, we would not try
loading the file as normal. This made e.g. loading a file called
"data.png" impossible.

The easy fix is just to check if we successfully loaded the file
as data and load it as a file instead if not.

Change-Id: I19e532ae7a8fd456ba9717c36820a188a2cec470
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
2024-04-25 16:42:11 +03:00
Eskil Abrahamsen Blomfeldt bc2f4bc617 Enablers for supporting mask element in QML generator
Visitor callbacks as well as exposing some properties.

Task-number: QTBUG-121537
Change-Id: Ie11db84bf6c0475967f2b26a90155666dd383777
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
2024-04-18 12:41:18 +02:00
Eskil Abrahamsen Blomfeldt 7a4a232279 Add missing getters for SVG nodes
We should be able to get any property that's set on the svg nodes.
This gets important when implementing the visitors for e.g. the
svgtoqml tool.

Change-Id: I23cfe13d975fb398064a864b0522f067584f351c
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
2024-02-27 13:00:20 +01:00
Eskil Abrahamsen Blomfeldt cdc13732da Remove weather info manual test
This depends on discontinued Yr API and no longer serves any purpose.

(From http://www.yr.no/place/Norge/Oslo/Oslo/Oslo/varsel.xml:
"After a long period of weekly downtime, the Yr API (forecast.xml/varsel.xml)
is now discontinued.")

Fixes: QTBUG-120695
Change-Id: I25dce0b871d586c187556c454795040765b241e8
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2024-01-31 14:23:02 +01:00
Eskil Abrahamsen Blomfeldt b7ca59454a Fix crash when reading text with line breaks
Introduced by d130c74f4f, trying to read
an svg with a line break in the text would crash, because nullptr is
used as a token for linebreaks in Qt SVG and we were accessing it without
checking.

[ChangeLog] Fixed a regression where the application would
crash on certain SVG files.

Pick-to: 6.2 6.5 6.6
Change-Id: Ia261372cd957a2ebcd49033a57d43ebd201c83bb
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2023-10-12 13:17:24 +02:00
Eskil Abrahamsen Blomfeldt d130c74f4f Don't rasterize gigantic shapes
We set a limit for the bounding rect of shapes to avoid stalling
applications for several minutes while rendering unreasonably large
shapes. The limit can be disabled using an environment variable.

[ChangeLog][Performance] Unreasonably large shapes are now ignored
in SVG files to avoid stalling the application. The check can be
disabled by setting QT_SVG_DISABLE_SIZE_LIMIT=1 in the environment.

Pick-to: 6.2 6.5
Fixes: QTBUG-111850
Change-Id: Id8154049c96a565aad237ee007da0ee879446448
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-04-17 13:29:44 +02:00
Eskil Abrahamsen Blomfeldt 659e6bf8ca Add timing information in debug output
This can help in debugging performance issues with some shapes.

Change-Id: Id94f8f3d016346b00a7c45f39f6c957607258bda
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-04-17 13:29:37 +02:00
Eskil Abrahamsen Blomfeldt 1b5ab50692 Avoid undefined behavior when painter transform goes oob
With some broken input files, we can end up with a matrix
that scales or translates so far that it ends up with
NaNs or Infs. This causes undefined behavior later when
doing comparisons. We protect against this by checking
for matrix validity after transforming and resetting the
matrix if it becomes invalid.

Pick-to: 5.15 6.2 6.3 6.4
Fixes: QTBUG-101698
Change-Id: Iabc745c1e7a0c36449f14c4c6d9bc8066eaa8eac
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-07-14 10:54:46 +02:00
Eskil Abrahamsen Blomfeldt 210d8b9b02 Update dependencies.yaml
Need to expedite this to get some fixes through qtdeclarative.

Change-Id: I97d7e7e6b858ed0c351fa82fa8e6bd0091135688
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-04-21 10:39:22 +02:00
Eskil Abrahamsen Blomfeldt 1cb4cd6e2d Android: Skip QSVGRenderer test
These tests require access to local file system and are not
written to be portable to remote devices. Since there is no
real platform-dependency in this, testing them on other
platforms is sufficient, so we will just skip it on Android
rather than spend time on it.

Task-number: QTBUG-73624
Change-Id: Ic11b69d2eb73e0cd264b153c9870dd7923e1336d
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2019-06-25 08:48:24 +02:00
Eskil Abrahamsen Blomfeldt b540b304a3 Android: Fix QSVGPlugin test
Assets have to be included in the resources in order to be accessible
when testing on a remote device.

Task-number: QTBUG-73625
Change-Id: I80332b6492bffc01c0157918b9e6abbc2b87a43b
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2019-06-25 08:05:39 +02:00
Eskil Abrahamsen Blomfeldt b2f4501460 Make QSvgGenerator test pass on Android
Platforms like Android require assets to be bundled with
the app. We include the reference SVGs as resources to work
around this.

Task-number: QTBUG-73623
Change-Id: Id9cc7a7d575da5adbe73a3392419fd74a1ec1bbd
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2019-05-14 11:14:02 +02:00