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
3dd1a05a
Commit
3dd1a05a
authored
Aug 28, 2017
by
Ian Hickson
Committed by
GitHub
Aug 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better debugPaintSize logic for clip renderers (#11725)
parent
1ee94001
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
1 deletion
+78
-1
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+78
-1
No files found.
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
3dd1a05a
...
...
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:ui'
as
ui
show
ImageFilter
;
import
'dart:ui'
as
ui
show
ImageFilter
,
Gradient
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
...
...
@@ -1014,6 +1014,35 @@ abstract class _RenderCustomClip<T> extends RenderProxyBox {
Rect
describeApproximatePaintClip
(
RenderObject
child
)
{
return
_clipper
?.
getApproximateClipRect
(
size
)
??
Offset
.
zero
&
size
;
}
Paint
_debugPaint
;
TextPainter
_debugText
;
@override
void
debugPaintSize
(
PaintingContext
context
,
Offset
offset
)
{
assert
(()
{
_debugPaint
??=
new
Paint
()
..
shader
=
new
ui
.
Gradient
.
linear
(
const
Offset
(
0.0
,
0.0
),
const
Offset
(
10.0
,
10.0
),
<
Color
>[
const
Color
(
0x00000000
),
const
Color
(
0xFFFF00FF
),
const
Color
(
0xFFFF00FF
),
const
Color
(
0x00000000
)],
<
double
>[
0.25
,
0.25
,
0.75
,
0.75
],
TileMode
.
repeated
,
)
..
strokeWidth
=
2.0
..
style
=
PaintingStyle
.
stroke
;
_debugText
??=
new
TextPainter
(
text:
const
TextSpan
(
text:
'✂'
,
style:
const
TextStyle
(
color:
const
Color
(
0xFFFF00FF
),
fontSize:
14.0
,
),
),
)
..
layout
();
return
true
;
});
}
}
/// Clips its child using a rectangle.
...
...
@@ -1052,6 +1081,18 @@ class RenderClipRect extends _RenderCustomClip<Rect> {
context
.
pushClipRect
(
needsCompositing
,
offset
,
_clip
,
super
.
paint
);
}
}
@override
void
debugPaintSize
(
PaintingContext
context
,
Offset
offset
)
{
assert
(()
{
if
(
child
!=
null
)
{
super
.
debugPaintSize
(
context
,
offset
);
context
.
canvas
.
drawRect
(
_clip
.
shift
(
offset
),
_debugPaint
);
_debugText
.
paint
(
context
.
canvas
,
offset
+
new
Offset
(
_clip
.
width
/
8.0
,
-
_debugText
.
text
.
style
.
fontSize
*
1.1
));
}
return
true
;
});
}
}
/// Clips its child using a rounded rectangle.
...
...
@@ -1111,6 +1152,18 @@ class RenderClipRRect extends _RenderCustomClip<RRect> {
context
.
pushClipRRect
(
needsCompositing
,
offset
,
_clip
.
outerRect
,
_clip
,
super
.
paint
);
}
}
@override
void
debugPaintSize
(
PaintingContext
context
,
Offset
offset
)
{
assert
(()
{
if
(
child
!=
null
)
{
super
.
debugPaintSize
(
context
,
offset
);
context
.
canvas
.
drawRRect
(
_clip
.
shift
(
offset
),
_debugPaint
);
_debugText
.
paint
(
context
.
canvas
,
offset
+
new
Offset
(
_clip
.
tlRadiusX
,
-
_debugText
.
text
.
style
.
fontSize
*
1.1
));
}
return
true
;
});
}
}
/// Clips its child using an oval.
...
...
@@ -1163,6 +1216,18 @@ class RenderClipOval extends _RenderCustomClip<Rect> {
context
.
pushClipPath
(
needsCompositing
,
offset
,
_clip
,
_getClipPath
(
_clip
),
super
.
paint
);
}
}
@override
void
debugPaintSize
(
PaintingContext
context
,
Offset
offset
)
{
assert
(()
{
if
(
child
!=
null
)
{
super
.
debugPaintSize
(
context
,
offset
);
context
.
canvas
.
drawPath
(
_getClipPath
(
_clip
).
shift
(
offset
),
_debugPaint
);
_debugText
.
paint
(
context
.
canvas
,
offset
+
new
Offset
((
_clip
.
width
-
_debugText
.
width
)
/
2.0
,
-
_debugText
.
text
.
style
.
fontSize
*
1.1
));
}
return
true
;
});
}
}
/// Clips its child using a path.
...
...
@@ -1209,6 +1274,18 @@ class RenderClipPath extends _RenderCustomClip<Path> {
context
.
pushClipPath
(
needsCompositing
,
offset
,
Offset
.
zero
&
size
,
_clip
,
super
.
paint
);
}
}
@override
void
debugPaintSize
(
PaintingContext
context
,
Offset
offset
)
{
assert
(()
{
if
(
child
!=
null
)
{
super
.
debugPaintSize
(
context
,
offset
);
context
.
canvas
.
drawPath
(
_clip
.
shift
(
offset
),
_debugPaint
);
_debugText
.
paint
(
context
.
canvas
,
offset
);
}
return
true
;
});
}
}
/// Creates a physical model layer that clips its children to a rounded
...
...
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