From b9eafa6e8e46bde3936995e89cd031a7413daa4c Mon Sep 17 00:00:00 2001 From: Ingo Meyer Date: Wed, 11 Oct 2023 14:07:23 +0200 Subject: [PATCH] Avoid to rescale images if axes flipping is set in scale options This fixes GitHub issue . --- lib/gr/gr.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/gr/gr.c b/lib/gr/gr.c index 5b661a428..e129061cd 100644 --- a/lib/gr/gr.c +++ b/lib/gr/gr.c @@ -11000,11 +11000,11 @@ static void drawimage_calculation(double xmin, double xmax, double ymin, double } } - if (lx.scale_options != 0) + if ((lx.scale_options & ~(OPTION_FLIP_X | OPTION_FLIP_Y | OPTION_FLIP_Z)) != 0) { linear_xform lx_original; - w = max(width, 500); - h = max(height, 500); + w = max(width, 2000); + h = max(height, 2000); lx_original = lx; lx.xmin = xmin; lx.xmax = xmax; @@ -11059,7 +11059,21 @@ static void drawimage_calculation(double xmin, double xmax, double ymin, double free(imgT); } else - gks_draw_image(xmin, ymax, xmax, ymin, width, height, img); + { + if (lx.scale_options & OPTION_FLIP_X) + { + double tmp = xmin; + xmin = xmax; + xmax = tmp; + } + if (lx.scale_options & OPTION_FLIP_Y) + { + double tmp = ymin; + ymin = ymax; + ymax = tmp; + } + gks_draw_image(xmin, ymax, xmax, ymin, width, height, img); + } } /*!