mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[web] Fix transform not invalidating path bounds causing debugValidate failure (flutter/engine#22172)
This commit is contained in:
parent
dc3cf6a04e
commit
ada2d894e3
@ -42,7 +42,9 @@ class PathRef {
|
||||
static const int kInitialPointsCapacity = 8;
|
||||
static const int kInitialVerbsCapacity = 8;
|
||||
|
||||
/// Bounds of points that define path.
|
||||
ui.Rect? fBounds;
|
||||
/// Computed tight bounds of path (may exclude curve control points).
|
||||
ui.Rect? cachedBounds;
|
||||
int _fPointsCapacity = 0;
|
||||
int _fPointsLength = 0;
|
||||
@ -730,6 +732,7 @@ class PathRef {
|
||||
fIsRRect = false;
|
||||
fIsRect = false;
|
||||
cachedBounds = null;
|
||||
fBoundsIsDirty = true;
|
||||
}
|
||||
|
||||
void setIsOval(bool isOval, bool isCCW, int start) {
|
||||
|
||||
@ -536,5 +536,19 @@ void testMain() {
|
||||
end = iter.skipToNextContour();
|
||||
expect(start, end);
|
||||
});
|
||||
|
||||
/// Regression test for https://github.com/flutter/flutter/issues/68702.
|
||||
test('Path should return correct bounds after transform', () {
|
||||
final Path path1 = Path()
|
||||
..moveTo(100, 100)
|
||||
..lineTo(200, 100)
|
||||
..lineTo(150, 200)
|
||||
..close();
|
||||
final SurfacePath path2 = Path.from(path1) as SurfacePath;
|
||||
Rect bounds = path2.pathRef.getBounds();
|
||||
SurfacePath transformedPath = path2.transform(
|
||||
Matrix4.identity().scaled(0.5, 0.5).toFloat64());
|
||||
expect(transformedPath.pathRef.getBounds(), isNot(bounds));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user