Browse Source

RLE_Compressed_Bng -> Bng

rexim 5 years ago
parent
commit
e4309fcde9
3 changed files with 3 additions and 12 deletions
  1. 1 10
      bng.h
  2. 1 1
      bngviewer.c
  3. 1 1
      png2bng.c

+ 1 - 10
bng.h

@@ -84,7 +84,7 @@ struct RLE_Pair
     uint32_t pixel;
 };
 
-struct RLE_Compressed_Bng
+struct Bng
 {
     uint32_t magic;
     uint32_t width;
@@ -94,15 +94,6 @@ struct RLE_Compressed_Bng
     struct RLE_Pair pairs[];
 } PACKED;
 
-struct Bng
-{
-    uint32_t magic;
-    uint32_t width;
-    uint32_t height;
-    struct Bng_Pixel_Format pixel_format;
-    uint32_t pixels[];
-} PACKED;
-
 // NOTE: You have to allocate `width * height` amount of pixels
 void decompress_pixels(struct RLE_Pair *pairs, uint32_t pairs_count, uint32_t *pixels)
 {

+ 1 - 1
bngviewer.c

@@ -17,7 +17,7 @@ void* read_whole_file(const char *filename)
 
 uint32_t *bng_load(const char *filepath, uint32_t *width, uint32_t *height)
 {
-    struct RLE_Compressed_Bng *compressed_bng = read_whole_file(filepath);
+    struct Bng *compressed_bng = read_whole_file(filepath);
 
     uint32_t *pixels = malloc(compressed_bng->width * compressed_bng->height * sizeof(uint32_t));
     decompress_pixels(compressed_bng->pairs, compressed_bng->pairs_count, pixels);

+ 1 - 1
png2bng.c

@@ -17,7 +17,7 @@ int main(int argc, char **argv)
     uint32_t *data = (uint32_t*)stbi_load(input_filepath, &x, &y, &n, 4);
     assert(data != NULL);
 
-    struct RLE_Compressed_Bng bng = {
+    struct Bng bng = {
         .magic        = BNG_MAGIC,
         .width        = x,
         .height       = y,