[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 8c56eb0: Avoid rounding error in image rotation
From: |
YAMAMOTO Mitsuharu |
Subject: |
[Emacs-diffs] master 8c56eb0: Avoid rounding error in image rotation |
Date: |
Sun, 16 Jun 2019 21:44:28 -0400 (EDT) |
branch: master
commit 8c56eb0525c22acee713434840c2ef0a1a3811cc
Author: YAMAMOTO Mitsuharu <address@hidden>
Commit: YAMAMOTO Mitsuharu <address@hidden>
Avoid rounding error in image rotation
* src/image.c (image_set_rotation): Halve translations as double values.
---
src/image.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/image.c b/src/image.c
index a3747cf..c08b898 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2139,7 +2139,7 @@ image_set_rotation (struct image *img, matrix3x3 tm)
matrix3x3 t
= { [0][0] = 1,
[1][1] = 1,
- [2][0] = img->width >> 1, [2][1] = img->height >> 1, [2][2] = 1 };
+ [2][0] = img->width * .5, [2][1] = img->height * .5, [2][2] = 1 };
matrix3x3 tmp;
matrix3x3_mult (t, tm, tmp);
@@ -2151,8 +2151,8 @@ image_set_rotation (struct image *img, matrix3x3 tm)
matrix3x3_mult (rot, tmp, tmp2);
/* Translate back. */
- t[2][0] = - (width >> 1);
- t[2][1] = - (height >> 1);
+ t[2][0] = - (width * .5);
+ t[2][1] = - (height * .5);
matrix3x3_mult (t, tmp2, tm);
img->width = width;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 8c56eb0: Avoid rounding error in image rotation,
YAMAMOTO Mitsuharu <=