chore: Update lyon to 0.17.1

This commit is contained in:
relrelb 2021-01-04 22:45:16 +02:00 committed by Mike Welsh
parent de761f5b7c
commit 9a8edda8a6
8 changed files with 38 additions and 46 deletions

20
Cargo.lock generated
View File

@ -2024,9 +2024,9 @@ dependencies = [
[[package]]
name = "lyon"
version = "0.16.2"
version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d083e12e9e22298eec27751ec4a0975abac5873a3b0dcdbbecc608d333f0e9"
checksum = "b155165bdd52011118a39433bee2cbbc7064b6eacf38a22ac90474113e3f99fa"
dependencies = [
"lyon_algorithms",
"lyon_tessellation",
@ -2034,9 +2034,9 @@ dependencies = [
[[package]]
name = "lyon_algorithms"
version = "0.16.0"
version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11033936a5e9d7bf35b7ba71a19f8b6bc838f3206304175dc5b3524ca16672a8"
checksum = "ac507017460ad0b92198503945cb164e71465cdfd84063f5eed9af9356ccd093"
dependencies = [
"lyon_path",
"sid",
@ -2044,9 +2044,9 @@ dependencies = [
[[package]]
name = "lyon_geom"
version = "0.16.2"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce4e12203c428a58200b8cf1c0a3aad1cda907008ea11310bb3729593e5f933"
checksum = "edb987cd391542608ca8d43c0cd5ec44ebe4a0957eb89769a316c99d7fe14537"
dependencies = [
"arrayvec",
"euclid",
@ -2055,18 +2055,18 @@ dependencies = [
[[package]]
name = "lyon_path"
version = "0.16.2"
version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "243c71fff16677ecde2d38794a0253a8f0417cebaacc6390677c30733831d8cb"
checksum = "23d64beb93be63439bc744041d132d62fdec831181eeb474f675e5f6a81f5ac1"
dependencies = [
"lyon_geom",
]
[[package]]
name = "lyon_tessellation"
version = "0.16.2"
version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ecf3d769bec66396957d7c5cb91f998c4182e53fdc96cc435b6ebcd46a63cd9"
checksum = "b7b129db831024ac1f8cab7205bd0027d1eca5e1aa28b15ebe63019df8363aa9"
dependencies = [
"arrayvec",
"lyon_path",

View File

@ -16,7 +16,7 @@ generational-arena = "0.2.8"
image = "0.23.12"
jpeg-decoder = "0.1.20"
log = "0.4"
lyon = "0.16.2"
lyon = "0.17.1"
dasp = {version = "0.11.0", git = "https://github.com/RustAudio/dasp", rev = "f05a703", features = ["interpolate", "interpolate-linear", "signal"]}
winit = "0.24.0"
webbrowser = "0.5.5"

View File

@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"
[dependencies]
log = "0.4"
lyon = "0.16.2"
lyon = "0.17.1"
[dependencies.ruffle_core]
path = "../../core"

View File

@ -2,7 +2,7 @@ use lyon::path::Path;
use lyon::tessellation::{
self,
geometry_builder::{BuffersBuilder, FillVertexConstructor, VertexBuffers},
FillAttributes, FillTessellator, StrokeAttributes, StrokeTessellator, StrokeVertexConstructor,
FillTessellator, FillVertex, StrokeTessellator, StrokeVertex, StrokeVertexConstructor,
};
use lyon::tessellation::{FillOptions, StrokeOptions};
use ruffle_core::backend::render::{
@ -412,17 +412,7 @@ fn ruffle_path_to_lyon_path(commands: Vec<DrawCommand>, is_closed: bool) -> Path
while let Some(cmd) = cmds.next() {
match cmd {
DrawCommand::MoveTo { x, y } => {
// Lyon (incorrectly?) will make a 0-length line segment if you have consecutive MoveTos.
// Filter out consecutive MoveTos, only committing the last one.
let mut cursor_pos = (x, y);
while let Some(DrawCommand::MoveTo { x, y }) = cmds.peek() {
cursor_pos = (*x, *y);
cmds.next();
}
if cmds.peek().is_some() {
builder.move_to(point(cursor_pos.0, cursor_pos.1));
}
builder.begin(point(x, y));
}
DrawCommand::LineTo { x, y } => {
builder.line_to(point(x, y));
@ -431,10 +421,16 @@ fn ruffle_path_to_lyon_path(commands: Vec<DrawCommand>, is_closed: bool) -> Path
builder.quadratic_bezier_to(point(x1, y1), point(x2, y2));
}
}
if let Some(DrawCommand::MoveTo { .. }) = cmds.peek() {
builder.end(false);
}
}
if is_closed {
builder.close();
} else {
builder.end(false);
}
builder.build()
@ -445,18 +441,18 @@ struct RuffleVertexCtor {
}
impl FillVertexConstructor<Vertex> for RuffleVertexCtor {
fn new_vertex(&mut self, position: lyon::math::Point, _: FillAttributes) -> Vertex {
fn new_vertex(&mut self, vertex: FillVertex) -> Vertex {
Vertex {
position: [position.x, position.y],
position: [vertex.position().x, vertex.position().y],
color: self.color,
}
}
}
impl StrokeVertexConstructor<Vertex> for RuffleVertexCtor {
fn new_vertex(&mut self, position: lyon::math::Point, _: StrokeAttributes) -> Vertex {
fn new_vertex(&mut self, vertex: StrokeVertex) -> Vertex {
Vertex {
position: [position.x, position.y],
position: [vertex.position().x, vertex.position().y],
color: self.color,
}
}

View File

@ -10,7 +10,7 @@ wgpu = { git = "https://github.com/gfx-rs/wgpu-rs", rev = "c0418b1b8ae22e86fd0e7
image = "0.23.12"
jpeg-decoder = "0.1.20"
log = "0.4"
lyon = "0.16.2"
lyon = "0.17.1"
ruffle_core = { path = "../../core" }
futures = "0.3.8"
bytemuck = "1.4.1"

View File

@ -1,7 +1,7 @@
use lyon::tessellation::{
self,
geometry_builder::{BuffersBuilder, FillVertexConstructor, VertexBuffers},
FillAttributes, FillTessellator, StrokeAttributes, StrokeTessellator, StrokeVertexConstructor,
FillTessellator, FillVertex, StrokeTessellator, StrokeVertex, StrokeVertexConstructor,
};
use ruffle_core::backend::render::swf::{self, FillStyle};
use ruffle_core::backend::render::{
@ -1511,18 +1511,18 @@ struct RuffleVertexCtor {
}
impl FillVertexConstructor<GPUVertex> for RuffleVertexCtor {
fn new_vertex(&mut self, position: lyon::math::Point, _: FillAttributes) -> GPUVertex {
fn new_vertex(&mut self, vertex: FillVertex) -> GPUVertex {
GPUVertex {
position: [position.x, position.y],
position: [vertex.position().x, vertex.position().y],
color: self.color,
}
}
}
impl StrokeVertexConstructor<GPUVertex> for RuffleVertexCtor {
fn new_vertex(&mut self, position: lyon::math::Point, _: StrokeAttributes) -> GPUVertex {
fn new_vertex(&mut self, vertex: StrokeVertex) -> GPUVertex {
GPUVertex {
position: [position.x, position.y],
position: [vertex.position().x, vertex.position().y],
color: self.color,
}
}

View File

@ -77,17 +77,7 @@ pub fn ruffle_path_to_lyon_path(commands: Vec<DrawCommand>, is_closed: bool) ->
while let Some(cmd) = cmds.next() {
match cmd {
DrawCommand::MoveTo { x, y } => {
// Lyon (incorrectly?) will make a 0-length line segment if you have consecutive MoveTos.
// Filter out consecutive MoveTos, only committing the last one.
let mut cursor_pos = (x, y);
while let Some(DrawCommand::MoveTo { x, y }) = cmds.peek() {
cursor_pos = (*x, *y);
cmds.next();
}
if cmds.peek().is_some() {
builder.move_to(point(cursor_pos.0, cursor_pos.1));
}
builder.begin(point(x, y));
}
DrawCommand::LineTo { x, y } => {
builder.line_to(point(x, y));
@ -96,10 +86,16 @@ pub fn ruffle_path_to_lyon_path(commands: Vec<DrawCommand>, is_closed: bool) ->
builder.quadratic_bezier_to(point(x1, y1), point(x2, y2));
}
}
if let Some(DrawCommand::MoveTo { .. }) = cmds.peek() {
builder.end(false);
}
}
if is_closed {
builder.close();
} else {
builder.end(false);
}
builder.build()