Commit 7ddf40b7 authored by Michael Natterer's avatar Michael Natterer 😴

app: make sure the display is not rotated by a very small angle

gimp_display_shell_rotate_update_transform(): reliably set rotation to
0.0 using an epsilon of 1e-3.
parent c144cf69
......@@ -36,6 +36,9 @@
#include "gimpdisplayshell-transform.h"
#define ANGLE_EPSILON 1e-3
/* local function prototypes */
static void gimp_display_shell_save_viewport_center (GimpDisplayShell *shell,
......@@ -168,8 +171,12 @@ gimp_display_shell_rotate_update_transform (GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_free (shell->rotate_transform);
g_free (shell->rotate_untransform);
g_clear_pointer (&shell->rotate_transform, g_free);
g_clear_pointer (&shell->rotate_untransform, g_free);
if (fabs (shell->rotate_angle) < ANGLE_EPSILON ||
fabs (360.0 - shell->rotate_angle) < ANGLE_EPSILON)
shell->rotate_angle = 0.0;
if ((shell->rotate_angle != 0.0 ||
shell->flip_horizontally ||
......@@ -205,11 +212,6 @@ gimp_display_shell_rotate_update_transform (GimpDisplayShell *shell)
*shell->rotate_untransform = *shell->rotate_transform;
cairo_matrix_invert (shell->rotate_untransform);
}
else
{
shell->rotate_transform = NULL;
shell->rotate_untransform = NULL;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment