@@ -65,15 +65,15 @@ impl CanvasBackend {
6565 /// Sets the stroke style and line width in the underlying context.
6666 fn set_line_style ( & mut self , style : & impl BackendStyle ) {
6767 self . context
68- . set_stroke_style ( & make_canvas_color ( style. color ( ) ) ) ;
68+ . set_stroke_style_str ( & make_canvas_color ( style. color ( ) ) ) ;
6969 self . context . set_line_width ( style. stroke_width ( ) as f64 ) ;
7070 }
7171}
7272
73- fn make_canvas_color ( color : BackendColor ) -> JsValue {
73+ fn make_canvas_color ( color : BackendColor ) -> String {
7474 let ( r, g, b) = color. rgb ;
7575 let a = color. alpha ;
76- format ! ( "rgba({},{},{},{})" , r, g, b, a) . into ( )
76+ format ! ( "rgba({},{},{},{})" , r, g, b, a)
7777}
7878
7979impl DrawingBackend for CanvasBackend {
@@ -101,7 +101,7 @@ impl DrawingBackend for CanvasBackend {
101101 }
102102
103103 self . context
104- . set_fill_style ( & make_canvas_color ( style. color ( ) ) ) ;
104+ . set_fill_style_str ( & make_canvas_color ( style. color ( ) ) ) ;
105105 self . context
106106 . fill_rect ( f64:: from ( point. 0 ) , f64:: from ( point. 1 ) , 1.0 , 1.0 ) ;
107107 Ok ( ( ) )
@@ -138,7 +138,7 @@ impl DrawingBackend for CanvasBackend {
138138 }
139139 if fill {
140140 self . context
141- . set_fill_style ( & make_canvas_color ( style. color ( ) ) ) ;
141+ . set_fill_style_str ( & make_canvas_color ( style. color ( ) ) ) ;
142142 self . context . fill_rect (
143143 f64:: from ( upper_left. 0 ) ,
144144 f64:: from ( upper_left. 1 ) ,
@@ -190,7 +190,7 @@ impl DrawingBackend for CanvasBackend {
190190 self . context . begin_path ( ) ;
191191 if let Some ( start) = path. next ( ) {
192192 self . context
193- . set_fill_style ( & make_canvas_color ( style. color ( ) ) ) ;
193+ . set_fill_style_str ( & make_canvas_color ( style. color ( ) ) ) ;
194194 self . context . move_to ( f64:: from ( start. 0 ) , f64:: from ( start. 1 ) ) ;
195195 for next in path {
196196 self . context . line_to ( f64:: from ( next. 0 ) , f64:: from ( next. 1 ) ) ;
@@ -213,7 +213,7 @@ impl DrawingBackend for CanvasBackend {
213213 }
214214 if fill {
215215 self . context
216- . set_fill_style ( & make_canvas_color ( style. color ( ) ) ) ;
216+ . set_fill_style_str ( & make_canvas_color ( style. color ( ) ) ) ;
217217 } else {
218218 self . set_line_style ( style) ;
219219 }
@@ -281,7 +281,7 @@ impl DrawingBackend for CanvasBackend {
281281 self . context . set_text_align ( text_align) ;
282282
283283 self . context
284- . set_fill_style ( & make_canvas_color ( color. clone ( ) ) ) ;
284+ . set_fill_style_str ( & make_canvas_color ( color. clone ( ) ) ) ;
285285 self . context . set_font ( & format ! (
286286 "{} {}px {}" ,
287287 style. style( ) . as_str( ) ,
0 commit comments