Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
82d94219
Commit
82d94219
authored
Dec 03, 2022
by
Bartosz Kosiorek
Committed by
Alexandre Julliard
Dec 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Improve performance of GdipTranslateMatrix.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53947
parent
ae0891eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
11 deletions
+50
-11
matrix.c
dlls/gdiplus/matrix.c
+10
-11
matrix.c
dlls/gdiplus/tests/matrix.c
+40
-0
No files found.
dlls/gdiplus/matrix.c
View file @
82d94219
...
...
@@ -417,24 +417,23 @@ GpStatus WINGDIPAPI GdipTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, I
GpStatus
WINGDIPAPI
GdipTranslateMatrix
(
GpMatrix
*
matrix
,
REAL
offsetX
,
REAL
offsetY
,
GpMatrixOrder
order
)
{
REAL
translate
[
6
];
TRACE
(
"(%p, %.2f, %.2f, %d)
\n
"
,
matrix
,
offsetX
,
offsetY
,
order
);
if
(
!
matrix
)
return
InvalidParameter
;
translate
[
0
]
=
1
.
0
;
translate
[
1
]
=
0
.
0
;
translate
[
2
]
=
0
.
0
;
translate
[
3
]
=
1
.
0
;
translate
[
4
]
=
offsetX
;
translate
[
5
]
=
offsetY
;
if
(
order
==
MatrixOrderAppend
)
matrix_multiply
(
matrix
->
matrix
,
translate
,
matrix
->
matrix
);
{
matrix
->
matrix
[
4
]
+=
offsetX
;
matrix
->
matrix
[
5
]
+=
offsetY
;
}
else
if
(
order
==
MatrixOrderPrepend
)
matrix_multiply
(
translate
,
matrix
->
matrix
,
matrix
->
matrix
);
{
matrix
->
matrix
[
4
]
=
offsetX
*
matrix
->
matrix
[
0
]
+
offsetY
*
matrix
->
matrix
[
2
]
+
matrix
->
matrix
[
4
];
matrix
->
matrix
[
5
]
=
offsetX
*
matrix
->
matrix
[
1
]
+
offsetY
*
matrix
->
matrix
[
3
]
+
matrix
->
matrix
[
5
];
}
else
return
InvalidParameter
;
...
...
dlls/gdiplus/tests/matrix.c
View file @
82d94219
...
...
@@ -110,6 +110,45 @@ static void test_transform(void)
GdipDeleteMatrix
(
matrix
);
}
static
void
test_translate
(
void
)
{
GpStatus
status
;
GpMatrix
*
matrix
=
NULL
;
REAL
elems
[
6
];
static
const
REAL
expected_elem_append
[]
=
{
1
.
0
,
-
2
.
0
,
30
.
0
,
40
.
0
,
-
470
.
0
,
620
.
0
};
static
const
REAL
expected_elem_prepend
[]
=
{
1
.
0
,
-
2
.
0
,
30
.
0
,
40
.
0
,
130
.
0
,
1340
.
0
};
GdipCreateMatrix2
(
1
.
0
,
-
2
.
0
,
30
.
0
,
40
.
0
,
-
500
.
0
,
600
.
0
,
&
matrix
);
status
=
GdipTranslateMatrix
(
NULL
,
30
.
0
,
20
.
0
,
MatrixOrderAppend
);
expect
(
InvalidParameter
,
status
);
status
=
GdipTranslateMatrix
(
matrix
,
30
.
0
,
20
.
0
,
MatrixOrderAppend
);
expect
(
Ok
,
status
);
status
=
GdipGetMatrixElements
(
matrix
,
elems
);
expect
(
Ok
,
status
);
GdipDeleteMatrix
(
matrix
);
for
(
INT
i
=
0
;
i
<
6
;
i
++
)
ok
(
expected_elem_append
[
i
]
==
elems
[
i
],
"Expected #%d to be (%.1f) but got (%.1f)
\n
"
,
i
,
expected_elem_append
[
i
],
elems
[
i
]);
GdipCreateMatrix2
(
1
.
0
,
-
2
.
0
,
30
.
0
,
40
.
0
,
-
500
.
0
,
600
.
0
,
&
matrix
);
status
=
GdipTranslateMatrix
(
matrix
,
30
.
0
,
20
.
0
,
MatrixOrderPrepend
);
expect
(
Ok
,
status
);
status
=
GdipGetMatrixElements
(
matrix
,
elems
);
expect
(
Ok
,
status
);
GdipDeleteMatrix
(
matrix
);
for
(
INT
i
=
0
;
i
<
6
;
i
++
)
ok
(
expected_elem_prepend
[
i
]
==
elems
[
i
],
"Expected #%d to be (%.1f) but got (%.1f)
\n
"
,
i
,
expected_elem_prepend
[
i
],
elems
[
i
]);
}
static
void
test_scale
(
void
)
{
GpStatus
status
;
...
...
@@ -430,6 +469,7 @@ START_TEST(matrix)
GdiplusStartup
(
&
gdiplusToken
,
&
gdiplusStartupInput
,
NULL
);
test_constructor_destructor
();
test_translate
();
test_scale
();
test_transform
();
test_isinvertible
();
...
...
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