]> git.eshelyaron.com Git - emacs.git/commit
Fix overflow issues in image rotation
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 6 Jun 2019 15:09:58 +0000 (08:09 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 6 Jun 2019 15:10:31 +0000 (08:10 -0700)
commit7c26e0b18d0cdf656778d6dd332972b538491d95
tree48674c6c1658fb5e45d69ca99285480b8655fe82
parente29fb7dfba96e63cb7ba2d2a68f91f8dec336100
Fix overflow issues in image rotation

Also, do some refactoring to simplify code.
* src/dispextern.h (INIT_MATRIX, COPY_MATRIX, MULT_MATRICES): Remove.
* src/image.c (matrix3x3): New type, replacing all uses of 3x3 double.
(matrix3x3_copy, matrix3x3_mult): New functions, replacing
COPY_MATRIX, MULT_MATRICES.  Replace INIT_MATRIX by C initializers.
(image_set_rotation): Use Fmod to avoid undefined behavior on
double-to-int conversion and to reduce bignum rotations correctly.
(image_set_crop): Finish up previous correction, by not re-setting
width and height if compute_image_size has set them.
Prefer shifting right by 1 to dividing by 2 if either will do.
src/dispextern.h
src/image.c