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
4f8de2ee
Commit
4f8de2ee
authored
Jul 24, 2015
by
Eric Seidel
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #271 from eseidelGoogle/draw_atlas
Use Skia's drawAtlas now that we've rolled to a newer Skia
parents
9ac347da
7a1e3bb3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
34 deletions
+2
-34
particle_system.dart
packages/flutter/example/game/lib/particle_system.dart
+2
-34
No files found.
packages/flutter/example/game/lib/particle_system.dart
View file @
4f8de2ee
...
@@ -272,45 +272,13 @@ class ParticleSystem extends Node {
...
@@ -272,45 +272,13 @@ class ParticleSystem extends Node {
colors
.
add
(
particleColor
);
colors
.
add
(
particleColor
);
}
}
// TODO(viktork): Verify that the C++ version looks right and is faster!
Paint
paint
=
new
Paint
()..
setTransferMode
(
transferMode
)
Paint
paint
=
new
Paint
()..
setTransferMode
(
transferMode
)
..
setFilterQuality
(
FilterQuality
.
low
)
// All Skia examples do this.
..
setFilterQuality
(
FilterQuality
.
low
)
// All Skia examples do this.
..
isAntiAlias
=
false
;
// Antialiasing breaks SkCanvas.drawAtlas?
..
isAntiAlias
=
false
;
// Antialiasing breaks SkCanvas.drawAtlas?
// return canvas.drawAtlas(texture.image, transforms, rects, colors,
return
canvas
.
drawAtlas
(
texture
.
image
,
transforms
,
rects
,
colors
,
// TransferMode.modulate, null, paint);
TransferMode
.
modulate
,
null
,
paint
);
dartDrawAtlas
(
canvas
,
texture
.
image
,
transforms
,
rects
,
colors
,
TransferMode
.
modulate
,
paint
);
}
}
double
randMinus1To1
()
=>
_rand
.
nextDouble
()
*
2.0
-
1.0
;
double
randMinus1To1
()
=>
_rand
.
nextDouble
()
*
2.0
-
1.0
;
}
}
void
dartDrawAtlas
(
Canvas
canvas
,
Image
image
,
List
<
RSTransform
>
transforms
,
List
<
Rect
>
rects
,
List
<
Color
>
colors
,
TransferMode
transferMode
,
Paint
paint
)
{
assert
(
transforms
.
length
==
rects
.
length
&&
transforms
.
length
==
colors
.
length
);
Texture
mainTexture
=
new
Texture
(
image
);
for
(
int
i
=
0
;
i
<
transforms
.
length
;
i
++)
{
RSTransform
transform
=
transforms
[
i
];
Rect
rect
=
rects
[
i
];
Color
color
=
colors
[
i
];
canvas
.
save
();
Matrix4
matrix
=
new
Matrix4
(
transform
.
scos
,
transform
.
ssin
,
0.0
,
0.0
,
-
transform
.
ssin
,
transform
.
scos
,
0.0
,
0.0
,
0.0
,
0.0
,
1.0
,
0.0
,
transform
.
tx
,
transform
.
ty
,
0.0
,
1.0
);
canvas
.
concat
(
matrix
.
storage
);
paint
.
setColorFilter
(
new
ColorFilter
.
mode
(
color
,
transferMode
));
paint
.
color
=
color
;
Texture
texture
=
mainTexture
.
textureFromRect
(
rect
);
texture
.
drawTexture
(
canvas
,
new
Point
(-
texture
.
size
.
width
/
2.0
,
-
texture
.
size
.
height
/
2.0
),
paint
);
canvas
.
restore
();
}
}
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