mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ci: fix failing v -W build-tools
and v -W build-examples
; run vfmt.
This commit is contained in:
@ -87,7 +87,7 @@ fn (mut bmp BitMap) format_texture() {
|
||||
// write out a .ppm file
|
||||
pub fn (mut bmp BitMap) save_as_ppm(file_name string) {
|
||||
tmp_buf := bmp.buf
|
||||
mut buf := unsafe {malloc(bmp.buf_size)}
|
||||
mut buf := unsafe { malloc(bmp.buf_size) }
|
||||
unsafe { C.memcpy(buf, tmp_buf, bmp.buf_size) }
|
||||
bmp.buf = buf
|
||||
|
||||
@ -103,7 +103,7 @@ pub fn (mut bmp BitMap) save_as_ppm(file_name string) {
|
||||
c_r := bmp.buf[pos]
|
||||
c_g := bmp.buf[pos + 1]
|
||||
c_b := bmp.buf[pos + 2]
|
||||
f_out.write_str('$c_r $c_g $c_b ') or { panic(err) }
|
||||
f_out.write_string('$c_r $c_g $c_b ') or { panic(err) }
|
||||
}
|
||||
}
|
||||
f_out.close()
|
||||
|
@ -800,8 +800,8 @@ pub fn (mut bmp BitMap) draw_glyph(index u16) (int, int) {
|
||||
|
||||
// bmp.line(x0, y0, start_point.x, start_point.y, u32(0x00FF0000)
|
||||
// u32(0xFF000000))
|
||||
bmp.quadratic(x0, y0, start_point.x, start_point.y, (point.x +
|
||||
start_point.x) / 2, (point.y + start_point.y) / 2, color)
|
||||
bmp.quadratic(x0, y0, start_point.x, start_point.y, (point.x + start_point.x) / 2,
|
||||
(point.y + start_point.y) / 2, color)
|
||||
}
|
||||
} else {
|
||||
// last point not in a curve
|
||||
|
@ -53,10 +53,10 @@ pub fn (mut tf_skl TTF_render_Sokol) create_text(in_txt string, in_font_size f32
|
||||
// RAM buffer
|
||||
if sz > tf_skl.bmp.buf_size {
|
||||
if sz > 0 {
|
||||
unsafe {free(tf_skl.bmp.buf)}
|
||||
unsafe { free(tf_skl.bmp.buf) }
|
||||
}
|
||||
dprintln('create_text Alloc: $sz bytes')
|
||||
tf_skl.bmp.buf = unsafe {malloc(sz)}
|
||||
tf_skl.bmp.buf = unsafe { malloc(sz) }
|
||||
tf_skl.bmp.buf_size = sz
|
||||
}
|
||||
|
||||
@ -91,10 +91,10 @@ pub fn (mut tf_skl TTF_render_Sokol) create_text_block(in_txt string, in_w int,
|
||||
// RAM buffer
|
||||
if sz > tf_skl.bmp.buf_size {
|
||||
if sz > 0 {
|
||||
unsafe {free(tf_skl.bmp.buf)}
|
||||
unsafe { free(tf_skl.bmp.buf) }
|
||||
}
|
||||
dprintln('Alloc: $sz bytes')
|
||||
tf_skl.bmp.buf = unsafe {malloc(sz)}
|
||||
tf_skl.bmp.buf = unsafe { malloc(sz) }
|
||||
tf_skl.bmp.buf_size = sz
|
||||
}
|
||||
|
||||
|
@ -519,8 +519,8 @@ fn (mut tf TTF_File) get_fword() i16 {
|
||||
}
|
||||
|
||||
fn (mut tf TTF_File) get_u32() u32 {
|
||||
x := (u32(tf.buf[tf.pos]) << u32(24)) | (u32(tf.buf[tf.pos +
|
||||
1]) << u32(16)) | (u32(tf.buf[tf.pos + 2]) << u32(8)) | u32(tf.buf[tf.pos + 3])
|
||||
x := (u32(tf.buf[tf.pos]) << u32(24)) | (u32(tf.buf[tf.pos + 1]) << u32(16)) | (u32(tf.buf[
|
||||
tf.pos + 2]) << u32(8)) | u32(tf.buf[tf.pos + 3])
|
||||
tf.pos += 4
|
||||
return x
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ fn test_main() {
|
||||
|
||||
mut bmp := ttf.BitMap{
|
||||
tf: &tf
|
||||
buf: malloc(sz)
|
||||
buf: unsafe { malloc(sz) }
|
||||
buf_size: sz
|
||||
scale: scale
|
||||
width: w
|
||||
|
Reference in New Issue
Block a user