Skip to content
Permalink
Browse files

Keep is_point_in_path using a path, rather than a path builder.

  • Loading branch information...
jdm committed Feb 7, 2019
1 parent 2c5a6eb commit decf88331b4c5b5cb055b25ca2b5c4214c41b363
Showing with 6 additions and 11 deletions.
  1. +6 −11 components/canvas/canvas_data.rs
@@ -439,19 +439,14 @@ impl<'a> CanvasData<'a> {
chan: IpcSender<bool>,
) {
self.ensure_path();
let (result, new_state) = match *self.path_state.as_mut().unwrap() {
PathState::UserSpacePath(ref path, ref mut transform) => {
let result = {
let path_transform = transform.as_ref().unwrap_or(&self.state.transform);
path.contains_point(x, y, path_transform)
};
let state = PathState::UserSpacePathBuilder(path.copy_to_builder(), transform.take());
(result, state)
let result = match self.path_state.as_ref() {
Some(PathState::UserSpacePath(ref path, ref transform)) => {
let target_transform = self.drawtarget.get_transform();
let path_transform = transform.as_ref().unwrap_or(&target_transform);
path.contains_point(x, y, path_transform)
}
PathState::UserSpacePathBuilder(..) |
PathState::DeviceSpacePathBuilder(..) => unreachable!(),
Some(_) | None => false,
};
self.path_state = Some(new_state);
chan.send(result).unwrap();
}

0 comments on commit decf883

Please sign in to comment.
You can’t perform that action at this time.