X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=src%2Ffcmatrix.c;h=f0c61391864040e64bca2e169a9b7be5a9c391c2;hb=HEAD;hp=6a5aa5dd8fa6b71b79f298ae7ad9d0e1b7dcae8d;hpb=cd2ec1a940888ebcbd323a8000d2fcced41ddf9e;p=fontconfig.git diff --git a/src/fcmatrix.c b/src/fcmatrix.c index 6a5aa5d..f0c6139 100644 --- a/src/fcmatrix.c +++ b/src/fcmatrix.c @@ -1,5 +1,5 @@ /* - * $RCSId: $ + * fontconfig/src/fcmatrix.c * * Copyright © 2000 Tuomas J. Lukka * @@ -22,22 +22,18 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#include "fcint.h" #include #include #include -#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) @@ -47,17 +43,10 @@ FcMatrixCopy (const FcMatrix *mat) 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); @@ -69,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; @@ -126,59 +115,6 @@ FcMatrixShear (FcMatrix *m, double sh, double sv) 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__