summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* cargo updatewip/sophie-h/avoid-time-0-1Federico Mena Quintero2023-03-071-115/+120
| | | | Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/802>
* cargo: Avoid pulling time 0.1 via chronoSophie Herold2023-03-023-24/+3
| | | | | | | The time 0.1 crate has a CVE attached to it. The newly specified features will be the default for chrono 0.5. Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/802>
* Merge branch 'reduce-element-generics' into 'main'Marge Bot2023-02-2833-851/+601
|\ | | | | | | | | Reduce binary size a bit; remove ElementInner<T> See merge request GNOME/librsvg!801
| * clippy: Use Box's default instead of the inner's defaultFederico Mena Quintero2023-02-271-1/+1
| | | | | | | | Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/801>
| * Remove ElementInner<T> and replace it with an ElementData enumFederico Mena Quintero2023-02-2714-504/+320
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We had this structure: enum Element { Circle(Box<ElementInner<Circle>>), // ... all the supported elements } struct ElementInner<T> { // fields to hold element's name, attributes, SpecifiedValues, etc. element_impl: T } However, "impl ElementInner" has a little bunch of methods, which get monomorphized for each supported element type. These methods don't do anything with the "element_impl: T". Instead, we now have this structure: struct Element { // fields to hold element's name, attributes, SpecifiedValues, etc. element_data: ElementData, } enum ElementData { Circle(Box<Circle>), // ... all the supported elements } The Circle inside the Box, and all the other structs for element types, implement ElementTrait which has the ::draw() method. I'm using concrete types inside the boxes, not Box<ElementTrait>, to avoid having to downcast to the concrete type. The only place that dispatches dynamically is ElementData::draw(). The call_inner!() macro goes away, since it doesn't need to delegate things to the ElementInner any more. All the interesting stuff happens directly in struct Element. The rest of the code doesn't need too many changes, since all the borrowing and type checking happens in the NodeBorrow trait - its borrow_element*() methods, and the macros is_element_of_type!() and borrow_element_as!(). Together with the previous commit that simplifies feComponentTransfer, this removes 186912 bytes from the .text section of rsvg-convert (per objdump's numbers). Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/801>
| * Combine the traits SetAttributes and Draw back into a single ElementTraitFederico Mena Quintero2023-02-2327-181/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This more or less reverts 6608c133d501bca6ffe2d1288539c91882fe5bdb, with this purpose: Right now, ElementInner<T> produces a lot of monomorphized code. E.g. there are 28 implementations of this: 0.0% 0.0% 825B librsvg librsvg::element::ElementInner<T>::set_style_attribute 0.0% 0.0% 825B librsvg librsvg::element::ElementInner<T>::set_style_attribute 0.0% 0.0% 825B librsvg librsvg::element::ElementInner<T>::set_style_attribute 0.0% 0.0% 825B librsvg librsvg::element::ElementInner<T>::set_style_attribute 0.0% 0.0% 825B librsvg librsvg::element::ElementInner<T>::set_style_attribute (The above comes from "cargo bloat --release -n 0 --filter librsvg".) Inside ElementInner, I want to basically have a field "element_impl: Box<dyn ElementTrait>" instead of "element_impl: T". This should cut down the generated code, so we are basically trading cache locality or code size for a little dynamic dispatch. Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/801>
| * gradient::Common - don't impl SetAttributes, use a simple methodFederico Mena Quintero2023-02-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | In 6608c133d501bca6ffe2d1288539c91882fe5bdb, ElementTrait was split into two traits, SetAttributes and Draw. The purpose of SetAttributes back then was just to be able to implement it for gradient::Common, which is a simple struct, not an SVG element. Since it is *not* an element, let's not use that trait for it at all. Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/801>
| * Simplify FeFunc* by using newtypes over a FeFuncCommon typeFederico Mena Quintero2023-02-232-156/+164
| | | | | | | | | | | | | | | | All of FeFunc{R,G,B,A} are the same except for the type name. So, instead of duplicating all their code with a macro, extract the common bits to a FeFuncCommon struct. Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/801>
| * filters/component_transfer.rs: Remove the channel field in FeFunc*Federico Mena Quintero2023-02-231-33/+11
|/ | | | | | | | | | | | | | | | | | | | This is a vestige of the C code. All the feFuncX elements were represented with a single struct that had a "channel" field, to identify which is which. <feComponentTransfer ...> <feFuncR .../> <feFuncG .../> </feComponentTransfer> When scanning the children of feComponentTransfer, the individual func->channel were tested to see which of the children is the Red function, which the Green function, etc. But now we identify the individual functions by their element type, so we can just do `matches!(element, Element::FeFuncR)` or similar. Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/801>
* Merge branch 'check-clip-mask-transforms' into 'main'Marge Bot2023-02-2212-101/+191
|\ | | | | | | | | | | | | (#930): Validate all clipPath and mask transforms Closes #930 See merge request GNOME/librsvg!800
| * (#930): Validate all clipPath and mask transformsFederico Mena Quintero2023-02-2212-101/+191
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, an invalid "transform" property specified for clipPath would bubble up as a non-recoverable "invalid matrix" error from Cairo, stopping rendering at that point. Instead, we want to validate all transforms and just not render the offending element. This commit has many changes: * Introduce a ValidTransform newtype, created with "impl TryFrom<Transform> for Transform". This sees if the transform is invertible before wrapping it. The idea is to do all transform operations first, then see if the result is valid by trying to convert to a ValidTransform. * There is no "impl From<Transform> for cairo::Matrix" anymore, but there is From<ValidTransform>. That way, we guarantee that an unvalidated transform cannot be easily set on a Cairo context. * DrawingCtx::get_transform() returns a ValidTransform, since a) it comes from the cr, and Cairo already validated that transform for us. Otherwise, the cr would have been in an error state. * There is a new variant RenderingError::InvalidTransform, which lets us use "?" everywhere as normal. This error case is caught in Node::draw() and the node is just not drawn. Eventually we can move to a scheme where we distinguish between fatal errors (e.g. RenderingError::LimitExceeded) and recoverable ones. Fixes https://gitlab.gnome.org/GNOME/librsvg/-/issues/930 Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/800>
* Merge branch 'update-selectors' into 'main'Marge Bot2023-02-204-62/+64
|\ | | | | | | | | | | | | Update selectors and cssparser Closes #925 See merge request GNOME/librsvg!799
| * Update NEWS with info about hwb() colorsFederico Mena Quintero2023-02-201-0/+8
| | | | | | | | Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/799>
| * (#925): Cargo.toml: Update to selectors-0.24.0 and cssparser-0.29.0 togetherFederico Mena Quintero2023-02-203-62/+56
|/ | | | | | css.rs: Update for changes in the AtRuleParser trait's API Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/799>
* Merge branch 'benchmarks-runner' into 'main'Federico Mena Quintero2023-02-172-82/+77
|\ | | | | | | | | Complete run-benchmarks.py script See merge request GNOME/librsvg!798
| * Complete run-benchmarks.py scriptNeetu Mehta2023-02-172-82/+77
|/
* Merge branch 'benchmarks' into 'main'Marge Bot2023-02-1578-0/+11107
|\ | | | | | | | | Add a bunch of hicolor application icons, and a benchmarks runner See merge request GNOME/librsvg!797
| * benchmarks/run-benchmarks.py: work in progress script to run the sets of ↵Federico Mena Quintero2023-02-151-0/+17
| | | | | | | | | | | | benchmarks Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/797>
| * benchmarks/hicolor-apps: Add a bunch of application iconsFederico Mena Quintero2023-02-1577-0/+11090
|/ | | | | | | | This will be the basis for one of rsvg-bench's measurements. The idea is to have an idea of how much it would take for gnome-shell to render the "Applications" pane with all the icons, and to optimize based on that. Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/797>
* Merge branch 'benchmark-script' into 'main'Marge Bot2023-02-151-0/+79
|\ | | | | | | | | Add script to run benchmark and submit metrics See merge request GNOME/librsvg!791
| * Add script to run benchmark and submit metricsNeetu Mehta2023-02-151-0/+79
|/ | | | | | | | The script runs cachegrind on the given command and arguments. It parses the cachegrind output file and submit metrics to the librsvg-metrics webapp. Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/791>
* Merge branch '932-too-big-font' into 'main'Marge Bot2023-02-153-36/+93
|\ | | | | | | | | | | | | Fix panic when using a font-size that is too big for Pango Closes #932 See merge request GNOME/librsvg!796
| * Add test for #932Federico Mena Quintero2023-02-142-0/+10
| | | | | | | | Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/796>
| * Remove assertion that I used to check my understanding of Pango's sizesFederico Mena Quintero2023-02-141-4/+0
| | | | | | | | | | | | | | | | | | Yes, the sizes returned from pango_layout_get_size() are positive if Pango doesn't overflow its i32 values. The assertions were there from e4dc9bacdb528ce03109d8f98d1d7a7c88d6416e when I was checking what Pango does for RTL text. Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/796>
| * Remove unused functionFederico Mena Quintero2023-02-141-4/+0
| | | | | | | | Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/796>
| * MeasuredSpan::from_span(): Check that the font-size and letter-spacing are ↵Federico Mena Quintero2023-02-141-32/+62
| | | | | | | | | | | | | | | | | | | | | | | | convertible to Pango units Otherwise, ignore the span - return None and have the caller ignore it. Now, this is a good place to actually impose a limit on font sizes. What should those be...? Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/796>
| * Newtype PangoUnits(i32): used to check for overflow when converting to i32 ↵Federico Mena Quintero2023-02-141-0/+25
|/ | | | | | pango units Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/796>
* Merge branch 'update-nalgebra' into 'main'Marge Bot2023-02-134-32/+24
|\ | | | | | | | | | | | | (#934): Update nalgebra Closes #934 See merge request GNOME/librsvg!795
| * Explicitly update to regex 1.7.1 or laterFederico Mena Quintero2023-02-131-1/+1
| | | | | | | | | | | | Mainly to shut up deps.rs, which flags "1" as vulnerable. Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/795>
| * Fix deprecations from nalgebraFederico Mena Quintero2023-02-132-12/+4
| | | | | | | | | | | | Dynamic::new(value) -> Dyn(value) Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/795>
| * Bump nalgebra to 0.32.1Federico Mena Quintero2023-02-132-19/+19
|/ | | | Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/795>
* Merge branch 'prepare-release' into 'main'2.55.91Marge Bot2023-02-107-21/+111
|\ | | | | | | | | Prepare 2.55.91 release See merge request GNOME/librsvg!794
| * releasing.rst: Update the release process to use a tarball created by the CIFederico Mena Quintero2023-02-101-8/+5
| | | | | | | | | | | | | | | | It used to recommend running `make distcheck` by hand, but now that we do that in the CI, it's safer / more reproducible to do it there with the CI's environment. Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/794>
| * Update NEWSFederico Mena Quintero2023-02-101-0/+26
| | | | | | | | Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/794>
| * Bump version to 2.55.91Federico Mena Quintero2023-02-104-6/+6
| | | | | | | | Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/794>
| * features.rst: detail the XML features (xinclude, xml:lang, xml:space)Federico Mena Quintero2023-02-101-7/+73
| | | | | | | | Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/794>
| * features.rst: add missing feDropShadow to the list of filter effectsFederico Mena Quintero2023-02-101-0/+1
|/ | | | Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/794>
* Merge branch 'fe-drop-shadow' into 'main'Marge Bot2023-02-1025-132/+305
|\ | | | | | | | | | | | | Implement the feDropShadow element Closes #743 See merge request GNOME/librsvg!793
| * features.rst: list feDropShadow in the table of supported elementsFederico Mena Quintero2023-02-091-0/+15
| | | | | | | | Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/793>
| * (#743): implement the feDropShadow elementFederico Mena Quintero2023-02-097-2/+136
| | | | | | | | | | | | Fixes https://gitlab.gnome.org/GNOME/librsvg/-/issues/743 Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/793>
| * Extract function to create the primitives for a drop-shadow effectFederico Mena Quintero2023-02-091-50/+65
| | | | | | | | Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/793>
| * DropShadow::to_filter_spec: use temporary variable for the std_deviationFederico Mena Quintero2023-02-091-1/+2
| | | | | | | | Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/793>
| * DropShadow::to_filter_spec - first collect the ResolvedPrimitive, then turn ↵Federico Mena Quintero2023-02-091-11/+12
| | | | | | | | | | | | | | | | | | them into user space This will let us extract a function to generate the primitives in the first place. Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/793>
| * FilterEffect::resolve: return Array of ResolvedPrimitivesJohn Ledbetter2023-02-0917-76/+83
|/ | | | | | | This change allows us to return filters composed of multiple ResolvedPrimitives, specifically for the FeDropShadow filter element. Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/793>
* Merge branch 'cargo-nmake' into 'main'Federico Mena Quintero2023-02-095-36/+54
|\ | | | | | | | | NMake Makefiles: Clean up a bit See merge request GNOME/librsvg!790
| * NMake Makefiles: Clean up a bitChun-wei Fan2023-02-045-36/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This attempts to clean up the NMake Makefiles, as well as making running Cargo in a cleaner manner, by: * Reduce repetitions in the code using Makefile variables and expanding on them. * Use --target-dir and --manifest-path to reduce changing directories and setting envvars during the build. * Use the correct intermediate directories for cross- and non-cross-builds, for at least Cargo 1.67.x or later. For RustC 1.63.x to 1.66.x non-cross builds, please update to 1.67.x if this becomes an issue, or file an issue to support the older method. * Use the toolchain flag (the +$(toolchain) flag) so that we do not attempt to set the default toolchain when building 32-bit builds on a 64-bit system, for instance. Note that for cross-builds (i.e. x64 builds in a 32-bit build/cross environment and ARM64 builds) continue to use the --target=... flag, as it is required. * Add two NMake Makefile options, VERBOSE and USE_NIGHTLY_TOOLCHAIN, to use verbose mode during Rust compilation and use a nightly toolchain instead of a stable toolchain. This means, verbose Rust compilation mode is now only enabled on demand, and one can choose to use a nightly Rust toolchain instead of the stable one if needed.
* | Merge branch 'bilelmoussaoui/update' into 'main'Marge Bot2023-02-0931-438/+602
|\ \ | |/ |/| | | | | Traditional gtk-rs update See merge request GNOME/librsvg!792
| * clippy: remove unnecessary lifetimesbilelmoussaoui/updateFederico Mena Quintero2023-02-081-2/+2
| | | | | | | | Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/792>
| * clippy: remove unnecessary referencesFederico Mena Quintero2023-02-082-2/+2
| | | | | | | | Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/792>
| * clippy: remove unnecessary referencesFederico Mena Quintero2023-02-081-2/+2
| | | | | | | | Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/792>