Skip to content

Commit 3000c62

Browse files
committed
Update for piet 0.4.0 and kurbo 0.8.0
Not a lot of breakage here, although there might be a bit more upstream.
1 parent 11e4bc2 commit 3000c62

File tree

7 files changed

+26
-14
lines changed

7 files changed

+26
-14
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: install libx11-dev
3838
run: |
3939
sudo apt update
40-
sudo apt install libx11-dev
40+
sudo apt install libx11-dev libpango1.0-dev
4141
if: contains(matrix.os, 'ubuntu')
4242

4343
- name: install stable toolchain
@@ -263,7 +263,7 @@ jobs:
263263
- name: install libx11-dev
264264
run: |
265265
sudo apt update
266-
sudo apt install libx11-dev
266+
sudo apt install libx11-dev libpango1.0-dev
267267
if: contains(matrix.os, 'ubuntu')
268268

269269
- name: install nightly toolchain

druid-shell/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ default-target = "x86_64-pc-windows-msvc"
1717
default = ["gtk"]
1818
gtk = ["gio", "gdk", "gdk-sys", "glib", "glib-sys", "gtk-sys", "gtk-rs", "gdk-pixbuf"]
1919
x11 = ["x11rb", "nix", "cairo-sys-rs"]
20-
# Implement HasRawWindowHandle for WindowHandle
20+
# Implement HasRawWindowHandle for WindowHandle
2121
raw-win-handle = ["raw-window-handle"]
2222

2323
# passing on all the image features. AVIF is not supported because it does not
@@ -40,8 +40,8 @@ hdr = ["piet-common/hdr"]
4040
[dependencies]
4141
# NOTE: When changing the piet or kurbo versions, ensure that
4242
# the kurbo version included in piet is compatible with the kurbo version specified here.
43-
piet-common = "=0.3.2"
44-
kurbo = "0.7.1"
43+
piet-common = "=0.4.0"
44+
kurbo = "0.8.1"
4545

4646
tracing = "0.1.22"
4747
lazy_static = "1.4.0"
@@ -99,7 +99,7 @@ version = "0.3.44"
9999
features = ["Window", "MouseEvent", "CssStyleDeclaration", "WheelEvent", "KeyEvent", "KeyboardEvent"]
100100

101101
[dev-dependencies]
102-
piet-common = { version = "=0.3.2", features = ["png"] }
102+
piet-common = { version = "=0.4.0", features = ["png"] }
103103
static_assertions = "1.1.0"
104104
test-env-log = { version = "0.2.5", features = ["trace"], default-features = false }
105105
tracing-subscriber = "0.2.15"

druid-shell/src/platform/windows/window.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,8 @@ impl WndState {
434434
.unwrap()
435435
});
436436

437-
let mut piet_ctx = Piet::new(d2d, dw.clone(), rt);
437+
let text = PietText::new(dw.clone());
438+
let mut piet_ctx = Piet::new(d2d, text, rt);
438439

439440
// Clear the background if transparency DC is found
440441
if let Some(dc) = dc_for_transparency {

druid/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ console_error_panic_hook = { version = "0.1.6" }
7878
float-cmp = { version = "0.8.0", features = ["std"], default-features = false }
7979
# tempfile 3.2.0 broke wasm; I assume it will be yanked (Jan 12, 2021)
8080
tempfile = "=3.1.0"
81-
piet-common = { version = "=0.3.2", features = ["png"] }
81+
piet-common = { version = "=0.4.0", features = ["png"] }
8282
pulldown-cmark = { version = "0.8", default-features = false }
8383
test-env-log = { version = "0.2.5", features = ["trace"], default-features = false }
8484

druid/src/data.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,18 @@ impl Data for kurbo::Rect {
413413
}
414414
}
415415

416+
impl Data for kurbo::RoundedRectRadii {
417+
fn same(&self, other: &Self) -> bool {
418+
self.top_left.same(&other.top_left)
419+
&& self.top_right.same(&other.top_right)
420+
&& self.bottom_left.same(&other.bottom_left)
421+
&& self.bottom_right.same(&other.bottom_right)
422+
}
423+
}
424+
416425
impl Data for kurbo::RoundedRect {
417426
fn same(&self, other: &Self) -> bool {
418-
self.rect().same(&other.rect()) && self.radius().same(&other.radius())
427+
self.rect().same(&other.rect()) && self.radii().same(&other.radii())
419428
}
420429
}
421430

druid/src/widget/flex.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ impl<T: Data> Widget<T> for Flex<T> {
823823
let color = env.get_debug_color(ctx.widget_id().to_raw());
824824
let my_baseline = ctx.size().height - ctx.widget_state.baseline_offset;
825825
let line = crate::kurbo::Line::new((0.0, my_baseline), (ctx.size().width, my_baseline));
826-
let stroke_style = crate::piet::StrokeStyle::new().dash(vec![4.0, 4.0], 0.0);
826+
let stroke_style = crate::piet::StrokeStyle::new().dash_pattern(&[4.0, 4.0]);
827827
ctx.stroke_styled(line, &color, 1.0, &stroke_style);
828828
}
829829
}

druid/src/widget/svg.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -311,18 +311,20 @@ impl SvgRenderer {
311311
let brush = self.brush_from_usvg(&stroke.paint, stroke.opacity, ctx);
312312
let mut stroke_style = StrokeStyle::new()
313313
.line_join(match stroke.linejoin {
314-
usvg::LineJoin::Miter => LineJoin::Miter,
314+
usvg::LineJoin::Miter => LineJoin::Miter {
315+
limit: stroke.miterlimit.value(),
316+
},
315317
usvg::LineJoin::Round => LineJoin::Round,
316318
usvg::LineJoin::Bevel => LineJoin::Bevel,
317319
})
318320
.line_cap(match stroke.linecap {
319321
usvg::LineCap::Butt => LineCap::Butt,
320322
usvg::LineCap::Round => LineCap::Round,
321323
usvg::LineCap::Square => LineCap::Square,
322-
})
323-
.miter_limit(stroke.miterlimit.value());
324+
});
324325
if let Some(dash_array) = &stroke.dasharray {
325-
stroke_style.set_dash(dash_array.clone(), stroke.dashoffset as f64);
326+
stroke_style.set_dash_pattern(dash_array.as_slice());
327+
stroke_style.set_dash_offset(stroke.dashoffset as f64);
326328
}
327329
ctx.stroke_styled(path, &*brush, stroke.width.value(), &stroke_style);
328330
}

0 commit comments

Comments
 (0)