3
3
use fonterator:: footile;
4
4
use rvg:: * ;
5
5
6
- const BACK : & ' static [ u8 ] = include_bytes ! ( "../rvg/back.svg.rvg" ) ;
7
- const EXIT : & ' static [ u8 ] = include_bytes ! ( "../rvg/exit.svg.rvg" ) ;
8
- const FULLSCREEN : & ' static [ u8 ] = include_bytes ! ( "../rvg/fullscreen.svg.rvg" ) ;
9
- const GRID : & ' static [ u8 ] = include_bytes ! ( "../rvg/grid.svg.rvg" ) ;
10
- const HIDE : & ' static [ u8 ] = include_bytes ! ( "../rvg/hide.svg.rvg" ) ;
11
- const MENU : & ' static [ u8 ] = include_bytes ! ( "../rvg/menu.svg.rvg" ) ;
12
- const MORE : & ' static [ u8 ] = include_bytes ! ( "../rvg/more.svg.rvg" ) ;
13
- const NEW : & ' static [ u8 ] = include_bytes ! ( "../rvg/new.svg.rvg" ) ;
14
- const NEXT : & ' static [ u8 ] = include_bytes ! ( "../rvg/next.svg.rvg" ) ;
15
- const SEARCH : & ' static [ u8 ] = include_bytes ! ( "../rvg/search.svg.rvg" ) ;
16
- const VIEW : & ' static [ u8 ] = include_bytes ! ( "../rvg/view.svg.rvg" ) ;
17
- const ZOOM_IN : & ' static [ u8 ] = include_bytes ! ( "../rvg/zoom_in.svg.rvg" ) ;
18
- const ZOOM_OUT : & ' static [ u8 ] = include_bytes ! ( "../rvg/zoom_out.svg.rvg" ) ;
6
+ const BACK : & [ u8 ] = include_bytes ! ( "../rvg/back.svg.rvg" ) ;
7
+ const EXIT : & [ u8 ] = include_bytes ! ( "../rvg/exit.svg.rvg" ) ;
8
+ const FULLSCREEN : & [ u8 ] = include_bytes ! ( "../rvg/fullscreen.svg.rvg" ) ;
9
+ const GRID : & [ u8 ] = include_bytes ! ( "../rvg/grid.svg.rvg" ) ;
10
+ const HIDE : & [ u8 ] = include_bytes ! ( "../rvg/hide.svg.rvg" ) ;
11
+ const MENU : & [ u8 ] = include_bytes ! ( "../rvg/menu.svg.rvg" ) ;
12
+ const MORE : & [ u8 ] = include_bytes ! ( "../rvg/more.svg.rvg" ) ;
13
+ const NEW : & [ u8 ] = include_bytes ! ( "../rvg/new.svg.rvg" ) ;
14
+ const NEXT : & [ u8 ] = include_bytes ! ( "../rvg/next.svg.rvg" ) ;
15
+ const SEARCH : & [ u8 ] = include_bytes ! ( "../rvg/search.svg.rvg" ) ;
16
+ const VIEW : & [ u8 ] = include_bytes ! ( "../rvg/view.svg.rvg" ) ;
17
+ const ZOOM_IN : & [ u8 ] = include_bytes ! ( "../rvg/zoom_in.svg.rvg" ) ;
18
+ const ZOOM_OUT : & [ u8 ] = include_bytes ! ( "../rvg/zoom_out.svg.rvg" ) ;
19
19
20
20
pub fn text (
21
21
pixels : & mut [ footile:: Rgba8 ] ,
@@ -27,13 +27,14 @@ pub fn text(
27
27
let graphic_h = graphic_h / 2 ;
28
28
29
29
// Render
30
- let mut p = footile:: Plotter :: new ( width as u32 , graphic_h as u32 * 2 ) ;
30
+ let mut p =
31
+ footile:: Plotter :: new ( u32:: from ( width) , u32:: from ( graphic_h) * 2 ) ;
31
32
let r = footile:: RasterB :: new ( p. width ( ) , p. height ( ) ) ;
32
33
let path: Vec < _ > = font
33
34
. render (
34
- text, /*text*/
35
- ( 0.0 , 0.0 , width as f32 , graphic_h as f32 ) , /*bbox*/
36
- ( graphic_h as f32 , graphic_h as f32 ) , /*size*/
35
+ text, /*text*/
36
+ ( 0.0 , 0.0 , f32:: from ( width ) , f32:: from ( graphic_h ) ) , /*bbox*/
37
+ ( f32:: from ( graphic_h ) , f32:: from ( graphic_h ) ) , /*size*/
37
38
fonterator:: TextAlign :: Center ,
38
39
)
39
40
. 0
@@ -44,7 +45,7 @@ pub fn text(
44
45
unsafe {
45
46
std:: slice:: from_raw_parts_mut (
46
47
pixels. as_mut_ptr ( ) ,
47
- width as usize * graphic_h as usize * 2 ,
48
+ usize :: from ( width) * usize:: from ( graphic_h ) * 2 ,
48
49
)
49
50
} ,
50
51
) ;
@@ -62,7 +63,7 @@ fn half(
62
63
let ad = ( graphic_h / 2 ) - ( margin) ;
63
64
64
65
let offs = if x > 6 {
65
- x = x - 6 ;
66
+ x -= 6 ;
66
67
width - ( 8 * ad)
67
68
} else {
68
69
0
@@ -82,7 +83,7 @@ fn full(
82
83
let ad = ( graphic_h / 2 ) - ( margin) ;
83
84
84
85
let offs = if x > 6 {
85
- x = x - 6 ;
86
+ x -= 6 ;
86
87
width - ( 8 * ad)
87
88
} else {
88
89
0
0 commit comments