Commit cddeee6
committed
fix(tauri): correct screenshot rect on Windows under DPI scaling
GDI APIs (GetClientRect, PrintWindow, GetDIBits) operate in physical
pixels for DPI-aware processes, but the JS caller sends the capture
rect in CSS pixels (scaled only by the webview zoom factor, not the
OS DPI). At Windows display scaling >100%, this produced screenshots
that were both shifted and undersized.
Multiply the incoming rect by window.scale_factor() (the OS DPI scale,
e.g. 1.25 at 125% scaling) before clamping to the physical client area.
macOS is unaffected because WKSnapshotConfiguration.setRect takes view
points, which map 1:1 to CSS pixels. Electron (Linux) is unaffected
because capturePage already accepts CSS-pixel rects.1 parent 97f68e7 commit cddeee6
1 file changed
Lines changed: 11 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
538 | 538 | | |
539 | 539 | | |
540 | 540 | | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
541 | 546 | | |
542 | 547 | | |
543 | 548 | | |
| |||
584 | 589 | | |
585 | 590 | | |
586 | 591 | | |
587 | | - | |
| 592 | + | |
| 593 | + | |
588 | 594 | | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
593 | 599 | | |
594 | 600 | | |
595 | 601 | | |
| |||
0 commit comments