/*
- * $RCSId: $
+ * fontconfig/src/fcmatrix.c
*
* Copyright © 2000 Tuomas J. Lukka
*
* PERFORMANCE OF THIS SOFTWARE.
*/
+#include "fcint.h"
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
-#include "fcint.h"
-FcMatrix _id = { 1, 0, 0, 1 };
-const FcMatrixPtr FcIdentityMatrix = {
- .storage = FcStorageDynamic,
- .u.dyn = &_id
-};
+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)
return r;
}
-void
-FcMatrixPtrDestroy (FcMatrixPtr mi)
-{
- if (mi.storage == FcStorageDynamic)
- FcMatrixFree (mi.u.dyn);
-}
-
void
FcMatrixFree (FcMatrix *mat)
{
- if (mat != FcMatrixPtrU(FcIdentityMatrix))
+ if (mat != &FcIdentityMatrix)
{
FcMemFree (FC_MEM_MATRIX, sizeof (FcMatrix));
free (mat);
{
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;
r.yy = 1;
FcMatrixMultiply (m, &r, m);
}
-
-static FcMatrix * matrices = 0;
-static int matrix_ptr = 0, matrix_count = 0;
-
-void
-FcMatrixClearStatic (void)
-{
- matrices = 0;
- matrix_ptr = 0;
- matrix_count = 0;
-}
-
-FcMatrix *
-FcMatrixPtrU (FcMatrixPtr mi)
-{
- switch (mi.storage)
- {
- case FcStorageDynamic:
- return mi.u.dyn;
- case FcStorageStatic:
- return &matrices[mi.u.stat];
- default:
- return 0;
-
- }
-}
-
-FcMatrixPtr
-FcMatrixPtrCreateDynamic (FcMatrix *mi)
-{
- FcMatrixPtr new;
- new.storage = FcStorageDynamic;
- new.u.dyn = mi;
- return new;
-}
-
-FcBool
-FcMatrixPrepareSerialize(FcMatrix *m)
-{
- matrix_count++;
- return FcTrue;
-}
-
-FcMatrixPtr
-FcMatrixSerialize(FcMatrix *m)
-{
- FcMatrixPtr new;
-
- if (matrix_count == matrix_ptr)
- return FcMatrixPtrCreateDynamic(0);
-
- new.storage = FcStorageStatic;
- new.u.stat = matrix_ptr++;
- return new;
-}
-
+#define __fcmatrix__
+#include "fcaliastail.h"
+#undef __fcmatrix__