Fix crash when selections exceed the container's bounds

This commit is contained in:
Antonio Scandurra
2021-04-02 13:49:44 +02:00
parent ae447ca1d9
commit d10fc6ce3f
6 changed files with 40 additions and 11 deletions
+7 -1
View File
@@ -54,7 +54,13 @@ impl PathBuilder {
self.current = point;
}
pub fn build(self, color: ColorU) -> Path {
pub fn build(mut self, color: ColorU, clip_bounds: Option<RectF>) -> Path {
if let Some(clip_bounds) = clip_bounds {
self.bounds = self
.bounds
.intersection(clip_bounds)
.unwrap_or(RectF::default());
}
Path {
bounds: self.bounds,
color,