Preserve Z when converting 3x3 to 4x4 matrix

Bug: chromium:1335249
Change-Id: I441d48fd97e0fccfb25de2bd4a2d8006c2e80ce7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549038
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
Brian Osman 2022-06-10 11:14:32 -04:00 committed by SkCQ
parent 91f158c825
commit 2679cf9abf
3 changed files with 10 additions and 9 deletions

View File

@ -284,7 +284,8 @@ function copy4x4MatrixToWasm(matr) {
// skip col 2
wasm4x4Matrix[7] = matr[5];
// skip row 2
// row2 == identity
wasm4x4Matrix[10] = 1;
wasm4x4Matrix[12] = matr[6];
wasm4x4Matrix[13] = matr[7];

View File

@ -775,12 +775,12 @@ describe('Canvas Behavior', () => {
);
expect3x3MatricesToMatch(expected, matr);
// The 3x3 should be expanded into a 4x4, with 0s in the 3rd row and column.
// The 3x3 should be expanded into a 4x4, with identity in the 3rd row and column.
matr = canvas.getLocalToDevice();
expect4x4MatricesToMatch([
0.707106, -0.707106, 0, 7.071067,
0.707106, 0.707106, 0, 21.213203,
0 , 0 , 0, 0 ,
0 , 0 , 1, 0 ,
0 , 0 , 0, 1 ], matr);
});
@ -807,13 +807,13 @@ describe('Canvas Behavior', () => {
0, 0, 1];
expect3x3MatricesToMatch(expected, matr);
// The 3x2 should be expanded into a 4x4, with 0s in the 3rd row and column
// The 3x2 should be expanded into a 4x4, with identity in the 3rd row and column
// and the perspective filled in.
matr = canvas.getLocalToDevice();
expect4x4MatricesToMatch([
1.4, -0.2, 0, 12,
0.2, 1.4, 0, 24,
0 , 0 , 0, 0,
0 , 0 , 1, 0,
0 , 0 , 0, 1], matr);
});

View File

@ -775,12 +775,12 @@ describe('Canvas Behavior', () => {
);
expect3x3MatricesToMatch(expected, matr);
// The 3x3 should be expanded into a 4x4, with 0s in the 3rd row and column.
// The 3x3 should be expanded into a 4x4, with identity in the 3rd row and column.
matr = canvas.getLocalToDevice();
expect4x4MatricesToMatch([
0.707106, -0.707106, 0, 7.071067,
0.707106, 0.707106, 0, 21.213203,
0 , 0 , 0, 0 ,
0 , 0 , 1, 0 ,
0 , 0 , 0, 1 ], matr);
});
@ -807,13 +807,13 @@ describe('Canvas Behavior', () => {
0, 0, 1];
expect3x3MatricesToMatch(expected, matr);
// The 3x2 should be expanded into a 4x4, with 0s in the 3rd row and column
// The 3x2 should be expanded into a 4x4, with identity in the 3rd row and column
// and the perspective filled in.
matr = canvas.getLocalToDevice();
expect4x4MatricesToMatch([
1.4, -0.2, 0, 12,
0.2, 1.4, 0, 24,
0 , 0 , 0, 0,
0 , 0 , 1, 0,
0 , 0 , 0, 1], matr);
});