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
c59f418f
Commit
c59f418f
authored
Aug 10, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #530 from abarth/move_scale
Simplify SkPicture
parents
b2de6696
e3d9ea67
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
34 additions
and
13 deletions
+34
-13
baseline.dart
examples/raw/baseline.dart
+3
-1
hello_world.dart
examples/raw/hello_world.dart
+3
-1
mutating-dom.dart
examples/raw/mutating-dom.dart
+3
-1
painting.dart
examples/raw/painting.dart
+3
-1
painting_node.dart
examples/raw/painting_node.dart
+4
-3
shadow.dart
examples/raw/shadow.dart
+3
-1
spinning_arabic.dart
examples/raw/spinning_arabic.dart
+3
-1
spinning_image.dart
examples/raw/spinning_image.dart
+3
-1
spinning_square.dart
examples/raw/spinning_square.dart
+3
-1
box.dart
packages/flutter/lib/rendering/box.dart
+6
-2
No files found.
examples/raw/baseline.dart
View file @
c59f418f
...
...
@@ -47,7 +47,9 @@ void drawText(sky.Canvas canvas, String lh) {
void
main
(
)
{
// prepare the rendering
sky
.
PictureRecorder
recorder
=
new
sky
.
PictureRecorder
();
sky
.
Canvas
canvas
=
new
sky
.
Canvas
(
recorder
,
new
sky
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
sky
.
view
.
width
,
sky
.
view
.
height
));
final
double
devicePixelRatio
=
sky
.
view
.
devicePixelRatio
;
sky
.
Canvas
canvas
=
new
sky
.
Canvas
(
recorder
,
new
sky
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
sky
.
view
.
width
*
devicePixelRatio
,
sky
.
view
.
height
*
devicePixelRatio
));
canvas
.
scale
(
devicePixelRatio
,
devicePixelRatio
);
// background
sky
.
Paint
paint
=
new
sky
.
Paint
();
...
...
examples/raw/hello_world.dart
View file @
c59f418f
...
...
@@ -8,7 +8,9 @@ Picture draw(int a, int r, int g, int b) {
Size
size
=
new
Size
(
view
.
width
,
view
.
height
);
PictureRecorder
recorder
=
new
PictureRecorder
();
Canvas
canvas
=
new
Canvas
(
recorder
,
Point
.
origin
&
size
);
final
double
devicePixelRatio
=
sky
.
view
.
devicePixelRatio
;
Canvas
canvas
=
new
Canvas
(
recorder
,
Point
.
origin
&
(
size
*
devicePixelRatio
));
canvas
.
scale
(
devicePixelRatio
,
devicePixelRatio
);
double
radius
=
size
.
shortestSide
*
0.45
;
Paint
paint
=
new
Paint
()..
color
=
new
Color
.
fromARGB
(
a
,
r
,
g
,
b
);
...
...
examples/raw/mutating-dom.dart
View file @
c59f418f
...
...
@@ -202,7 +202,9 @@ void doFrame(double timeStamp) {
// draw the result
report
(
"recording..."
);
sky
.
PictureRecorder
recorder
=
new
sky
.
PictureRecorder
();
sky
.
Canvas
canvas
=
new
sky
.
Canvas
(
recorder
,
new
sky
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
sky
.
view
.
width
,
sky
.
view
.
height
));
final
double
devicePixelRatio
=
sky
.
view
.
devicePixelRatio
;
sky
.
Canvas
canvas
=
new
sky
.
Canvas
(
recorder
,
new
sky
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
sky
.
view
.
width
*
devicePixelRatio
,
sky
.
view
.
height
*
devicePixelRatio
));
canvas
.
scale
(
devicePixelRatio
,
devicePixelRatio
);
layoutRoot
.
maxWidth
=
sky
.
view
.
width
;
layoutRoot
.
layout
();
layoutRoot
.
paint
(
canvas
);
...
...
examples/raw/painting.dart
View file @
c59f418f
...
...
@@ -9,7 +9,9 @@ import 'dart:typed_data';
void
beginFrame
(
double
timeStamp
)
{
sky
.
Size
size
=
new
sky
.
Size
(
sky
.
view
.
width
,
sky
.
view
.
height
);
sky
.
PictureRecorder
recorder
=
new
sky
.
PictureRecorder
();
sky
.
Canvas
canvas
=
new
sky
.
Canvas
(
recorder
,
sky
.
Point
.
origin
&
size
);
final
double
devicePixelRatio
=
sky
.
view
.
devicePixelRatio
;
sky
.
Canvas
canvas
=
new
sky
.
Canvas
(
recorder
,
sky
.
Point
.
origin
&
(
size
*
devicePixelRatio
));
canvas
.
scale
(
devicePixelRatio
,
devicePixelRatio
);
sky
.
Paint
paint
=
new
sky
.
Paint
();
sky
.
Point
mid
=
size
.
center
(
sky
.
Point
.
origin
);
...
...
examples/raw/painting_node.dart
View file @
c59f418f
...
...
@@ -6,11 +6,12 @@ import 'dart:sky';
PaintingNode
paintingNode
=
null
;
Picture
draw
(
int
a
,
int
r
,
int
g
,
int
b
)
{
Rect
bounds
=
new
Rect
.
fromLTRB
(
0.0
,
0.0
,
view
.
width
,
view
.
height
)
;
final
double
devicePixelRatio
=
view
.
devicePixelRatio
;
Size
size
=
new
Size
(
view
.
width
,
view
.
height
);
PictureRecorder
recorder
=
new
PictureRecorder
();
Canvas
canvas
=
new
Canvas
(
recorder
,
bounds
);
Canvas
canvas
=
new
Canvas
(
recorder
,
new
Rect
.
fromLTRB
(
0.0
,
0.0
,
view
.
width
*
devicePixelRatio
,
view
.
height
*
devicePixelRatio
));
canvas
.
scale
(
devicePixelRatio
,
devicePixelRatio
);
double
radius
=
size
.
shortestSide
*
0.45
;
Paint
paint
=
new
Paint
()..
color
=
new
Color
.
fromARGB
(
a
,
r
,
g
,
b
);
...
...
@@ -20,7 +21,7 @@ Picture draw(int a, int r, int g, int b) {
paintingNode
=
new
PaintingNode
();
Paint
innerPaint
=
new
Paint
()..
color
=
new
Color
.
fromARGB
(
a
,
255
-
r
,
255
-
g
,
255
-
b
);
PictureRecorder
innerRecorder
=
new
PictureRecorder
();
Canvas
innerCanvas
=
new
Canvas
(
innerRecorder
,
bounds
);
Canvas
innerCanvas
=
new
Canvas
(
innerRecorder
,
Point
.
origin
&
bounds
);
innerCanvas
.
drawCircle
(
size
.
center
(
Point
.
origin
),
radius
*
0.5
,
innerPaint
);
paintingNode
.
setBackingDrawable
(
innerRecorder
.
endRecordingAsDrawable
());
...
...
examples/raw/shadow.dart
View file @
c59f418f
...
...
@@ -7,7 +7,9 @@ import 'dart:sky';
void
beginFrame
(
double
timeStamp
)
{
double
size
=
100.0
;
PictureRecorder
recorder
=
new
PictureRecorder
();
Canvas
canvas
=
new
Canvas
(
recorder
,
new
Rect
.
fromLTWH
(
0.0
,
0.0
,
view
.
width
,
view
.
height
));
final
double
devicePixelRatio
=
view
.
devicePixelRatio
;
Canvas
canvas
=
new
Canvas
(
recorder
,
new
Rect
.
fromLTWH
(
0.0
,
0.0
,
view
.
width
*
devicePixelRatio
,
view
.
height
*
devicePixelRatio
));
canvas
.
scale
(
devicePixelRatio
,
devicePixelRatio
);
canvas
.
translate
(
size
+
10.0
,
size
+
10.0
);
Paint
paint
=
new
Paint
();
...
...
examples/raw/spinning_arabic.dart
View file @
c59f418f
...
...
@@ -13,7 +13,9 @@ void beginFrame(double timeStamp) {
timeBase
=
timeStamp
;
double
delta
=
timeStamp
-
timeBase
;
PictureRecorder
recorder
=
new
PictureRecorder
();
Canvas
canvas
=
new
Canvas
(
recorder
,
new
Rect
.
fromLTWH
(
0.0
,
0.0
,
view
.
width
,
view
.
height
));
final
double
devicePixelRatio
=
view
.
devicePixelRatio
;
Canvas
canvas
=
new
Canvas
(
recorder
,
new
Rect
.
fromLTWH
(
0.0
,
0.0
,
view
.
width
*
devicePixelRatio
,
view
.
height
*
devicePixelRatio
));
canvas
.
scale
(
devicePixelRatio
,
devicePixelRatio
);
canvas
.
translate
(
view
.
width
/
2.0
,
view
.
height
/
2.0
);
canvas
.
rotate
(
math
.
PI
*
delta
/
1800
);
canvas
.
drawRect
(
new
Rect
.
fromLTRB
(-
100.0
,
-
100.0
,
100.0
,
100.0
),
...
...
examples/raw/spinning_image.dart
View file @
c59f418f
...
...
@@ -18,7 +18,9 @@ void beginFrame(double timeStamp) {
timeBase
=
timeStamp
;
double
delta
=
timeStamp
-
timeBase
;
PictureRecorder
recorder
=
new
PictureRecorder
();
Canvas
canvas
=
new
Canvas
(
recorder
,
Point
.
origin
&
new
Size
(
view
.
width
,
view
.
height
));
final
double
devicePixelRatio
=
view
.
devicePixelRatio
;
Canvas
canvas
=
new
Canvas
(
recorder
,
Point
.
origin
&
new
Size
(
view
.
width
*
devicePixelRatio
,
view
.
height
*
devicePixelRatio
));
cavnas
.
scale
(
devicePixelRatio
,
devicePixelRatio
);
canvas
.
translate
(
view
.
width
/
2.0
,
view
.
height
/
2.0
);
canvas
.
rotate
(
math
.
PI
*
delta
/
1800
);
canvas
.
scale
(
0.2
,
0.2
);
...
...
examples/raw/spinning_square.dart
View file @
c59f418f
...
...
@@ -13,7 +13,9 @@ void beginFrame(double timeStamp) {
timeBase
=
timeStamp
;
double
delta
=
timeStamp
-
timeBase
;
PictureRecorder
recorder
=
new
PictureRecorder
();
Canvas
canvas
=
new
Canvas
(
recorder
,
new
Rect
.
fromLTWH
(
0.0
,
0.0
,
view
.
width
,
view
.
height
));
final
double
devicePixelRatio
=
view
.
devicePixelRatio
;
Canvas
canvas
=
new
Canvas
(
recorder
,
new
Rect
.
fromLTWH
(
0.0
,
0.0
,
view
.
width
*
devicePixelRatio
,
view
.
height
*
devicePixelRatio
));
canvas
.
scale
(
devicePixelRatio
,
devicePixelRatio
);
canvas
.
translate
(
view
.
width
/
2.0
,
view
.
height
/
2.0
);
canvas
.
rotate
(
math
.
PI
*
delta
/
1800
);
canvas
.
drawRect
(
new
Rect
.
fromLTRB
(-
100.0
,
-
100.0
,
100.0
,
100.0
),
...
...
packages/flutter/lib/rendering/box.dart
View file @
c59f418f
...
...
@@ -1716,9 +1716,13 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
void
paintFrame
()
{
sky
.
tracing
.
begin
(
'RenderView.paintFrame'
);
try
{
double
devicePixelRatio
=
sky
.
view
.
devicePixelRatio
;
sky
.
PictureRecorder
recorder
=
new
sky
.
PictureRecorder
();
PaintingCanvas
canvas
=
new
PaintingCanvas
(
recorder
,
paintBounds
);
canvas
.
drawPaintingNode
(
paintingNode
,
Point
.
origin
);
Rect
cullRect
=
Point
.
origin
&
(
size
*
devicePixelRatio
);
PaintingCanvas
canvas
=
new
PaintingCanvas
(
recorder
,
cullRect
);
canvas
.
drawColor
(
const
Color
(
0xFF000000
),
sky
.
TransferMode
.
src
);
canvas
.
scale
(
devicePixelRatio
,
devicePixelRatio
);
canvas
.
paintChild
(
child
,
Point
.
origin
);
sky
.
view
.
picture
=
recorder
.
endRecording
();
}
finally
{
sky
.
tracing
.
end
(
'RenderView.paintFrame'
);
...
...
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