856 {
857 SkMatrix mat, inverse, iden1, iden2;
858
864
870
876
886
893
894
895 mat.
setAll(0.0f, 1.0f, 2.0f,
896 0.0f, 1.0f, -3.40277175e+38f,
897 1.00003040f, 1.0f, 0.0f);
900
901
902 {
903 static const struct {
905 bool mStaysRect;
906 }
907 gRectStaysRectSamples[] = {
908 { 0, 0, 0, 0, false },
909 { 0, 0, 0, 1, false },
910 { 0, 0, 1, 0, false },
911 { 0, 0, 1, 1, false },
912 { 0, 1, 0, 0, false },
913 { 0, 1, 0, 1, false },
914 { 0, 1, 1, 0, true },
915 { 0, 1, 1, 1, false },
916 { 1, 0, 0, 0, false },
917 { 1, 0, 0, 1, true },
918 { 1, 0, 1, 0, false },
919 { 1, 0, 1, 1, false },
920 { 1, 1, 0, 0, false },
921 { 1, 1, 0, 1, false },
922 { 1, 1, 1, 0, false },
923 { 1, 1, 1, 1, false }
924 };
925
926 for (size_t i = 0; i < std::size(gRectStaysRectSamples); i++) {
928
935 m.rectStaysRect() == gRectStaysRectSamples[i].mStaysRect);
936 }
937 }
938
948
949 #define affineEqual(e) affine[SkMatrix::kA##e] == mat.get(SkMatrix::kM##e)
956 #undef affineEqual
957
960
967
973
980
982
986}
static void test_set9(skiatest::Reporter *reporter)
static void test_matrix_recttorect(skiatest::Reporter *reporter)
static void test_matrix_preserve_shape(skiatest::Reporter *reporter)
static void test_matrix_homogeneous(skiatest::Reporter *reporter)
static void test_flatten(skiatest::Reporter *reporter, const SkMatrix &m)
static bool are_equal(skiatest::Reporter *reporter, const SkMatrix &a, const SkMatrix &b)
static void test_matrix_decomposition(skiatest::Reporter *reporter)
static void test_matrix_min_max_scale(skiatest::Reporter *reporter)
static bool is_identity(const SkMatrix &m)
static void test_decompScale(skiatest::Reporter *reporter)
SkMatrix & postTranslate(SkScalar dx, SkScalar dy)
SkMatrix & postRotate(SkScalar degrees, SkScalar px, SkScalar py)
static constexpr int kMTransY
vertical translation
static constexpr int kMPersp1
input y perspective factor
SkMatrix & setAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar persp0, SkScalar persp1, SkScalar persp2)
SkMatrix & set(int index, SkScalar value)
void setScaleTranslate(SkScalar sx, SkScalar sy, SkScalar tx, SkScalar ty)
bool asAffine(SkScalar affine[6]) const
SkMatrix & setTranslate(SkScalar dx, SkScalar dy)
SkMatrix & setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
bool invert(SkMatrix *inverse) const
static constexpr int kMTransX
horizontal translation
SkMatrix & setConcat(const SkMatrix &a, const SkMatrix &b)