summaryrefslogtreecommitdiff
path: root/svgio
AgeCommit message (Collapse)Author
2024-05-06tdf#155651: Add support for "context-fill"Xisco Fauli
Change-Id: I6f96cc7c059ece5f9401fc0ae552cf279e53109c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167230 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
2024-05-05cid#1596833 Uninitialized pointer fieldCaolán McNamara
Change-Id: I1f05ef494e7e28bd105b7658072c33b2d274a803 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167159 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
2024-05-05crashtesting: assert with stroke width of 4.86057e+93Caolán McNamara
on import attempt of moz1322643-3.svg Change-Id: I5f18601767212c1eb7453aacbad076099a2a5b46 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167142 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-05-03tdf#155651: Add support for "context-stroke"Xisco Fauli
Change-Id: Ib4f4a7b644d0d6c6b36e31b80fd7adc18999110d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167024 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-04-25CppunitTest_svgio: fix mid-air collisionXisco Fauli
it was caused by 98935eef13c7d755221d79fe7d3c5869a40a7c37 "tdf#159661, tdf#160773: svgio: Add unittest" and 7f64148507a360825e9c28ddb7077996df9fa092 "Fix a thinko in 8a97f1ba8d9ccb65b2c89106de20666311d90c30" This partially reverts d984836834e67b5bcd618ebd5d1633138985a881 "Fix unit test after commit 98935eef13c7d755221d79fe7d3c5869a40a7c37" Kudos to Mike for keeping Jenkins happy Change-Id: I034759b2cd95cbaaeb84ec1b528bf5b61487a1e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166591 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-04-24Fix unit test after commit 98935eef13c7d755221d79fe7d3c5869a40a7c37Mike Kaganski
Similar to commit cfa9990d470b10548c7fed64eb1182fea11d41e0 (Enable this test on all platforms. 2024-04-20), it seems that 'mask' gets exported inconsistently. This patch workarouns the problem; a proper fix would be finding the real cause. Change-Id: I94c89442aa0385262fba67ec58c9d8d12ffbea27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166573 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-23tdf#159661, tdf#160773: svgio: Add unittestXisco Fauli
Change-Id: I2d0b96f13e02ac81b97ea347889c76770c22a989 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166509 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-04-22tdf#159660: also add normal blend filterXisco Fauli
Change-Id: I3edc7495975618357f002536857a11dcc72cc0b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166460 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-04-22tdf#160782: convert to bitmapEx from 0,0 to width,heightXisco Fauli
This is the way it's done everywhere. Partially revert 4b6e0f2c88debaedb514c868e061c21e15215b6e "tdf#160726, tdf#48062: Simplify how BitmapExs are created" Change-Id: I15fea0b6855a65da7cb48b24fc00ba303e33dcf8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166456 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-04-22tdf#159660: Add support for lighten mode in feBlendXisco Fauli
Change-Id: I17471a9c70a38d05de5ad476f817285fb2438e5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166429 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-04-22tdf#159660: Add support for darken mode in feBlendXisco Fauli
Change-Id: I56862163b7bf1177120081c95ab7851a5fc4019b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166428 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-04-22tdf#159660: Add support for multiply mode in feBlendXisco Fauli
Change-Id: I03230e122a10dd6ada6af357c674c278b6b99d9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166427 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-04-22tdf#159660: premultiply colors for screen blendXisco Fauli
This is needed after 4b6e0f2c88debaedb514c868e061c21e15215b6e "tdf#160726, tdf#48062: Simplify how BitmapExs are created" Otherwise, only the common area is displayed Change-Id: I40c798380049e62df8729c4acdb5db50d988d8e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166426 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-04-22tdf#160726, tdf#48062: Simplify how BitmapExs are createdXisco Fauli
In my initial approach, I tranformed the primitive2DContainers before converting them to BitmapEx. This caused circles like https://bugs.documentfoundation.org/attachment.cgi?id=193790 not to be displayed. Simplify how BitmapExs are created by just using the range both primitive2DContainers have in common. This way, DrawBitmapInRect can be dropped now Change-Id: I2401dc87b98e04b9cf9f5ebade2b5622d884fc3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166391 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-04-21svgio: feImage and feFlood don't support the in attributeXisco Fauli
Added by mistake in b22039cff8380b158307e75762bd3e4ca045d77b "related: tdf#159947: only parse in/result if the element supports them" See https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/in Change-Id: Ie8b5591349eff710d1edc7f413790ac9d31df99d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166389 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-04-20tdf#157103: fix SVG whitespace handlingMike Kaganski
Previous code tried to hack some tricks to restore whitespaces after trimming them according to the xml:space attribute value. But it was wrong in multiple ways. 1. The collapsed space must stay in the block where its start was. When a block ended with a space, then trimming the space from it, and adding to a next block, can change the size of the space. 2. The shift of a line (e.g., specifying x and y values) doesn't end the logical line. A space before such a shift must be kept by the same rules, as if there weren't a shift. 3. A block with xml:space="preserve" is treated as if it consists of all non-whitespace characters, even if its leading or trailing characters are spaces. I.e., a trailing space in a block before, or a leading space in a block after, should be collapsed into a single space, not removed - even when the space-preserving block itself is made invisible. Change-Id: Ic778d1e9d6b9d0c342ea74ad78d44bb47bc8d708 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166239 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-20cid#1596521 Resource leakCaolán McNamara
Change-Id: I3064195408e508f1f77d22b82ad464a651064193 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166287 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-04-20tdf#160702: improve text positioningMike Kaganski
Opening an SVG with text in different elements (e.g., tspans) in the same text element performs calculations to position the parts properly (i.e., the next part will start where the previous part ended, unless the position in overridden explicitly). These calculations require to know the text widths. The first problem leas here: the text width was calculated for a typically small text size (numerically equal to the pixel size defined in the SVG), but these calculations aren't truly linear, because font rendering may change depending on font height. Additionally, the rounding gives much higher error in smaller sizes than in larger. There was already a workaround for a similar problem in ViewRedirector::createRedirectedPrimitive2DSequence, where a large font (with 100 times greater height) was used to increase correctness. This was also used here, with the same large height (50000) used as a reference. Then, at the time of wrawing the text at different zoom levels, the code in VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D creates a font of a calculated size, and uses it to output the text. But the font is always created with an integral height, which means, that for a wanted height of 2.5 (in a zoomed out view), the really used height will be 3, which is 20% larger; or for wanted height of 2.4, the actual height will be 2 (20% smaller). This resulted in odd jumps of the text widths, when the text may overlap the following part, or conversely, create a big gap before the next gap. To try to mitigate that, the function now takes the difference between the wanted and the actual font size into account, and adjusts the MapMode accordingly. This doesn't fix the jumping completely (e.g., because of the mentioned special handling of small font sizes in the fonts thenselves, like hinting), but still makes the calculations much more stable, decreasing the amount of jumping. Similar changes are made in TextLayouterDevice. Use of the functions that return text size as a double, not rounded value, should additionally help improving stability. Change-Id: I455845d8ca43ee9c06a0fc980947f35d8a25797a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166238 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-20svgio: remove duplicated assertXPathDoubleXisco Fauli
Change-Id: I82c4abc6883d292114b4239efee60aee082357fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166307 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-19tdf#160721: nothing is displayed in case of wrong 'in' referenceXisco Fauli
Change-Id: I746ec8a12dba7832241693dac7f20788a2fa85bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166267 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-04-19tdf#160622: Let SalLayout::GetBoundRect return basegfx::B2DRectangleMike Kaganski
This avoids premature rounding in TextLayouterDevice::getTextBoundRect. The box in D2DWriteTextOutRenderer::performRender needs to be expanded to allow room for the line width (which now will be guaranteed on all sides; previously, the rounding could happen to give no room on some side, even prior to commit 8962141a12c966b2d891829925e6203bf8d51852). Fixes some lines partially cut off in smaller text (or zoomed out). Change-Id: I07335136021f894cf045363b4d736bfab06c64d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166236 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-19tdf#160717: fix ex handlingMike Kaganski
Same as in commit e27572686130df43d1d65c574b0c34f39fc0d1a9 (tdf#160593: make sure to use current element's font size for em unit, 2024-04-18) for em. Change-Id: Id9003c0426a6b373456da1aa1550f7ff07f766a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166235 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-18tdf#160594: Use the recommended fallback of 0.5em for ex in font-sizeMike Kaganski
This fixes the error of identical treatment of em and ex in font-size, which violated https://drafts.csswg.org/css-values-4/#font-relative-length. The fix uses the fallback of 0.5em for ex, similar to the code used in SvgNumber::solveNonPercentage. A follow-up should implement the correct use of "x-height of the first available font". Change-Id: Id9d581994e158d629d9752299ad93ac7e9fe4cad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166234 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-18tdf#160593: make sure to use current element's font size for em unitMike Kaganski
According to https://drafts.csswg.org/css-values-4/#font-relative-length em is "equal to the computed value of the font-size property of the element on which it is used". This means, that for an element that defines its own font-size, attributes like 'dy' using em refer to the new font-size, not to inherited font-size. Change-Id: Ie5a013df99a68edddf466e4c0ee5311f6219fcb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166233 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-18svgio: factor out common codeXisco Fauli
Change-Id: Ib86f04364593546f53419b37d35469c561561aa1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166188 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-04-17svgio: map all 'in' keywords to target for nowXisco Fauli
Change-Id: I18d6c839c4005e4052397c4f6682d78c664d25ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166145 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-04-16tdf#48062: Add support for arithmetic in feCompositeXisco Fauli
Took https://github.com/w3c/csswg-drafts/issues/3831 as a reference Change-Id: I42039c481ec114c3faeae51526a5f29b86960146 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165828 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-04-15cid#1596322 Resource leakCaolán McNamara
Change-Id: Ied68c2c6d69437ea0236724279b2353015cd1e65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166110 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-04-14Round in XmlWriter::attribute when passing a doubleMike Kaganski
Before, it truncated. Rounding provides a closer value. Change-Id: I213e6ae34ada2f5081cb2c8b2ef431448c712b37 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165947 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-12tdf#159660: Add support for screen mode in feBlendXisco Fauli
Change-Id: Iefe655a370cca930319290baa2a25d791371f55c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165958 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-04-11Move variables into their usage scopeMike Kaganski
Change-Id: I9b04a3b62fed65139a4b48629e9b442ba163a3d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165931 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-03tdf#146619 Drop unused 'using namespace' in: svgio/Gabor Kelemen
Change-Id: I4db608823faf4588e65e53fd099c9bc76bf39f68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165539 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2024-03-28Fix typoAndrea Gelmini
Change-Id: I082d3bd5f60d9f1c9b99f0505256e3c8ef2d124d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165496 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-28svgio: simplify codeXisco Fauli
Change-Id: Ieead2322e74829f187abf84dacbe8b107ea5130e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165450 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-03-27tdf#160386: Add support for switch elementXisco Fauli
For now, only use language tag, meaning if there is a file like in the unittest with <text systemLanguage="en-us">Howdy!</text> <text systemLanguage="en-gb">Wotcha!</text> <text systemLanguage="en-au">G'day!</text> <text systemLanguage="en">Hello!</text> "Hello!" with be displayed in a en_AU system locale This patch partially reverts 13a41e7a12598c7896d6dc8d34aba6af5b80b83c "tdf#150124: do nothing when parent is of unkown type" making 0dfd8288a87b58e503bb3a41be6137485fbf3f68 "ofz#60384 Direct-leak" no longer necessary Change-Id: Ifc73bc69aa997088dc0a2b11d7d30446303fa3b3 Change-Id: I885ef0f2c44b86196881fe55a963db2e5c7eb1be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165394 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-03-27tdf#156579: svgio: Add unittestXisco Fauli
Change-Id: I77ab0c72209fa02c6e463351e8cda09213d47ac3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165399 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-03-27CppunitTest_svgio: factor out common codeXisco Fauli
Change-Id: I5171a07d9015706a89f25b0c2805ebed8444260d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165401 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-03-26tdf#160373: Iterate over all parents to check whether it's a clipPath contentXisco Fauli
Change-Id: I383ec264e4c88ebcee2ae6a839b762bba8abfc12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165347 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-03-15tdf#48062: use mergeToSinglePolyPolygon instead of createPolygonFromRectXisco Fauli
Otherwise, in files like https://bug-attachments.documentfoundation.org/attachment.cgi?id=193126 where no rectangles are used the mask is displayed as a rectangle Change-Id: I8cafb22bd6055db729d0d56b4756119d7989abb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164863 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-03-15tdf#48062: Add support for atop operator in feCompositeXisco Fauli
Change-Id: Ifb83b4361d37566d189a7c5b11835f2a5e0eecc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164862 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-03-15tdf#48062: Add support for xor, in and out operators in feCompositeXisco Fauli
atop and arithmetic are still missing Change-Id: I9b5bfeaa87b48071708ca4cb082916ea5f260adb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164852 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-03-13tdf#48062: Add support for feComposite filterXisco Fauli
At the moment, only 'over' operator is supported Change-Id: If21c9ba39b3cd0b772ea27165cda7ae40fb42d60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164765 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-03-13tdf#159660: Add support for feBlend filterXisco Fauli
At the moment, only the 'normal' mode is supported Change-Id: I31d1536e03e938ce0f7304a37eb6c1071ecfcf4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164763 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-03-13Fix typo pointer nameAndrea Gelmini
Change-Id: Ieb18b3f4ea7734abfe9e814f39a7c15de7794900 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164779 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2024-03-12tdf#159660: Add support for feMerge and feMergeNodeXisco Fauli
Change-Id: I52e35f6eb5efc7b064145486aa4e6fb2366b143c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164722 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-03-12related: tdf#159947: only parse in/result if the element supports themXisco Fauli
There are some filters ( e.g. feMerge ) that do not support in or result attributes Change-Id: I4072dc481557557733e55cc5fcbd80cb11a7ddb5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164718 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-03-07Simplify some basegfx::fTools::*orEqual callsNoel Grandin
Comparing with zero is simple - the implementation of basegfx::fTools::moreOrEqual calls rtl_math_approxEqual eventually, which special-zases zero. Change-Id: I62f10f63f103d91a201dfeb20e5b3f9010f377c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164526 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-01tdf#159968: Support overflow:visible in marker elementXisco Fauli
Change-Id: I4ea648cf94a4bb321a78843a9898769a69c5630d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164224 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-03-01svgio: simplify a bitXisco Fauli
By default, preserveAspectRatio is already xMidYMid meet Change-Id: I37d85979728e9382c9b21b3219f3ad79eeec536c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164188 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-02-29tdf#159947: Add support for in and result filter attributesXisco Fauli
Change-Id: I8bc7e319a64c528893de8454c64545146ad4e9d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164108 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>