@@ -65,15 +65,15 @@ impl CanvasBackend {
65
65
/// Sets the stroke style and line width in the underlying context.
66
66
fn set_line_style ( & mut self , style : & impl BackendStyle ) {
67
67
self . context
68
- . set_stroke_style ( & make_canvas_color ( style. color ( ) ) ) ;
68
+ . set_stroke_style_str ( & make_canvas_color ( style. color ( ) ) ) ;
69
69
self . context . set_line_width ( style. stroke_width ( ) as f64 ) ;
70
70
}
71
71
}
72
72
73
- fn make_canvas_color ( color : BackendColor ) -> JsValue {
73
+ fn make_canvas_color ( color : BackendColor ) -> String {
74
74
let ( r, g, b) = color. rgb ;
75
75
let a = color. alpha ;
76
- format ! ( "rgba({},{},{},{})" , r, g, b, a) . into ( )
76
+ format ! ( "rgba({},{},{},{})" , r, g, b, a)
77
77
}
78
78
79
79
impl DrawingBackend for CanvasBackend {
@@ -101,7 +101,7 @@ impl DrawingBackend for CanvasBackend {
101
101
}
102
102
103
103
self . context
104
- . set_fill_style ( & make_canvas_color ( style. color ( ) ) ) ;
104
+ . set_fill_style_str ( & make_canvas_color ( style. color ( ) ) ) ;
105
105
self . context
106
106
. fill_rect ( f64:: from ( point. 0 ) , f64:: from ( point. 1 ) , 1.0 , 1.0 ) ;
107
107
Ok ( ( ) )
@@ -138,7 +138,7 @@ impl DrawingBackend for CanvasBackend {
138
138
}
139
139
if fill {
140
140
self . context
141
- . set_fill_style ( & make_canvas_color ( style. color ( ) ) ) ;
141
+ . set_fill_style_str ( & make_canvas_color ( style. color ( ) ) ) ;
142
142
self . context . fill_rect (
143
143
f64:: from ( upper_left. 0 ) ,
144
144
f64:: from ( upper_left. 1 ) ,
@@ -190,7 +190,7 @@ impl DrawingBackend for CanvasBackend {
190
190
self . context . begin_path ( ) ;
191
191
if let Some ( start) = path. next ( ) {
192
192
self . context
193
- . set_fill_style ( & make_canvas_color ( style. color ( ) ) ) ;
193
+ . set_fill_style_str ( & make_canvas_color ( style. color ( ) ) ) ;
194
194
self . context . move_to ( f64:: from ( start. 0 ) , f64:: from ( start. 1 ) ) ;
195
195
for next in path {
196
196
self . context . line_to ( f64:: from ( next. 0 ) , f64:: from ( next. 1 ) ) ;
@@ -213,7 +213,7 @@ impl DrawingBackend for CanvasBackend {
213
213
}
214
214
if fill {
215
215
self . context
216
- . set_fill_style ( & make_canvas_color ( style. color ( ) ) ) ;
216
+ . set_fill_style_str ( & make_canvas_color ( style. color ( ) ) ) ;
217
217
} else {
218
218
self . set_line_style ( style) ;
219
219
}
@@ -281,7 +281,7 @@ impl DrawingBackend for CanvasBackend {
281
281
self . context . set_text_align ( text_align) ;
282
282
283
283
self . context
284
- . set_fill_style ( & make_canvas_color ( color. clone ( ) ) ) ;
284
+ . set_fill_style_str ( & make_canvas_color ( color. clone ( ) ) ) ;
285
285
self . context . set_font ( & format ! (
286
286
"{} {}px {}" ,
287
287
style. style( ) . as_str( ) ,
0 commit comments