mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
all: bring back panic(err.msg)
-> panic(err)
(#9022)
This commit is contained in:
parent
ce115dcbe0
commit
b712af56fd
110 changed files with 383 additions and 387 deletions
|
@ -98,15 +98,15 @@ fn new_image(w int, h int) Image {
|
|||
// write out a .ppm file
|
||||
fn (image Image) save_as_ppm(file_name string) {
|
||||
npixels := image.width * image.height
|
||||
mut f_out := os.create(file_name) or { panic(err.msg) }
|
||||
f_out.writeln('P3') or { panic(err.msg) }
|
||||
f_out.writeln('$image.width $image.height') or { panic(err.msg) }
|
||||
f_out.writeln('255') or { panic(err.msg) }
|
||||
mut f_out := os.create(file_name) or { panic(err) }
|
||||
f_out.writeln('P3') or { panic(err) }
|
||||
f_out.writeln('$image.width $image.height') or { panic(err) }
|
||||
f_out.writeln('255') or { panic(err) }
|
||||
for i in 0 .. npixels {
|
||||
c_r := to_int(unsafe { image.data[i] }.x)
|
||||
c_g := to_int(unsafe { image.data[i] }.y)
|
||||
c_b := to_int(unsafe { image.data[i] }.z)
|
||||
f_out.write_str('$c_r $c_g $c_b ') or { panic(err.msg) }
|
||||
f_out.write_str('$c_r $c_g $c_b ') or { panic(err) }
|
||||
}
|
||||
f_out.close()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue