From 757ca510aacc8b75304351a6899fad64872d667c Mon Sep 17 00:00:00 2001 From: Marek Kasik Date: Mon, 23 Jun 2014 15:11:26 +0200 Subject: [PATCH] Change direction of rotation Convert rotation from clockwise direction as expected by libspectre to counter-clockwise direction as expected by the "rotate" operator. https://bugs.freedesktop.org/show_bug.cgi?id=76450 --- libspectre/spectre-gs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libspectre/spectre-gs.c b/libspectre/spectre-gs.c index adbc7ef..9193975 100644 --- a/libspectre/spectre-gs.c +++ b/libspectre/spectre-gs.c @@ -121,7 +121,8 @@ spectre_gs_process (SpectreGS *gs, if (rotation != 0) { char *set; - set = _spectre_strdup_printf ("%d rotate", rotation); + /* Convert clockwise direction to counter-clockwise direction */ + set = _spectre_strdup_printf ("%d rotate", (360 - rotation) % 360); error = gsapi_run_string_continue (ghostscript_instance, set, strlen (set), 0, &exit_code); error = error == e_NeedInput ? 0 : error; @@ -255,16 +256,16 @@ spectre_gs_send_page (SpectreGS *gs, tmp_yoffset = yoffset + y; break; case 90: - tmp_xoffset = - (yoffset + y + crop_height); - tmp_yoffset = xoffset + x; + tmp_xoffset = yoffset + y; + tmp_yoffset = - (xoffset + x + crop_width); break; case 180: tmp_xoffset = - (xoffset + x + crop_width); tmp_yoffset = - (yoffset + y + crop_height); break; case 270: - tmp_xoffset = yoffset + y; - tmp_yoffset = - (xoffset + x + crop_width); + tmp_xoffset = - (yoffset + y + crop_height); + tmp_yoffset = xoffset + x; break; } -- 1.9.3