Image: Fix implicit enum error

This commit is contained in:
WalterPlinge
2022-04-18 20:42:50 +01:00
parent 8d370fabdd
commit b6abd691f4
2 changed files with 2 additions and 3 deletions

View File

@@ -167,6 +167,7 @@ Error :: union #shared_nil {
General_Image_Error :: enum {
None = 0,
Invalid_Image_Dimensions,
Invalid_Number_Of_Channels,
Image_Dimensions_Too_Large,
Image_Does_Not_Adhere_to_Spec,
Invalid_Input_Image,
@@ -213,7 +214,6 @@ Netpbm_Error :: enum {
// writing
File_Not_Writable,
Invalid_Format,
Invalid_Number_Of_Channels,
Invalid_Image_Depth,
}
@@ -339,7 +339,6 @@ PNG_Interlace_Method :: enum u8 {
QOI_Error :: enum {
None = 0,
Invalid_QOI_Signature,
Invalid_Number_Of_Channels, // QOI allows 3 or 4 channel data.
Invalid_Bit_Depth, // QOI supports only 8-bit images, error only returned from writer.
Invalid_Color_Space, // QOI allows 0 = sRGB or 1 = linear.
Corrupt, // More data than pixels to decode into, for example.

View File

@@ -104,7 +104,7 @@ write_to_buffer :: proc(img: Image, allocator := context.allocator) -> (buffer:
//? validation
if header.format in (PBM + PGM + Formats{.Pf}) && img.channels != 1 \
|| header.format in (PPM + Formats{.PF}) && img.channels != 3 {
err = Format_Error.Invalid_Number_Of_Channels
err = .Invalid_Number_Of_Channels
return
}