Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
6ba2f526
Unverified
Commit
6ba2f526
authored
Dec 18, 2021
by
Jim Graham
Committed by
GitHub
Dec 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix alignment of matrix for Transform+filterQuality when offset (#95432)
parent
57196a9e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
1 deletion
+51
-1
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+3
-1
transform_test.dart
packages/flutter/test/widgets/transform_test.dart
+48
-0
No files found.
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
6ba2f526
...
...
@@ -2398,8 +2398,10 @@ class RenderTransform extends RenderProxyBox {
layer
=
null
;
}
}
else
{
final
Matrix4
effectiveTransform
=
Matrix4
.
translationValues
(
offset
.
dx
,
offset
.
dy
,
0.0
)
..
multiply
(
transform
)..
translate
(-
offset
.
dx
,
-
offset
.
dy
);
final
ui
.
ImageFilter
filter
=
ui
.
ImageFilter
.
matrix
(
t
ransform
.
storage
,
effectiveT
ransform
.
storage
,
filterQuality:
filterQuality
!,
);
if
(
layer
is
ImageFilterLayer
)
{
...
...
packages/flutter/test/widgets/transform_test.dart
View file @
6ba2f526
...
...
@@ -393,6 +393,11 @@ void main() {
skip:
isBrowser
,
// due to https://github.com/flutter/flutter/issues/49857
);
List
<
double
>
extractMatrix
(
ui
.
ImageFilter
?
filter
)
{
final
List
<
String
>
numbers
=
filter
.
toString
().
split
(
'['
).
last
.
split
(
']'
).
first
.
split
(
','
);
return
numbers
.
map
<
double
>((
String
str
)
=>
double
.
parse
(
str
.
trim
())).
toList
();
}
testWidgets
(
'Transform.translate with FilterQuality produces filter layer'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
Transform
.
translate
(
...
...
@@ -402,6 +407,13 @@ void main() {
),
);
expect
(
tester
.
layers
.
whereType
<
ImageFilterLayer
>().
length
,
1
);
final
ImageFilterLayer
layer
=
tester
.
layers
.
whereType
<
ImageFilterLayer
>().
first
;
expect
(
extractMatrix
(
layer
.
imageFilter
),
<
double
>[
1.0
,
0.0
,
0.0
,
0.0
,
0.0
,
1.0
,
0.0
,
0.0
,
0.0
,
0.0
,
1.0
,
0.0
,
25.0
,
25.0
,
0.0
,
1.0
]
);
});
testWidgets
(
'Transform.scale with FilterQuality produces filter layer'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -413,6 +425,13 @@ void main() {
),
);
expect
(
tester
.
layers
.
whereType
<
ImageFilterLayer
>().
length
,
1
);
final
ImageFilterLayer
layer
=
tester
.
layers
.
whereType
<
ImageFilterLayer
>().
first
;
expect
(
extractMatrix
(
layer
.
imageFilter
),
<
double
>[
3.14159
,
0.0
,
0.0
,
0.0
,
0.0
,
3.14159
,
0.0
,
0.0
,
0.0
,
0.0
,
1.0
,
0.0
,
-
856.636
,
-
642.477
,
0.0
,
1.0
]
);
});
testWidgets
(
'Transform.rotate with FilterQuality produces filter layer'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -424,6 +443,35 @@ void main() {
),
);
expect
(
tester
.
layers
.
whereType
<
ImageFilterLayer
>().
length
,
1
);
final
ImageFilterLayer
layer
=
tester
.
layers
.
whereType
<
ImageFilterLayer
>().
first
;
expect
(
extractMatrix
(
layer
.
imageFilter
),
<
dynamic
>[
moreOrLessEquals
(
0.7071067811865476
),
moreOrLessEquals
(
0.7071067811865475
),
0.0
,
0.0
,
moreOrLessEquals
(-
0.7071067811865475
),
moreOrLessEquals
(
0.7071067811865476
),
0.0
,
0.0
,
0.0
,
0.0
,
1.0
,
0.0
,
moreOrLessEquals
(
329.28932188134524
),
moreOrLessEquals
(-
194.97474683058329
),
0.0
,
1.0
]
);
});
testWidgets
(
'Offset Transform.rotate with FilterQuality produces filter layer'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
SizedBox
(
width:
400
,
height:
400
,
child:
Center
(
child:
Transform
.
rotate
(
angle:
math
.
pi
/
4
,
filterQuality:
FilterQuality
.
low
,
child:
const
SizedBox
(
width:
100
,
height:
100
),
),
),
),
);
expect
(
tester
.
layers
.
whereType
<
ImageFilterLayer
>().
length
,
1
);
final
ImageFilterLayer
layer
=
tester
.
layers
.
whereType
<
ImageFilterLayer
>().
first
;
expect
(
extractMatrix
(
layer
.
imageFilter
),
<
dynamic
>[
moreOrLessEquals
(
0.7071067811865476
),
moreOrLessEquals
(
0.7071067811865475
),
0.0
,
0.0
,
moreOrLessEquals
(-
0.7071067811865475
),
moreOrLessEquals
(
0.7071067811865476
),
0.0
,
0.0
,
0.0
,
0.0
,
1.0
,
0.0
,
moreOrLessEquals
(
329.28932188134524
),
moreOrLessEquals
(-
194.97474683058329
),
0.0
,
1.0
]
);
});
testWidgets
(
'Transform layers update to match child and filterQuality'
,
(
WidgetTester
tester
)
async
{
...
...
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