mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Add bindings for ArcSlice and ThinArc, and use them to reduce copies of SVG path data.
As I said over bug 1549593, the eventual goal is to use ArcSlice in all inherited properties. But this seemed like a good first candidate that doesn't require me to move around a lot more code, since we were already using cbindgen for the path commands. Differential Revision: https://phabricator.services.mozilla.com/D30134
This commit is contained in:
parent
0d5c4481b8
commit
f429c28f23
5 changed files with 39 additions and 41 deletions
|
@ -577,12 +577,10 @@ pub mod basic_shape {
|
|||
|
||||
/// Generate a SVGPathData from StyleShapeSource if possible.
|
||||
fn to_svg_path(&self) -> Option<SVGPathData> {
|
||||
use crate::values::specified::svg_path::PathCommand;
|
||||
match self.mType {
|
||||
StyleShapeSourceType::Path => {
|
||||
let gecko_path = unsafe { &*self.__bindgen_anon_1.mSVGPath.as_ref().mPtr };
|
||||
let result: Vec<PathCommand> = gecko_path.mPath.iter().cloned().collect();
|
||||
Some(SVGPathData::new(result.into_boxed_slice()))
|
||||
Some(SVGPathData(gecko_path.mPath.clone()))
|
||||
},
|
||||
_ => None,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue