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
169b49fb
Unverified
Commit
169b49fb
authored
Dec 15, 2022
by
Jonah Williams
Committed by
GitHub
Dec 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "[framework] make transform with filterQuality a rpb (#116792)" (#117095)
This reverts commit
e331dcda
.
parent
409a39da
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
81 deletions
+54
-81
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+53
-51
animated_image_filtered_repaint_test.dart
...er/test/widgets/animated_image_filtered_repaint_test.dart
+0
-29
transform_test.dart
packages/flutter/test/widgets/transform_test.dart
+1
-1
No files found.
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
169b49fb
...
...
@@ -2430,7 +2430,7 @@ class RenderTransform extends RenderProxyBox {
return
;
}
_origin
=
value
;
markNeeds
CompositedLayerUpdate
();
markNeeds
Paint
();
markNeedsSemanticsUpdate
();
}
...
...
@@ -2452,7 +2452,7 @@ class RenderTransform extends RenderProxyBox {
return
;
}
_alignment
=
value
;
markNeeds
CompositedLayerUpdate
();
markNeeds
Paint
();
markNeedsSemanticsUpdate
();
}
...
...
@@ -2467,13 +2467,10 @@ class RenderTransform extends RenderProxyBox {
return
;
}
_textDirection
=
value
;
markNeeds
CompositedLayerUpdate
();
markNeeds
Paint
();
markNeedsSemanticsUpdate
();
}
@override
bool
get
isRepaintBoundary
=>
alwaysNeedsCompositing
;
@override
bool
get
alwaysNeedsCompositing
=>
child
!=
null
&&
_filterQuality
!=
null
;
...
...
@@ -2498,7 +2495,7 @@ class RenderTransform extends RenderProxyBox {
return
;
}
_transform
=
Matrix4
.
copy
(
value
);
markNeeds
CompositedLayerUpdate
();
markNeeds
Paint
();
markNeedsSemanticsUpdate
();
}
...
...
@@ -2516,48 +2513,48 @@ class RenderTransform extends RenderProxyBox {
if
(
didNeedCompositing
!=
alwaysNeedsCompositing
)
{
markNeedsCompositingBitsUpdate
();
}
markNeeds
CompositedLayerUpdate
();
markNeeds
Paint
();
}
/// Sets the transform to the identity matrix.
void
setIdentity
()
{
_transform
!.
setIdentity
();
markNeeds
CompositedLayerUpdate
();
markNeeds
Paint
();
markNeedsSemanticsUpdate
();
}
/// Concatenates a rotation about the x axis into the transform.
void
rotateX
(
double
radians
)
{
_transform
!.
rotateX
(
radians
);
markNeeds
CompositedLayerUpdate
();
markNeeds
Paint
();
markNeedsSemanticsUpdate
();
}
/// Concatenates a rotation about the y axis into the transform.
void
rotateY
(
double
radians
)
{
_transform
!.
rotateY
(
radians
);
markNeeds
CompositedLayerUpdate
();
markNeeds
Paint
();
markNeedsSemanticsUpdate
();
}
/// Concatenates a rotation about the z axis into the transform.
void
rotateZ
(
double
radians
)
{
_transform
!.
rotateZ
(
radians
);
markNeeds
CompositedLayerUpdate
();
markNeeds
Paint
();
markNeedsSemanticsUpdate
();
}
/// Concatenates a translation by (x, y, z) into the transform.
void
translate
(
double
x
,
[
double
y
=
0.0
,
double
z
=
0.0
])
{
_transform
!.
translate
(
x
,
y
,
z
);
markNeeds
CompositedLayerUpdate
();
markNeeds
Paint
();
markNeedsSemanticsUpdate
();
}
/// Concatenates a scale into the transform.
void
scale
(
double
x
,
[
double
?
y
,
double
?
z
])
{
_transform
!.
scale
(
x
,
y
,
z
);
markNeeds
CompositedLayerUpdate
();
markNeeds
Paint
();
markNeedsSemanticsUpdate
();
}
...
...
@@ -2606,46 +2603,51 @@ class RenderTransform extends RenderProxyBox {
);
}
@override
OffsetLayer
updateCompositedLayer
({
required
covariant
ImageFilterLayer
?
oldLayer
})
{
final
ImageFilterLayer
layer
=
oldLayer
??
ImageFilterLayer
();
layer
.
imageFilter
=
ui
.
ImageFilter
.
matrix
(
_effectiveTransform
!.
storage
,
filterQuality:
filterQuality
!
);
return
layer
;
}
@override
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
child
==
null
)
{
return
;
}
if
(
isRepaintBoundary
)
{
return
super
.
paint
(
context
,
offset
);
}
final
Matrix4
transform
=
_effectiveTransform
!;
final
Offset
?
childOffset
=
MatrixUtils
.
getAsTranslation
(
transform
);
if
(
childOffset
!=
null
)
{
super
.
paint
(
context
,
offset
+
childOffset
);
layer
=
null
;
return
;
}
// if the matrix is singular the children would be compressed to a line or
// single point, instead short-circuit and paint nothing.
final
double
det
=
transform
.
determinant
();
if
(
det
==
0
||
!
det
.
isFinite
)
{
layer
=
null
;
return
;
if
(
child
!=
null
)
{
final
Matrix4
transform
=
_effectiveTransform
!;
if
(
filterQuality
==
null
)
{
final
Offset
?
childOffset
=
MatrixUtils
.
getAsTranslation
(
transform
);
if
(
childOffset
==
null
)
{
// if the matrix is singular the children would be compressed to a line or
// single point, instead short-circuit and paint nothing.
final
double
det
=
transform
.
determinant
();
if
(
det
==
0
||
!
det
.
isFinite
)
{
layer
=
null
;
return
;
}
layer
=
context
.
pushTransform
(
needsCompositing
,
offset
,
transform
,
super
.
paint
,
oldLayer:
layer
is
TransformLayer
?
layer
as
TransformLayer
?
:
null
,
);
}
else
{
super
.
paint
(
context
,
offset
+
childOffset
);
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
(
effectiveTransform
.
storage
,
filterQuality:
filterQuality
!,
);
if
(
layer
is
ImageFilterLayer
)
{
final
ImageFilterLayer
filterLayer
=
layer
!
as
ImageFilterLayer
;
filterLayer
.
imageFilter
=
filter
;
}
else
{
layer
=
ImageFilterLayer
(
imageFilter:
filter
);
}
context
.
pushLayer
(
layer
!,
super
.
paint
,
offset
);
assert
(()
{
layer
!.
debugCreator
=
debugCreator
;
return
true
;
}());
}
}
layer
=
context
.
pushTransform
(
needsCompositing
,
offset
,
transform
,
super
.
paint
,
oldLayer:
layer
is
TransformLayer
?
layer
as
TransformLayer
?
:
null
,
);
}
@override
...
...
packages/flutter/test/widgets/animated_image_filtered_repaint_test.dart
View file @
169b49fb
...
...
@@ -35,35 +35,6 @@ void main() {
expect
(
RenderTestObject
.
paintCount
,
1
);
});
testWidgets
(
'Transform with FilterQuality avoids repainting child as it animates'
,
(
WidgetTester
tester
)
async
{
RenderTestObject
.
paintCount
=
0
;
await
tester
.
pumpWidget
(
Container
(
color:
Colors
.
red
,
child:
Transform
.
translate
(
offset:
const
Offset
(
5.0
,
10.0
),
filterQuality:
FilterQuality
.
low
,
child:
const
TestWidget
(),
),
)
);
expect
(
RenderTestObject
.
paintCount
,
1
);
await
tester
.
pumpWidget
(
Container
(
color:
Colors
.
red
,
child:
Transform
.
translate
(
offset:
const
Offset
(
25.0
,
0.0
),
filterQuality:
FilterQuality
.
low
,
child:
const
TestWidget
(),
),
)
);
expect
(
RenderTestObject
.
paintCount
,
1
);
});
}
class
TestWidget
extends
SingleChildRenderObjectWidget
{
...
...
packages/flutter/test/widgets/transform_test.dart
View file @
169b49fb
...
...
@@ -616,7 +616,7 @@ void main() {
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
(
50
),
moreOrLessEquals
(-
20.710678118654755
),
0.0
,
1.0
,
moreOrLessEquals
(
329.28932188134524
),
moreOrLessEquals
(-
194.97474683058329
),
0.0
,
1.0
,
]);
});
...
...
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