Skip to content

Commit

Permalink
Avoid to rescale images if axes flipping is set in scale options
Browse files Browse the repository at this point in the history
This fixes GitHub issue <jheinen/GR.jl#527>.
  • Loading branch information
IngoMeyer441 committed Oct 11, 2023
1 parent 2e5e320 commit b9eafa6
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions lib/gr/gr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}

/*!
Expand Down

0 comments on commit b9eafa6

Please sign in to comment.