Mercurial > octave
changeset 33335:d624140ffd1b stable
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.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 05 Apr 2024 16:48:08 +0200 |
parents | a2a202991cc7 |
children | 5a884e88d122 35ac89ffcf7c |
files | scripts/image/getframe.m |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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", []);