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