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
4fb5bcd8
Commit
4fb5bcd8
authored
Nov 19, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #486 from abarth/painting_context
Refactor PaintingContext
parents
c882d423
fc576814
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
227 additions
and
268 deletions
+227
-268
sector_layout.dart
examples/rendering/lib/sector_layout.dart
+3
-3
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+1
-1
box.dart
packages/flutter/lib/src/rendering/box.dart
+4
-1
object.dart
packages/flutter/lib/src/rendering/object.dart
+189
-238
overflow.dart
packages/flutter/lib/src/rendering/overflow.dart
+2
-2
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+15
-13
shifted_box.dart
packages/flutter/lib/src/rendering/shifted_box.dart
+1
-1
stack.dart
packages/flutter/lib/src/rendering/stack.dart
+1
-1
statistics_box.dart
packages/flutter/lib/src/rendering/statistics_box.dart
+1
-1
view.dart
packages/flutter/lib/src/rendering/view.dart
+1
-1
viewport.dart
packages/flutter/lib/src/rendering/viewport.dart
+9
-6
No files found.
examples/rendering/lib/sector_layout.dart
View file @
4fb5bcd8
...
...
@@ -282,7 +282,7 @@ class RenderSectorRing extends RenderSectorWithChildren {
super
.
paint
(
context
,
offset
);
RenderSector
child
=
firstChild
;
while
(
child
!=
null
)
{
context
.
paintChild
(
child
,
offset
.
toPoint
()
);
context
.
paintChild
(
child
,
offset
);
final
SectorChildListParentData
childParentData
=
child
.
parentData
;
child
=
childParentData
.
nextSibling
;
}
...
...
@@ -388,7 +388,7 @@ class RenderSectorSlice extends RenderSectorWithChildren {
RenderSector
child
=
firstChild
;
while
(
child
!=
null
)
{
assert
(
child
.
parentData
is
SectorChildListParentData
);
context
.
paintChild
(
child
,
offset
.
toPoint
()
);
context
.
paintChild
(
child
,
offset
);
final
SectorChildListParentData
childParentData
=
child
.
parentData
;
child
=
childParentData
.
nextSibling
;
}
...
...
@@ -470,7 +470,7 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
if
(
child
!=
null
)
{
Rect
bounds
=
offset
&
size
;
// we move the offset to the center of the circle for the RenderSectors
context
.
paintChild
(
child
,
bounds
.
center
);
context
.
paintChild
(
child
,
bounds
.
center
.
toOffset
()
);
}
}
...
...
packages/flutter/lib/src/material/tabs.dart
View file @
4fb5bcd8
...
...
@@ -232,7 +232,7 @@ class _RenderTabBar extends RenderBox with
RenderBox
child
=
firstChild
;
while
(
child
!=
null
)
{
final
_TabBarParentData
childParentData
=
child
.
parentData
;
context
.
paintChild
(
child
,
childParentData
.
position
+
offset
);
context
.
paintChild
(
child
,
childParentData
.
offset
+
offset
);
if
(
index
++
==
selectedIndex
)
_paintIndicator
(
context
.
canvas
,
child
,
offset
);
child
=
childParentData
.
nextSibling
;
...
...
packages/flutter/lib/src/rendering/box.dart
View file @
4fb5bcd8
...
...
@@ -287,6 +287,8 @@ class BoxHitTestEntry extends HitTestEntry {
/// Parent data used by [RenderBox] and its subclasses
class
BoxParentData
extends
ParentData
{
// TODO(abarth): Switch to using an Offset rather than a Point here. This
// value is really the offset from the parent.
Point
_position
=
Point
.
origin
;
/// The point at which to paint the child in the parent's coordinate system
Point
get
position
=>
_position
;
...
...
@@ -294,6 +296,7 @@ class BoxParentData extends ParentData {
assert
(
RenderObject
.
debugDoingLayout
);
_position
=
value
;
}
Offset
get
offset
=>
_position
.
toOffset
();
String
toString
()
=>
'position=
$position
'
;
}
...
...
@@ -771,7 +774,7 @@ abstract class RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, Pare
RenderBox
child
=
firstChild
;
while
(
child
!=
null
)
{
final
ParentDataType
childParentData
=
child
.
parentData
;
context
.
paintChild
(
child
,
childParentData
.
position
+
offset
);
context
.
paintChild
(
child
,
childParentData
.
offset
+
offset
);
child
=
childParentData
.
nextSibling
;
}
}
...
...
packages/flutter/lib/src/rendering/object.dart
View file @
4fb5bcd8
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/rendering/overflow.dart
View file @
4fb5bcd8
...
...
@@ -131,7 +131,7 @@ class RenderOverflowBox extends RenderBox with RenderObjectWithChildMixin<Render
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
child
!=
null
)
context
.
paintChild
(
child
,
offset
.
toPoint
()
);
context
.
paintChild
(
child
,
offset
);
}
void
debugDescribeSettings
(
List
<
String
>
settings
)
{
...
...
@@ -198,7 +198,7 @@ class RenderSizedOverflowBox extends RenderBox with RenderObjectWithChildMixin<R
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
child
!=
null
)
context
.
paintChild
(
child
,
offset
.
toPoint
()
);
context
.
paintChild
(
child
,
offset
);
}
}
...
...
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
4fb5bcd8
...
...
@@ -77,7 +77,7 @@ class RenderProxyBox extends RenderBox with RenderObjectWithChildMixin<RenderBox
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
child
!=
null
)
context
.
paintChild
(
child
,
offset
.
toPoint
()
);
context
.
paintChild
(
child
,
offset
);
}
}
...
...
@@ -501,10 +501,12 @@ class RenderOpacity extends RenderProxyBox {
int
a
=
_alpha
;
if
(
a
==
0
)
return
;
if
(
a
==
255
)
context
.
paintChild
(
child
,
offset
.
toPoint
());
else
context
.
paintChildWithOpacity
(
child
,
offset
.
toPoint
(),
null
,
a
);
if
(
a
==
255
)
{
context
.
paintChild
(
child
,
offset
);
return
;
}
// TODO(abarth): We should pass bounds here.
context
.
pushOpacity
(
needsCompositing
,
offset
,
null
,
a
,
super
.
paint
);
}
}
...
...
@@ -540,7 +542,7 @@ class RenderShaderMask extends RenderProxyBox {
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
child
!=
null
)
context
.
p
aintChildWithShaderMask
(
child
,
offset
.
toPoint
(),
offset
&
size
,
_shaderCallback
,
_transferMode
);
context
.
p
ushShaderMask
(
needsCompositing
,
offset
,
Point
.
origin
&
size
,
_shaderCallback
,
_transferMode
,
super
.
paint
);
}
}
...
...
@@ -552,7 +554,7 @@ class RenderClipRect extends RenderProxyBox {
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
child
!=
null
)
context
.
p
aintChildWithClipRect
(
child
,
offset
.
toPoint
(),
offset
&
size
);
context
.
p
ushClipRect
(
needsCompositing
,
offset
,
Point
.
origin
&
size
,
super
.
paint
);
}
}
...
...
@@ -598,9 +600,9 @@ class RenderClipRRect extends RenderProxyBox {
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
child
!=
null
)
{
Rect
rect
=
offset
&
size
;
Rect
rect
=
Point
.
origin
&
size
;
ui
.
RRect
rrect
=
new
ui
.
RRect
.
fromRectXY
(
rect
,
xRadius
,
yRadius
);
context
.
p
aintChildWithClipRRect
(
child
,
offset
.
toPoint
(),
rect
,
rrec
t
);
context
.
p
ushClipRRect
(
needsCompositing
,
offset
,
rect
,
rrect
,
super
.
pain
t
);
}
}
}
...
...
@@ -615,7 +617,7 @@ class RenderClipOval extends RenderProxyBox {
Rect
_cachedRect
;
Path
_cachedPath
;
Path
_getPath
(
Rect
rect
)
{
Path
_get
Clip
Path
(
Rect
rect
)
{
if
(
rect
!=
_cachedRect
)
{
_cachedRect
=
rect
;
_cachedPath
=
new
Path
()..
addOval
(
_cachedRect
);
...
...
@@ -634,8 +636,8 @@ class RenderClipOval extends RenderProxyBox {
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
child
!=
null
)
{
Rect
rect
=
offset
&
size
;
context
.
p
aintChildWithClipPath
(
child
,
offset
.
toPoint
(),
rect
,
_getPath
(
rect
)
);
Rect
bounds
=
Point
.
origin
&
size
;
context
.
p
ushClipPath
(
needsCompositing
,
offset
,
bounds
,
_getClipPath
(
bounds
),
super
.
paint
);
}
}
}
...
...
@@ -863,7 +865,7 @@ class RenderTransform extends RenderProxyBox {
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
child
!=
null
)
context
.
p
aintChildWithTransform
(
child
,
offset
.
toPoint
(),
_effectiveTransform
);
context
.
p
ushTransform
(
needsCompositing
,
offset
,
_effectiveTransform
,
super
.
paint
);
}
void
applyPaintTransform
(
Matrix4
transform
)
{
...
...
packages/flutter/lib/src/rendering/shifted_box.dart
View file @
4fb5bcd8
...
...
@@ -56,7 +56,7 @@ abstract class RenderShiftedBox extends RenderBox with RenderObjectWithChildMixi
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
child
!=
null
)
{
final
BoxParentData
childParentData
=
child
.
parentData
;
context
.
paintChild
(
child
,
childParentData
.
position
+
offset
);
context
.
paintChild
(
child
,
childParentData
.
offset
+
offset
);
}
}
...
...
packages/flutter/lib/src/rendering/stack.dart
View file @
4fb5bcd8
...
...
@@ -489,6 +489,6 @@ class RenderIndexedStack extends RenderStackBase {
return
;
RenderBox
child
=
_childAtIndex
();
final
StackParentData
childParentData
=
child
.
parentData
;
context
.
paintChild
(
child
,
childParentData
.
position
+
offset
);
context
.
paintChild
(
child
,
childParentData
.
offset
+
offset
);
}
}
packages/flutter/lib/src/rendering/statistics_box.dart
View file @
4fb5bcd8
...
...
@@ -54,6 +54,6 @@ class RenderStatisticsBox extends RenderBox {
}
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
context
.
p
aintStatistics
(
optionsMask
,
rasterizerThreshold
,
offset
,
size
);
context
.
p
ushStatistics
(
offset
,
optionsMask
,
rasterizerThreshold
,
size
);
}
}
packages/flutter/lib/src/rendering/view.dart
View file @
4fb5bcd8
...
...
@@ -110,7 +110,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
child
!=
null
)
context
.
paintChild
(
child
,
offset
.
toPoint
()
);
context
.
paintChild
(
child
,
offset
);
}
/// Uploads the composited layer tree to the engine
...
...
packages/flutter/lib/src/rendering/viewport.dart
View file @
4fb5bcd8
...
...
@@ -146,12 +146,15 @@ class RenderViewport extends RenderBox with RenderObjectWithChildMixin<RenderBox
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
child
!=
null
)
{
Offset
roundedScrollOffset
=
_scrollOffsetRoundedToIntegerDevicePixels
;
bool
_needsClip
=
offset
<
Offset
.
zero
||
!(
offset
&
size
).
contains
(((
offset
-
roundedScrollOffset
)
&
child
.
size
).
bottomRight
);
if
(
_needsClip
)
context
.
paintChildWithClipRect
(
child
,
(
offset
-
roundedScrollOffset
).
toPoint
(),
offset
&
size
);
else
context
.
paintChild
(
child
,
(
offset
-
roundedScrollOffset
).
toPoint
());
bool
_needsClip
=
offset
<
Offset
.
zero
||
!(
offset
&
size
).
contains
(((
offset
-
roundedScrollOffset
)
&
child
.
size
).
bottomRight
);
if
(
_needsClip
)
{
context
.
pushClipRect
(
needsCompositing
,
offset
,
Point
.
origin
&
size
,
(
PaintingContext
context
,
Offset
offset
)
{
context
.
paintChild
(
child
,
offset
-
roundedScrollOffset
);
});
}
else
{
context
.
paintChild
(
child
,
offset
-
roundedScrollOffset
);
}
}
}
...
...
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