# HG changeset patch # User Markus Mützel # Date 1712328488 -7200 # Node ID d624140ffd1b11acdc6cfd6945a2bc3efd8698ae # Parent a2a202991cc78cbdc4cf5b9ee4013520a3cbce13 getframe.m: Respect pixel ratio of screen with figure (bug #65540). * scripts/image/getframe.m: The data returned by "__get_frame__" is in physical pixels. But figure positions in Octave are measured in logical pixels. Take a potential conversion factor into account when cropping the captured data. diff -r a2a202991cc7 -r d624140ffd1b scripts/image/getframe.m --- a/scripts/image/getframe.m Thu Apr 04 22:49:38 2024 -0400 +++ b/scripts/image/getframe.m Fri Apr 05 16:48:08 2024 +0200 @@ -114,11 +114,12 @@ set (hf, "units", units) end_unwind_protect + dpr = get (hf, "__device_pixel_ratio__"); i1 = max (floor (pos(1)), 1); - i2 = min (ceil (pos(1)+pos(3)-1), columns (cdata)); + i2 = min (ceil ((pos(1)+pos(3)-1)*dpr), columns (cdata)); idxx = i1:i2; i1 = max (floor (pos(2)), 1); - i2 = min (ceil (pos(2)+pos(4)-1), rows (cdata)); + i2 = min (ceil ((pos(2)+pos(4)-1)*dpr), rows (cdata)); idxy = fliplr (rows (cdata) - (i1:i2) + 1); frame = struct ("cdata", cdata(idxy,idxx,:), "colormap", []);