]> git.wh0rd.org - fontconfig.git/blobdiff - src/fcmatrix.c
Bug 44826 - <alias> must contain only a single <family>
[fontconfig.git] / src / fcmatrix.c
index d2a9f1ed7f45e59f982bd1642d61f6083bd9f124..f0c61391864040e64bca2e169a9b7be5a9c391c2 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * $XFree86: $
+ * fontconfig/src/fcmatrix.c
  *
- * Copyright © 2000 Tuomas J. Lukka
+ * Copyright Â© 2000 Tuomas J. Lukka
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include "fcint.h"
 #include <math.h>
 #include <stdlib.h>
 #include <ctype.h>
-#include "fcint.h"
+
+const FcMatrix    FcIdentityMatrix = { 1, 0, 0, 1 };
 
 FcMatrix *
-FcMatrixCopy (const FcMatrix *mat) 
+FcMatrixCopy (const FcMatrix *mat)
 {
     FcMatrix *r;
-    if(!mat) 
+    if(!mat)
        return 0;
     r = (FcMatrix *) malloc (sizeof (*r) );
     if (!r)
@@ -44,8 +46,11 @@ FcMatrixCopy (const FcMatrix *mat)
 void
 FcMatrixFree (FcMatrix *mat)
 {
-    FcMemFree (FC_MEM_MATRIX, sizeof (FcMatrix));
-    free (mat);
+    if (mat != &FcIdentityMatrix)
+    {
+       FcMemFree (FC_MEM_MATRIX, sizeof (FcMatrix));
+       free (mat);
+    }
 }
 
 FcBool
@@ -53,7 +58,7 @@ FcMatrixEqual (const FcMatrix *mat1, const FcMatrix *mat2)
 {
     if(mat1 == mat2) return FcTrue;
     if(mat1 == 0 || mat2 == 0) return FcFalse;
-    return mat1->xx == mat2->xx && 
+    return mat1->xx == mat2->xx &&
           mat1->xy == mat2->xy &&
           mat1->yx == mat2->yx &&
           mat1->yy == mat2->yy;
@@ -110,3 +115,6 @@ FcMatrixShear (FcMatrix *m, double sh, double sv)
     r.yy = 1;
     FcMatrixMultiply (m, &r, m);
 }
+#define __fcmatrix__
+#include "fcaliastail.h"
+#undef __fcmatrix__