(&mut self, device: &Device, points: &[Point], series: &[SeriesSpan])
| 529 | } |
| 530 | |
| 531 | fn poll_pending(&mut self, device: &Device, points: &[Point], series: &[SeriesSpan]) { |
| 532 | let Some(pending) = self.pending.as_ref() else { |
| 533 | return; |
| 534 | }; |
| 535 | |
| 536 | let _ = device.poll(PollType::Poll); |
| 537 | let Some(res) = pending.map_status.lock().unwrap().take() else { |
| 538 | return; |
| 539 | }; |
| 540 | |
| 541 | let hit = match res { |
| 542 | Ok(()) => { |
| 543 | let buf = self.staging.as_ref().unwrap(); |
| 544 | let slice = buf.slice(0..pending.needed); |
| 545 | let data = slice.get_mapped_range(); |
| 546 | let best = Self::scan_best_id( |
| 547 | &data, |
| 548 | pending.bytes_per_row, |
| 549 | pending.max_w, |
| 550 | pending.max_h, |
| 551 | pending.min_x, |
| 552 | pending.min_y, |
| 553 | pending.cx, |
| 554 | pending.cy, |
| 555 | ); |
| 556 | drop(data); |
| 557 | buf.unmap(); |
| 558 | best.and_then(|(id, _)| self.decode_id_to_hit(id, points, series)) |
| 559 | } |
| 560 | Err(_) => { |
| 561 | if let Some(buf) = self.staging.as_ref() { |
| 562 | buf.unmap(); |
| 563 | } |
| 564 | None |
| 565 | } |
| 566 | }; |
| 567 | |
| 568 | publish_result( |
| 569 | pending.instance_id, |
| 570 | GpuPickResult { |
| 571 | seq: pending.seq, |
| 572 | hit, |
| 573 | }, |
| 574 | ); |
| 575 | |
| 576 | self.pending = None; |
| 577 | } |
| 578 | |
| 579 | #[allow(clippy::too_many_arguments)] |
| 580 | fn scan_best_id( |
no test coverage detected