70 static constexpr SkV4 kNoPerspective = {0.f, 0.f, 0.f, 1.f};
71 static constexpr SkV4 kNoZ = {0.f, 0.f, 1.f, 0.f};
72 if (m.row(3) != kNoPerspective) {
75 if (m.invert(&fInvM)) {
81 }
else if (m.col(2) != kNoZ || m.row(2) != kNoZ) {
84 if (m.invert(&fInvM)) {
88 std::tie(fMinScaleFactor, fMaxScaleFactor) = compute_svd(m.rc(0,0), m.rc(0,1),
89 m.rc(1,0), m.rc(1,1));
102 const float sx = m.rc(0, 0);
103 const float sy = m.rc(1, 1);
104 const float kx = m.rc(0, 1);
105 const float ky = m.rc(1, 0);
106 const float tx = m.rc(0, 3);
107 const float ty = m.rc(1, 3);
108 if (kx == 0.f && ky == 0.f) {
110 if (sx == 0.f || sy == 0.f) {
113 }
else if (sx == 1.f && sy == 1.f && tx == 0.f && ty == 0.f) {
117 const float ix = 1.f / sx;
118 const float iy = 1.f / sy;
121 fInvM =
SkM44(ix, 0.f, 0.f, -ix*tx,
122 0.f, iy, 0.f, -iy*ty,
125 std::tie(fMinScaleFactor, fMaxScaleFactor) = sort_scale(sx, sy);
127 }
else if (sx == 0.f && sy == 0.f) {
130 if (kx == 0.f || ky == 0.f) {
134 const float ix = 1.f / kx;
135 const float iy = 1.f / ky;
137 fInvM =
SkM44(0.f, iy, 0.f, -iy*ty,
138 ix, 0.f, 0.f, -ix*tx,
141 std::tie(fMinScaleFactor, fMaxScaleFactor) = sort_scale(kx, ky);
145 float upper[4] = {sx, ky, kx, sy};
152 fInvM =
SkM44(invUpper[0], invUpper[2], 0.f, -invUpper[0]*tx - invUpper[2]*ty,
153 invUpper[1], invUpper[3], 0.f, -invUpper[1]*tx - invUpper[3]*ty,
156 std::tie(fMinScaleFactor, fMaxScaleFactor) = compute_svd(sx, kx, ky, sy);
219 min = fMinScaleFactor;
222 float tl = std::get<0>(this->
scaleFactors(
SkV2{bounds.left(), bounds.top()}));
223 float tr = std::get<0>(this->
scaleFactors(
SkV2{bounds.right(), bounds.top()}));
224 float br = std::get<0>(this->
scaleFactors(
SkV2{bounds.right(), bounds.bot()}));
225 float bl = std::get<0>(this->
scaleFactors(
SkV2{bounds.left(), bounds.bot()}));
226 min = std::min(std::min(tl, tr), std::min(br, bl));