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
fb512aa6
Commit
fb512aa6
authored
Aug 07, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #494 from abarth/integer_scrolling
RenderViewport should use integer device pixels
parents
7b678ff3
75da2a9f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
box.dart
packages/flutter/lib/rendering/box.dart
+12
-3
No files found.
packages/flutter/lib/rendering/box.dart
View file @
fb512aa6
...
...
@@ -1238,15 +1238,24 @@ class RenderViewport extends RenderBox with RenderObjectWithChildMixin<RenderBox
}
}
Offset
get
_scrollOffsetRoundedToIntegerDevicePixels
{
double
devicePixelRatio
=
sky
.
view
.
devicePixelRatio
;
int
dxInDevicePixels
=
(
scrollOffset
.
dx
*
devicePixelRatio
).
round
();
int
dyInDevicePixels
=
(
scrollOffset
.
dy
*
devicePixelRatio
).
round
();
return
new
Offset
(
dxInDevicePixels
/
devicePixelRatio
,
dyInDevicePixels
/
devicePixelRatio
);
}
void
paint
(
PaintingCanvas
canvas
,
Offset
offset
)
{
if
(
child
!=
null
)
{
Offset
roundedScrollOffset
=
_scrollOffsetRoundedToIntegerDevicePixels
;
bool
_needsClip
=
offset
<
Offset
.
zero
||
!(
offset
&
size
).
contains
(((
offset
-
s
crollOffset
)
&
child
.
size
).
bottomRight
);
!(
offset
&
size
).
contains
(((
offset
-
roundedS
crollOffset
)
&
child
.
size
).
bottomRight
);
if
(
_needsClip
)
{
canvas
.
save
();
canvas
.
clipRect
(
offset
&
size
);
}
canvas
.
paintChild
(
child
,
(
offset
-
s
crollOffset
).
toPoint
());
canvas
.
paintChild
(
child
,
(
offset
-
roundedS
crollOffset
).
toPoint
());
if
(
_needsClip
)
canvas
.
restore
();
}
...
...
@@ -1256,7 +1265,7 @@ class RenderViewport extends RenderBox with RenderObjectWithChildMixin<RenderBox
if
(
child
!=
null
)
{
assert
(
child
.
parentData
is
BoxParentData
);
Rect
childBounds
=
child
.
parentData
.
position
&
child
.
size
;
Point
transformedPosition
=
position
+
scrollOffset
;
Point
transformedPosition
=
position
+
_scrollOffsetRoundedToIntegerDevicePixels
;
if
(
childBounds
.
contains
(
transformedPosition
))
child
.
hitTest
(
result
,
position:
transformedPosition
);
}
...
...
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