1 /* 2 * Copyright 2021 Google LLC 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkMatrixInvert_DEFINED 9 #define SkMatrixInvert_DEFINED 10 11 #include "include/core/SkScalar.h" 12 13 /** 14 * Computes the inverse of `inMatrix`, passed in column-major order. 15 * `inMatrix` and `outMatrix` are allowed to point to the same array of scalars in memory. 16 * `outMatrix` is allowed to be null. 17 * The return value is the determinant of the input matrix. If zero is returned, the matrix was 18 * non-invertible, and `outMatrix` has been left in an indeterminate state. 19 */ 20 SkScalar SkInvert2x2Matrix(const SkScalar inMatrix[4], SkScalar outMatrix[4]); 21 SkScalar SkInvert3x3Matrix(const SkScalar inMatrix[9], SkScalar outMatrix[9]); 22 SkScalar SkInvert4x4Matrix(const SkScalar inMatrix[16], SkScalar outMatrix[16]); 23 24 #endif 25