From a18cea2fef7aa1545c9a984b60919541b26a6f84 Mon Sep 17 00:00:00 2001
From: Christian C <cc@localhost>
Date: Tue, 1 Apr 2025 17:38:32 -0700
Subject: Clang Format

---
 lib/png.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

(limited to 'lib/png.c')

diff --git a/lib/png.c b/lib/png.c
index 5da0b95..1264a5a 100644
--- a/lib/png.c
+++ b/lib/png.c
@@ -1,17 +1,16 @@
 #include <lib/png.h>
 
-#include <stdio.h>
 #include <png.h>
+#include <stdio.h>
 
 // Save bitmap to file
-void save_png(Bitmap* bitmap, char* fname)
-{
+void save_png(Bitmap *bitmap, char *fname) {
   FILE *fp;
   png_structp png_ptr = NULL;
   png_infop info_ptr = NULL;
   PixelSize_t pixel_size = 3;
   PixelDepth_t pixel_depth = 8;
-  png_byte ** row_pointers = NULL;
+  png_byte **row_pointers = NULL;
   size_t x, y;
   fp = fopen(fname, "wb");
   if (fp == NULL) {
@@ -35,20 +34,19 @@ void save_png(Bitmap* bitmap, char* fname)
     fclose(fp);
     return;
   }
-  png_set_IHDR(png_ptr, info_ptr,
-	       bitmap->width, bitmap->height,
-	       pixel_depth,
-	       PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
-	       PNG_FILTER_TYPE_DEFAULT);
+  png_set_IHDR(png_ptr, info_ptr, bitmap->width, bitmap->height, pixel_depth,
+               PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
+               PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
 
-  row_pointers = png_malloc(png_ptr, bitmap->height*sizeof(png_byte*));
+  row_pointers = png_malloc(png_ptr, bitmap->height * sizeof(png_byte *));
   for (y = 0; y < bitmap->height; y++) {
-    png_byte *row = png_malloc(png_ptr, sizeof(PixelChannel_t)*bitmap->width*pixel_size);
+    png_byte *row = png_malloc(png_ptr, sizeof(PixelChannel_t) * bitmap->width *
+                                            pixel_size);
     row_pointers[y] = row;
     for (x = 0; x < bitmap->width; x++) {
-      *row++ = bitmap->image_buffer[x + y*bitmap->width].red;
-      *row++ = bitmap->image_buffer[x + y*bitmap->width].green;
-      *row++ = bitmap->image_buffer[x + y*bitmap->width].blue;
+      *row++ = bitmap->image_buffer[x + y * bitmap->width].red;
+      *row++ = bitmap->image_buffer[x + y * bitmap->width].green;
+      *row++ = bitmap->image_buffer[x + y * bitmap->width].blue;
     }
   }
   png_init_io(png_ptr, fp);
@@ -61,4 +59,3 @@ void save_png(Bitmap* bitmap, char* fname)
   png_destroy_write_struct(&png_ptr, &info_ptr);
   fclose(fp);
 }
-
-- 
cgit v1.2.1