diff options
| author | YAMAMOTO Mitsuharu | 2019-06-17 10:43:31 +0900 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2019-06-17 10:43:31 +0900 |
| commit | 8c56eb0525c22acee713434840c2ef0a1a3811cc (patch) | |
| tree | 4d2c2bd7f292cab24a7d60ce6728249f0da4cd1c /src | |
| parent | 421220e2946dadab77fbfc79cf4f0daa49961c41 (diff) | |
| download | emacs-8c56eb0525c22acee713434840c2ef0a1a3811cc.tar.gz emacs-8c56eb0525c22acee713434840c2ef0a1a3811cc.zip | |
Avoid rounding error in image rotation
* src/image.c (image_set_rotation): Halve translations as double values.
Diffstat (limited to 'src')
| -rw-r--r-- | src/image.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/image.c b/src/image.c index a3747cfa6b7..c08b898e7d8 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -2139,7 +2139,7 @@ image_set_rotation (struct image *img, matrix3x3 tm) | |||
| 2139 | matrix3x3 t | 2139 | matrix3x3 t |
| 2140 | = { [0][0] = 1, | 2140 | = { [0][0] = 1, |
| 2141 | [1][1] = 1, | 2141 | [1][1] = 1, |
| 2142 | [2][0] = img->width >> 1, [2][1] = img->height >> 1, [2][2] = 1 }; | 2142 | [2][0] = img->width * .5, [2][1] = img->height * .5, [2][2] = 1 }; |
| 2143 | matrix3x3 tmp; | 2143 | matrix3x3 tmp; |
| 2144 | matrix3x3_mult (t, tm, tmp); | 2144 | matrix3x3_mult (t, tm, tmp); |
| 2145 | 2145 | ||
| @@ -2151,8 +2151,8 @@ image_set_rotation (struct image *img, matrix3x3 tm) | |||
| 2151 | matrix3x3_mult (rot, tmp, tmp2); | 2151 | matrix3x3_mult (rot, tmp, tmp2); |
| 2152 | 2152 | ||
| 2153 | /* Translate back. */ | 2153 | /* Translate back. */ |
| 2154 | t[2][0] = - (width >> 1); | 2154 | t[2][0] = - (width * .5); |
| 2155 | t[2][1] = - (height >> 1); | 2155 | t[2][1] = - (height * .5); |
| 2156 | matrix3x3_mult (t, tmp2, tm); | 2156 | matrix3x3_mult (t, tmp2, tm); |
| 2157 | 2157 | ||
| 2158 | img->width = width; | 2158 | img->width = width; |