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
e46f4807
Commit
e46f4807
authored
Dec 05, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Repeated background images should be clipped to the container
Fixes #766
parent
3419b3e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
box_painter.dart
packages/flutter/lib/src/painting/box_painter.dart
+11
-0
No files found.
packages/flutter/lib/src/painting/box_painter.dart
View file @
e46f4807
...
...
@@ -669,6 +669,11 @@ void paintImage({
// as we apply a nine-patch stretch.
assert
(
sourceSize
==
inputSize
);
}
if
(
repeat
!=
ImageRepeat
.
noRepeat
&&
destinationSize
==
outputSize
)
{
// There's no need to repeat the image because we're exactly filling the
// output rect with the image.
repeat
=
ImageRepeat
.
noRepeat
;
}
Paint
paint
=
new
Paint
()..
isAntiAlias
=
false
;
if
(
colorFilter
!=
null
)
paint
.
colorFilter
=
colorFilter
;
...
...
@@ -676,6 +681,10 @@ void paintImage({
double
dy
=
(
outputSize
.
height
-
destinationSize
.
height
)
*
(
alignY
??
0.5
);
Point
destinationPosition
=
rect
.
topLeft
+
new
Offset
(
dx
,
dy
);
Rect
destinationRect
=
destinationPosition
&
destinationSize
;
if
(
repeat
!=
ImageRepeat
.
noRepeat
)
{
canvas
.
save
();
canvas
.
clipRect
(
rect
);
}
if
(
centerSlice
==
null
)
{
Rect
sourceRect
=
Point
.
origin
&
sourceSize
;
for
(
Rect
tileRect
in
_generateImageTileRects
(
rect
,
destinationRect
,
repeat
))
...
...
@@ -684,6 +693,8 @@ void paintImage({
for
(
Rect
tileRect
in
_generateImageTileRects
(
rect
,
destinationRect
,
repeat
))
canvas
.
drawImageNine
(
image
,
centerSlice
,
tileRect
,
paint
);
}
if
(
repeat
!=
ImageRepeat
.
noRepeat
)
canvas
.
restore
();
}
/// A background image for a box.
...
...
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