## "Fossies" - the Fresh Open Source Software Archive

### Source code changes of the file "src/gd_matrix.c" betweenlibgd-2.3.2.tar.gz and libgd-2.3.3.tar.gz

About: LibGD is a library for the dynamic creation of images by programmers (PNG, JPEG, GIF, WebP, XPM, BMP support).

gd_matrix.c  (libgd-2.3.2):gd_matrix.c  (libgd-2.3.3)
skipping to change at line 15 skipping to change at line 15
#include "gd.h" #include "gd.h"
#include <math.h> #include <math.h>
#ifndef M_PI #ifndef M_PI
# define M_PI 3.14159265358979323846 # define M_PI 3.14159265358979323846
#endif #endif
/** /**
* Title: Matrix * Title: Matrix
* Group: Affine Matrix * Group: Affine Matrix
*/ *
* Matrix functions to initialize, transform and various other operations
* on these matrices.
* They can be used with gdTransformAffineCopy and are also used in various
* transformations functions in GD.
*
* matrix are create using a 6 elements double array:
* (start code)
* matrix[0] == xx
* matrix[1] == yx
* matrix[2] == xy
* matrix[3] == xy
* matrix[4] == x0
* matrix[5] == y0
* (end code)
* where the transformation of a given point (x,y) is given by:
*
* (start code)
* x_new = xx * x + xy * y + x0;
* y_new = yx * x + yy * y + y0;
* (end code)
*/
/** /**
* Function: gdAffineApplyToPointF * Function: gdAffineApplyToPointF
* Applies an affine transformation to a point (floating point * Applies an affine transformation to a point (floating point
* gdPointF) * gdPointF)
* *
* *
* Parameters: * Parameters:
* dst - Where to store the resulting point * dst - Where to store the resulting point
* affine - Source Point * affine - Source Point
skipping to change at line 66 skipping to change at line 87
* <gdAffineIdentity> * <gdAffineIdentity>
* *
* Returns: * Returns:
* GD_TRUE on success or GD_FALSE on failure * GD_TRUE on success or GD_FALSE on failure
*/ */
BGD_DECLARE(int) gdAffineInvert (double dst[6], const double src[6]) BGD_DECLARE(int) gdAffineInvert (double dst[6], const double src[6])
{ {
double r_det = (src[0] * src[3] - src[1] * src[2]); double r_det = (src[0] * src[3] - src[1] * src[2]);
if { if (!isfinite(r_det)) {
return GD_FALSE;
}
if (r_det == 0) {
return GD_FALSE; return GD_FALSE;
} }
r_det = 1.0 / r_det; r_det = 1.0 / r_det;
dst[0] = src[3] * r_det; dst[0] = src[3] * r_det;
dst[1] = -src[1] * r_det; dst[1] = -src[1] * r_det;
dst[2] = -src[2] * r_det; dst[2] = -src[2] * r_det;
dst[3] = src[0] * r_det; dst[3] = src[0] * r_det;
dst[4] = -src[4] * dst[0] - src[5] * dst[2]; dst[4] = -src[4] * dst[0] - src[5] * dst[2];
dst[5] = -src[4] * dst[1] - src[5] * dst[3]; dst[5] = -src[4] * dst[1] - src[5] * dst[3];
End of changes. 2 change blocks.
2 lines changed or deleted 26 lines changed or added