VG_API_CALL void vgMultMatrix(const VGfloat * mm) { SHMatrix3x3 *m, mul, temp; VG_GETCONTEXT(VG_NO_RETVAL); VG_RETURN_ERR_IF(!mm, VG_ILLEGAL_ARGUMENT_ERROR, VG_NO_RETVAL); /* TODO: check matrix array alignment */ m = shCurrentMatrix(context); if (context->matrixMode == VG_MATRIX_IMAGE_USER_TO_SURFACE) { SETMAT(mul, mm[0], mm[3], mm[6], mm[1], mm[4], mm[7], mm[2], mm[5], mm[8]); } else { SETMAT(mul, mm[0], mm[3], mm[6], mm[1], mm[4], mm[7], 0.0f, 0.0f, 1.0f); } MULMATMAT((*m), mul, temp); SETMATMAT((*m), temp); VG_RETURN(VG_NO_RETVAL); }
VGboolean shIsTessCacheValid (VGContext *c, SHPath *p) { SHfloat nX, nY; SHVector2 X, Y; SHMatrix3x3 mi, mchange; VGboolean valid = VG_TRUE; if (p->cacheDataValid == VG_FALSE) { valid = VG_FALSE; } else if (p->cacheTransformInit == VG_FALSE) { valid = VG_FALSE; } else if (shInvertMatrix( &p->cacheTransform, &mi ) == VG_FALSE) { valid = VG_FALSE; } else { /* TODO: Compare change matrix for any scale or shear */ MULMATMAT( c->pathTransform, mi, mchange ); SET2( X, mi.m[0][0], mi.m[1][0] ); SET2( Y, mi.m[0][1], mi.m[1][1] ); nX = NORM2( X ); nY = NORM2( Y ); if (nX > 1.01f || nX < 0.99 || nY > 1.01f || nY < 0.99) valid = VG_FALSE; } if (valid == VG_FALSE) { /* Update cache */ p->cacheDataValid = VG_TRUE; p->cacheTransformInit = VG_TRUE; p->cacheTransform = c->pathTransform; p->cacheStrokeTessValid = VG_FALSE; } return valid; }