# HG changeset patch # User Markus Mützel # Date 1712328488 -7200 # Fri Apr 05 16:48:08 2024 +0200 # Node ID 1698cba356382b3558ace202861e405962fcc4f8 # Parent 000e4454fbcce2f11d04a9aa406a34390149848d 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 000e4454fbcc -r 1698cba35638 scripts/image/getframe.m --- a/scripts/image/getframe.m Fri Apr 05 15:22:40 2024 +0200 +++ 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", []);