Fix screenshot offset after pixel-exact crop change
The new CGImage.cropping path expects a top-left pixel rect; the previous
CGContext redraw had implicitly flipped Y. Keep the existing SCDisplay-space
conversion so the crop matches the selected region.
💘 Generated with Crush
Assisted-by: Crush:deepseek-v4-flash-0731
This commit is contained in:
@@ -124,6 +124,9 @@ final class ScreenCapture {
|
||||
let scaleX = CGFloat(image.width) / display.frame.width
|
||||
let scaleY = CGFloat(image.height) / display.frame.height
|
||||
guard scaleX > 0, scaleY > 0 else { return nil }
|
||||
// pxRect is in image pixel space with a TOP-LEFT origin (SCDisplay space).
|
||||
// CGImage.cropping(to:) expects the same top-left rect, so no Y flip
|
||||
// is needed here — this preserves the previous CGContext behavior.
|
||||
let pxRect = CGRect(
|
||||
x: (cgRect.minX - display.frame.minX) * scaleX,
|
||||
y: (cgRect.minY - display.frame.minY) * scaleY,
|
||||
|
||||
Reference in New Issue
Block a user