Skip to content

Commit e4e714c

Browse files
gsk: Stroke API fixes
1 parent 215211b commit e4e714c

File tree

2 files changed

+41
-16
lines changed

2 files changed

+41
-16
lines changed

gsk4/Gir.toml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ generate = [
4646
"Gsk.RoundedClipNode",
4747
"Gsk.ScalingFilter",
4848
"Gsk.SerializationError",
49-
"Gsk.Stroke",
5049
"Gsk.StrokeNode",
5150
"Gsk.TextureNode",
5251
"Gsk.TextureScaleNode",
@@ -234,6 +233,25 @@ status = "generate"
234233
name = "get_shadow"
235234
manual = true # assert that i < n_shadows
236235

236+
[[object]]
237+
name = "Gsk.Stroke"
238+
status = "generate"
239+
[[object.function]]
240+
name = "to_cairo"
241+
[[object.function.parameter]]
242+
name = "cr"
243+
const = true
244+
[[object.function]]
245+
pattern = "set_(dash|dash_offset|line_cap|line_join|line_width|miter_limit)"
246+
[[object.function.parameter]]
247+
name = "self"
248+
const = true
249+
[[object.function]]
250+
name = "equal"
251+
[[object.function.parameter]]
252+
name = "stroke2"
253+
nullable = false
254+
237255
[[object]]
238256
name = "Gsk.TextNode"
239257
status = "generate"

gsk4/src/auto/stroke.rs

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,57 +68,64 @@ impl Stroke {
6868
}
6969

7070
#[doc(alias = "gsk_stroke_set_dash")]
71-
pub fn set_dash(&mut self, dash: &[f32]) {
71+
pub fn set_dash(&self, dash: &[f32]) {
7272
let n_dash = dash.len() as _;
7373
unsafe {
74-
ffi::gsk_stroke_set_dash(self.to_glib_none_mut().0, dash.to_glib_none().0, n_dash);
74+
ffi::gsk_stroke_set_dash(
75+
mut_override(self.to_glib_none().0),
76+
dash.to_glib_none().0,
77+
n_dash,
78+
);
7579
}
7680
}
7781

7882
#[doc(alias = "gsk_stroke_set_dash_offset")]
79-
pub fn set_dash_offset(&mut self, offset: f32) {
83+
pub fn set_dash_offset(&self, offset: f32) {
8084
unsafe {
81-
ffi::gsk_stroke_set_dash_offset(self.to_glib_none_mut().0, offset);
85+
ffi::gsk_stroke_set_dash_offset(mut_override(self.to_glib_none().0), offset);
8286
}
8387
}
8488

8589
#[doc(alias = "gsk_stroke_set_line_cap")]
86-
pub fn set_line_cap(&mut self, line_cap: LineCap) {
90+
pub fn set_line_cap(&self, line_cap: LineCap) {
8791
unsafe {
88-
ffi::gsk_stroke_set_line_cap(self.to_glib_none_mut().0, line_cap.into_glib());
92+
ffi::gsk_stroke_set_line_cap(mut_override(self.to_glib_none().0), line_cap.into_glib());
8993
}
9094
}
9195

9296
#[doc(alias = "gsk_stroke_set_line_join")]
93-
pub fn set_line_join(&mut self, line_join: LineJoin) {
97+
pub fn set_line_join(&self, line_join: LineJoin) {
9498
unsafe {
95-
ffi::gsk_stroke_set_line_join(self.to_glib_none_mut().0, line_join.into_glib());
99+
ffi::gsk_stroke_set_line_join(
100+
mut_override(self.to_glib_none().0),
101+
line_join.into_glib(),
102+
);
96103
}
97104
}
98105

99106
#[doc(alias = "gsk_stroke_set_line_width")]
100-
pub fn set_line_width(&mut self, line_width: f32) {
107+
pub fn set_line_width(&self, line_width: f32) {
101108
unsafe {
102-
ffi::gsk_stroke_set_line_width(self.to_glib_none_mut().0, line_width);
109+
ffi::gsk_stroke_set_line_width(mut_override(self.to_glib_none().0), line_width);
103110
}
104111
}
105112

106113
#[doc(alias = "gsk_stroke_set_miter_limit")]
107-
pub fn set_miter_limit(&mut self, limit: f32) {
114+
pub fn set_miter_limit(&self, limit: f32) {
108115
unsafe {
109-
ffi::gsk_stroke_set_miter_limit(self.to_glib_none_mut().0, limit);
116+
ffi::gsk_stroke_set_miter_limit(mut_override(self.to_glib_none().0), limit);
110117
}
111118
}
112119

113120
#[doc(alias = "gsk_stroke_to_cairo")]
114-
pub fn to_cairo(&self, cr: &mut cairo::Context) {
121+
pub fn to_cairo(&self, cr: &cairo::Context) {
115122
unsafe {
116-
ffi::gsk_stroke_to_cairo(self.to_glib_none().0, cr.to_glib_none_mut().0);
123+
ffi::gsk_stroke_to_cairo(self.to_glib_none().0, mut_override(cr.to_glib_none().0));
117124
}
118125
}
119126

120127
#[doc(alias = "gsk_stroke_equal")]
121-
fn equal(&self, stroke2: Option<&Stroke>) -> bool {
128+
fn equal(&self, stroke2: &Stroke) -> bool {
122129
assert_initialized_main_thread!();
123130
unsafe {
124131
from_glib(ffi::gsk_stroke_equal(

0 commit comments

Comments
 (0)