diff options
| author | Benoit Jacquier <benoit.jacquier@gmail.com> | 2022-08-27 16:22:37 +0200 |
|---|---|---|
| committer | Benoit Jacquier <benoit.jacquier@gmail.com> | 2022-08-27 16:22:37 +0200 |
| commit | 4e5337412a4e46fb26250f8adf1d019ddd8366c7 (patch) | |
| tree | a49c22bd4c894a26ddf8da92c10894fb8e03383f /core/image | |
| parent | 00f2e911a73e99b1283306272ff433984d90486c (diff) | |
| parent | c82d7d3d87c2dc77ce942b1cc450734baca3da14 (diff) | |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'core/image')
| -rw-r--r-- | core/image/common.odin | 10 | ||||
| -rw-r--r-- | core/image/png/example.odin | 2 | ||||
| -rw-r--r-- | core/image/png/png.odin | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/core/image/common.odin b/core/image/common.odin index beb3f93ee..a627fa68b 100644 --- a/core/image/common.odin +++ b/core/image/common.odin @@ -475,7 +475,7 @@ return_single_channel :: proc(img: ^Image, channel: Channel) -> (res: ^Image, ok } // Does the image have 1 or 2 channels, a valid bit depth (8 or 16), -// Is the pointer valid, are the dimenions valid? +// Is the pointer valid, are the dimensions valid? is_valid_grayscale_image :: proc(img: ^Image) -> (ok: bool) { // Were we actually given a valid image? if img == nil { @@ -495,7 +495,7 @@ is_valid_grayscale_image :: proc(img: ^Image) -> (ok: bool) { // This returns 0 if any of the inputs is zero. bytes_expected := compute_buffer_size(img.width, img.height, img.channels, img.depth) - // If the dimenions are invalid or the buffer size doesn't match the image characteristics, bail. + // If the dimensions are invalid or the buffer size doesn't match the image characteristics, bail. if bytes_expected == 0 || bytes_expected != len(img.pixels.buf) || img.width * img.height > MAX_DIMENSIONS { return false } @@ -504,7 +504,7 @@ is_valid_grayscale_image :: proc(img: ^Image) -> (ok: bool) { } // Does the image have 3 or 4 channels, a valid bit depth (8 or 16), -// Is the pointer valid, are the dimenions valid? +// Is the pointer valid, are the dimensions valid? is_valid_color_image :: proc(img: ^Image) -> (ok: bool) { // Were we actually given a valid image? if img == nil { @@ -524,7 +524,7 @@ is_valid_color_image :: proc(img: ^Image) -> (ok: bool) { // This returns 0 if any of the inputs is zero. bytes_expected := compute_buffer_size(img.width, img.height, img.channels, img.depth) - // If the dimenions are invalid or the buffer size doesn't match the image characteristics, bail. + // If the dimensions are invalid or the buffer size doesn't match the image characteristics, bail. if bytes_expected == 0 || bytes_expected != len(img.pixels.buf) || img.width * img.height > MAX_DIMENSIONS { return false } @@ -533,7 +533,7 @@ is_valid_color_image :: proc(img: ^Image) -> (ok: bool) { } // Does the image have 1..4 channels, a valid bit depth (8 or 16), -// Is the pointer valid, are the dimenions valid? +// Is the pointer valid, are the dimensions valid? is_valid_image :: proc(img: ^Image) -> (ok: bool) { // Were we actually given a valid image? if img == nil { diff --git a/core/image/png/example.odin b/core/image/png/example.odin index 17436c260..c1e2f0c73 100644 --- a/core/image/png/example.odin +++ b/core/image/png/example.odin @@ -219,7 +219,7 @@ write_image_as_ppm :: proc(filename: string, image: ^image.Image) -> (success: b defer close(fd) write_string(fd, - fmt.tprintf("P6\n%v %v\n%v\n", width, height, (1 << uint(depth) - 1)), + fmt.tprintf("P6\n%v %v\n%v\n", width, height, uint(1 << uint(depth) - 1)), ) if channels == 3 { diff --git a/core/image/png/png.odin b/core/image/png/png.odin index 35fdb58d8..3faa39c83 100644 --- a/core/image/png/png.odin +++ b/core/image/png/png.odin @@ -1002,7 +1002,7 @@ load_from_context :: proc(ctx: ^$C, options := Options{}, allocator := context.a o16 = o16[out_image_channels:] } case: - unreachable("We should never seen # channels other than 1-4 inclusive.") + panic("We should never seen # channels other than 1-4 inclusive.") } img.pixels = t @@ -1195,7 +1195,7 @@ load_from_context :: proc(ctx: ^$C, options := Options{}, allocator := context.a o = o[out_image_channels:] } case: - unreachable("We should never seen # channels other than 1-4 inclusive.") + panic("We should never seen # channels other than 1-4 inclusive.") } img.pixels = t @@ -1206,7 +1206,7 @@ load_from_context :: proc(ctx: ^$C, options := Options{}, allocator := context.a This may change if we ever don't expand 1, 2 and 4 bit images. But, those raw returns will likely bypass this processing pipeline. */ - unreachable("We should never see bit depths other than 8, 16 and 'Paletted' here.") + panic("We should never see bit depths other than 8, 16 and 'Paletted' here.") } return img, nil |