Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9a946476
Commit
9a946476
authored
May 14, 2023
by
Bartosz Kosiorek
Committed by
Alexandre Julliard
May 18, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Improve performance of GdipInvertMatrix.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53947
parent
e308b19a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
18 deletions
+21
-18
matrix.c
dlls/gdiplus/matrix.c
+21
-18
No files found.
dlls/gdiplus/matrix.c
View file @
9a946476
...
...
@@ -182,38 +182,41 @@ GpStatus WINGDIPAPI GdipInvertMatrix(GpMatrix *matrix)
{
GpMatrix
copy
;
REAL
det
;
BOOL
invertible
;
TRACE
(
"(%p)
\n
"
,
matrix
);
if
(
!
matrix
)
return
InvalidParameter
;
GdipIsMatrixInvertible
(
matrix
,
&
invertible
);
if
(
!
invertible
)
return
InvalidParameter
;
/* optimize inverting simple scaling and translation matrices */
if
(
matrix
->
matrix
[
1
]
==
0
&&
matrix
->
matrix
[
2
]
==
0
)
{
matrix
->
matrix
[
4
]
=
-
matrix
->
matrix
[
4
]
/
matrix
->
matrix
[
0
];
matrix
->
matrix
[
5
]
=
-
matrix
->
matrix
[
5
]
/
matrix
->
matrix
[
3
];
matrix
->
matrix
[
0
]
=
1
/
matrix
->
matrix
[
0
];
matrix
->
matrix
[
3
]
=
1
/
matrix
->
matrix
[
3
];
return
Ok
;
if
(
matrix
->
matrix
[
0
]
!=
0
&&
matrix
->
matrix
[
3
]
!=
0
)
{
matrix
->
matrix
[
4
]
=
-
matrix
->
matrix
[
4
]
/
matrix
->
matrix
[
0
];
matrix
->
matrix
[
5
]
=
-
matrix
->
matrix
[
5
]
/
matrix
->
matrix
[
3
];
matrix
->
matrix
[
0
]
=
1
/
matrix
->
matrix
[
0
];
matrix
->
matrix
[
3
]
=
1
/
matrix
->
matrix
[
3
];
return
Ok
;
}
else
return
InvalidParameter
;
}
det
=
matrix_det
(
matrix
);
if
(
!
(
fabs
(
det
)
>=
1e-5
))
return
InvalidParameter
;
det
=
1
/
det
;
copy
=
*
matrix
;
/* store result */
matrix
->
matrix
[
0
]
=
copy
.
matrix
[
3
]
/
det
;
matrix
->
matrix
[
1
]
=
-
copy
.
matrix
[
1
]
/
det
;
matrix
->
matrix
[
2
]
=
-
copy
.
matrix
[
2
]
/
det
;
matrix
->
matrix
[
3
]
=
copy
.
matrix
[
0
]
/
det
;
matrix
->
matrix
[
4
]
=
(
copy
.
matrix
[
2
]
*
copy
.
matrix
[
5
]
-
copy
.
matrix
[
3
]
*
copy
.
matrix
[
4
])
/
det
;
matrix
->
matrix
[
5
]
=
-
(
copy
.
matrix
[
0
]
*
copy
.
matrix
[
5
]
-
copy
.
matrix
[
1
]
*
copy
.
matrix
[
4
])
/
det
;
matrix
->
matrix
[
0
]
=
copy
.
matrix
[
3
]
*
det
;
matrix
->
matrix
[
1
]
=
-
copy
.
matrix
[
1
]
*
det
;
matrix
->
matrix
[
2
]
=
-
copy
.
matrix
[
2
]
*
det
;
matrix
->
matrix
[
3
]
=
copy
.
matrix
[
0
]
*
det
;
matrix
->
matrix
[
4
]
=
(
copy
.
matrix
[
2
]
*
copy
.
matrix
[
5
]
-
copy
.
matrix
[
3
]
*
copy
.
matrix
[
4
])
*
det
;
matrix
->
matrix
[
5
]
=
-
(
copy
.
matrix
[
0
]
*
copy
.
matrix
[
5
]
-
copy
.
matrix
[
1
]
*
copy
.
matrix
[
4
])
*
det
;
return
Ok
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment