mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 04:41:11 +00:00
Bug 1839459 - Elide empty closed sub-paths instead of emitting a start point. r=jrmuizel, a=dmeehan
There is a corner case that triggers an assert in wpf-gpu-raster if an empty sub-path starts off a path. Just avoid the problem by eliding the sub-path, but at least handle close correctly as per the Canvas2D closePath spec: "The closePath() method, when invoked, must do nothing if the object's path has no subpaths. Otherwise, it must mark the last subpath as closed, create a new subpath whose first point is the same as the previous subpath's first point, and finally add this new subpath to the path." Differential Revision: https://phabricator.services.mozilla.com/D181543
This commit is contained in:
parent
15dd5a0a2b
commit
98faade49a
@ -10,9 +10,9 @@ git = "https://github.com/FirefoxGraphics/aa-stroke"
|
||||
rev = "07d3c25322518f294300e96246e09b95e118555d"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/FirefoxGraphics/wpf-gpu-raster?rev=112a2140c433af06938c663fc6777e2bf17bb6ce"]
|
||||
[source."git+https://github.com/FirefoxGraphics/wpf-gpu-raster?rev=5ab6fe33d00021325ee920b3c10526dc8301cf46"]
|
||||
git = "https://github.com/FirefoxGraphics/wpf-gpu-raster"
|
||||
rev = "112a2140c433af06938c663fc6777e2bf17bb6ce"
|
||||
rev = "5ab6fe33d00021325ee920b3c10526dc8301cf46"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/chris-zen/coremidi.git?rev=fc68464b5445caf111e41f643a2e69ccce0b4f83"]
|
||||
|
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -6228,7 +6228,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "wpf-gpu-raster"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/FirefoxGraphics/wpf-gpu-raster?rev=112a2140c433af06938c663fc6777e2bf17bb6ce#112a2140c433af06938c663fc6777e2bf17bb6ce"
|
||||
source = "git+https://github.com/FirefoxGraphics/wpf-gpu-raster?rev=5ab6fe33d00021325ee920b3c10526dc8301cf46#5ab6fe33d00021325ee920b3c10526dc8301cf46"
|
||||
dependencies = [
|
||||
"typed-arena-nomut",
|
||||
]
|
||||
|
@ -1 +1 @@
|
||||
{"files":{".github/workflows/coverage.yml":"90aaa068c16cb778b24badaff78baf2a313637780a723be09596abde0f4c827a",".github/workflows/rust.yml":"905954be896d052ced621eedb9d5b9d35795490f27071ac1147e75ac3b3711ec","CHANGES.md":"5f54e553a1c4ef21c5be6109b25df9d1d63c4547627723fe044c73dbddf0db2f","Cargo.toml":"912553cc7b6024b0acbba42d6b64020fc98086596e99765ae95c1808ad0ab2d1","LICENSE":"ae48df11a335dc1a615f4f938b69cba73bcf4485c4f97af49b38efb0f216353b","README.md":"e14b7ddbd29b6f87d956921999da1cf7bc3add0166cacf21e8b1ac1d9092a90d","examples/draw.rs":"52fee9e2f2c11e1c891b30cb460be2a0ec65974f38dc0c08fd48391caf1e4247","examples/obj-output.rs":"6fc549022aa715eee74ea1cafb89ca33189e9dbe914ea6b2c46160049bda68f3","examples/simple.rs":"99fb566414cbd4a0eb69a2774c9780d7cd17e5cdaa14837b280fba319c053f22","notes":"48e636c646d697e213b3a79e31063e11b6ffc7493592d31f3929b1db495870b8","src/aacoverage.rs":"fdadadd208caa986cc386797f937a976b5a315174c7c0782b87c0334d6474a97","src/aarasterizer.rs":"c478fb04445bd27ed73b9c5d36e5ac088b0a9184047b7221b936dc51c6740cde","src/bezier.rs":"f089ab04e30077ce4e0fe59dfa602948b989aa53d51ad207fbc30c1edd24086b","src/c_bindings.rs":"9c5ab638cf0a14220d93528e37cdc0f6d83277eaa10acf9ce36f32a28e30c02b","src/fix.rs":"7ccf63db5bab4ab0135d92691f7c2272a27866b9792dd55ec98b2d1c1b7c0358","src/geometry_sink.rs":"9025569f77f475a1e47fd470e8f53dcdf88ef57e3a5b8a51268fff892da8b1a7","src/helpers.rs":"220294dac335943518f249c4a27ad803f8226ed62cd780f517e95be6343a1f2f","src/hwrasterizer.rs":"82b2d6d35488a6ad7de4d82f3ee38c6f09f4b6de06b4f98eea61b3abdd72eb62","src/hwvertexbuffer.rs":"f3dd54f17570eb530c9c827b24a53b755a2dfa6028e9b83f9d7a4ba9945c2ecf","src/lib.rs":"d08ea1d60a8ec02144bd002d2b1c96e88d736376bd3a28271212dd6cd6bfa42d","src/matrix.rs":"1ac44bc5d073f96ab64b1b5c6077fd0d47fe61db8243bd9a55fc91d8eae1dd92","src/notes":"d50d49e0b5660bc6350d8055f25f26700c937558de0af690e1fc4f50ed7e05c9","src/nullable_ref.rs":"789fe0e59b7d4a925faecbf2362be93643ea8382b4424ca0e60866f9bf83c3cd","src/real.rs":"73a2d1a77613364e9514fd7ead4d708a554d2b7343645cdb4cb8a2b3b640e057","src/tri_rasterize.rs":"30821a3465cea3c5ac578590013b530c03ea3010225f580d6cf609e39910c412","src/types.rs":"b840212a99a212ef38211aaf1bd801ec83416569541941d15fd95285d1342b99"},"package":null}
|
||||
{"files":{".github/workflows/coverage.yml":"90aaa068c16cb778b24badaff78baf2a313637780a723be09596abde0f4c827a",".github/workflows/rust.yml":"905954be896d052ced621eedb9d5b9d35795490f27071ac1147e75ac3b3711ec","CHANGES.md":"5f54e553a1c4ef21c5be6109b25df9d1d63c4547627723fe044c73dbddf0db2f","Cargo.toml":"912553cc7b6024b0acbba42d6b64020fc98086596e99765ae95c1808ad0ab2d1","LICENSE":"ae48df11a335dc1a615f4f938b69cba73bcf4485c4f97af49b38efb0f216353b","README.md":"e14b7ddbd29b6f87d956921999da1cf7bc3add0166cacf21e8b1ac1d9092a90d","examples/draw.rs":"52fee9e2f2c11e1c891b30cb460be2a0ec65974f38dc0c08fd48391caf1e4247","examples/obj-output.rs":"6fc549022aa715eee74ea1cafb89ca33189e9dbe914ea6b2c46160049bda68f3","examples/simple.rs":"99fb566414cbd4a0eb69a2774c9780d7cd17e5cdaa14837b280fba319c053f22","notes":"48e636c646d697e213b3a79e31063e11b6ffc7493592d31f3929b1db495870b8","src/aacoverage.rs":"fdadadd208caa986cc386797f937a976b5a315174c7c0782b87c0334d6474a97","src/aarasterizer.rs":"283bed1e22917118f332b24731cb6bd11334a4f0ba0d88821cfeb6b607de12da","src/bezier.rs":"f089ab04e30077ce4e0fe59dfa602948b989aa53d51ad207fbc30c1edd24086b","src/c_bindings.rs":"9c5ab638cf0a14220d93528e37cdc0f6d83277eaa10acf9ce36f32a28e30c02b","src/fix.rs":"7ccf63db5bab4ab0135d92691f7c2272a27866b9792dd55ec98b2d1c1b7c0358","src/geometry_sink.rs":"9025569f77f475a1e47fd470e8f53dcdf88ef57e3a5b8a51268fff892da8b1a7","src/helpers.rs":"220294dac335943518f249c4a27ad803f8226ed62cd780f517e95be6343a1f2f","src/hwrasterizer.rs":"82b2d6d35488a6ad7de4d82f3ee38c6f09f4b6de06b4f98eea61b3abdd72eb62","src/hwvertexbuffer.rs":"f3dd54f17570eb530c9c827b24a53b755a2dfa6028e9b83f9d7a4ba9945c2ecf","src/lib.rs":"8cd659ff6e2165884eaa1657462e1a5bf15a68a83cb768c2dff2f433ff0a022c","src/matrix.rs":"1ac44bc5d073f96ab64b1b5c6077fd0d47fe61db8243bd9a55fc91d8eae1dd92","src/notes":"d50d49e0b5660bc6350d8055f25f26700c937558de0af690e1fc4f50ed7e05c9","src/nullable_ref.rs":"789fe0e59b7d4a925faecbf2362be93643ea8382b4424ca0e60866f9bf83c3cd","src/real.rs":"73a2d1a77613364e9514fd7ead4d708a554d2b7343645cdb4cb8a2b3b640e057","src/tri_rasterize.rs":"30821a3465cea3c5ac578590013b530c03ea3010225f580d6cf609e39910c412","src/types.rs":"b840212a99a212ef38211aaf1bd801ec83416569541941d15fd95285d1342b99"},"package":null}
|
@ -1033,15 +1033,13 @@ fn ValidatePathTypes(typesArray: &[BYTE], mut count: INT) -> bool {
|
||||
// Advance to the first point after the 'start' point:
|
||||
count -= 1;
|
||||
if (count == 0) {
|
||||
//TraceTag!((tagMILWarning, "Path ended after start-path"));
|
||||
//return (false);
|
||||
return (true);
|
||||
TraceTag!((tagMILWarning, "Path ended after start-path"));
|
||||
return (false);
|
||||
}
|
||||
|
||||
if ((types[1] & PathPointTypePathTypeMask) == PathPointTypeStart) {
|
||||
//TraceTag!((tagMILWarning, "Can't have a start followed by a start!"));
|
||||
//return (false);
|
||||
return (true);
|
||||
TraceTag!((tagMILWarning, "Can't have a start followed by a start!"));
|
||||
return (false);
|
||||
}
|
||||
|
||||
// Process runs of lines and Bezier curves:
|
||||
|
27
third_party/rust/wpf-gpu-raster/src/lib.rs
vendored
27
third_party/rust/wpf-gpu-raster/src/lib.rs
vendored
@ -177,21 +177,18 @@ impl PathBuilder {
|
||||
self.curve_to(c1x, c1y, c2x, c2y, x, y);
|
||||
}
|
||||
pub fn close(&mut self) {
|
||||
if !self.in_shape {
|
||||
match self.initial_point {
|
||||
Some(initial_point) => {
|
||||
self.types.push(PathPointTypeStart);
|
||||
self.add_point(initial_point.X, initial_point.Y);
|
||||
self.in_shape = true;
|
||||
}
|
||||
None => return,
|
||||
}
|
||||
if self.in_shape {
|
||||
// Only close the path if we are inside a shape. Otherwise, the point
|
||||
// should be safe to elide.
|
||||
if let Some(last) = self.types.last_mut() {
|
||||
*last |= PathPointTypeCloseSubpath;
|
||||
}
|
||||
self.in_shape = false;
|
||||
}
|
||||
if let Some(last) = self.types.last_mut() {
|
||||
*last |= PathPointTypeCloseSubpath;
|
||||
}
|
||||
self.in_shape = false;
|
||||
self.initial_point = None;
|
||||
// Close must install a new initial point that is the same as the
|
||||
// initial point of the just-closed sub-path. Thus, just leave the
|
||||
// initial point unchanged.
|
||||
self.current_point = self.initial_point;
|
||||
}
|
||||
pub fn set_fill_mode(&mut self, fill_mode: FillMode) {
|
||||
self.fill_mode = fill_mode;
|
||||
@ -680,6 +677,8 @@ mod tests {
|
||||
#[test]
|
||||
fn close_after_move_to() {
|
||||
let mut p = PathBuilder::new();
|
||||
p.move_to(10., 0.);
|
||||
p.close();
|
||||
p.move_to(0., 0.);
|
||||
p.line_to(0., 10.);
|
||||
p.line_to(10., 10.);
|
||||
|
@ -91,7 +91,7 @@ localization-ffi = { path = "../../../../intl/l10n/rust/localization-ffi" }
|
||||
processtools = { path = "../../../components/processtools" }
|
||||
qcms = { path = "../../../../gfx/qcms", features = ["c_bindings", "neon"], default-features = false }
|
||||
|
||||
wpf-gpu-raster = { git = "https://github.com/FirefoxGraphics/wpf-gpu-raster", rev = "112a2140c433af06938c663fc6777e2bf17bb6ce" }
|
||||
wpf-gpu-raster = { git = "https://github.com/FirefoxGraphics/wpf-gpu-raster", rev = "5ab6fe33d00021325ee920b3c10526dc8301cf46" }
|
||||
aa-stroke = { git = "https://github.com/FirefoxGraphics/aa-stroke", rev = "07d3c25322518f294300e96246e09b95e118555d" }
|
||||
|
||||
# Force url to stay at 2.1.0. See bug 1734538.
|
||||
|
Loading…
Reference in New Issue
Block a user