From 01258f29adbd66913baba1a70d7b9e022eace9b7 Mon Sep 17 00:00:00 2001
From: Mateusz Zalega <mateusz@appliedsourcery.com>
Date: Sun, 11 Aug 2019 16:13:37 +0200
Subject: [PATCH] coding style: moved RLE decoding code to lib/gfx

Signed-off-by: Mateusz Zalega <mateusz@appliedsourcery.com>
---
 bootloader/bootloader-display.c | 12 ++++++++++--
 epicardium/main.c               | 10 ++++++++--
 hw-tests/dual-core/main.c       | 20 +++++++++++++-------
 hw-tests/hello-world/main.c     | 10 ++++++++--
 lib/gfx/gfx.c                   | 12 ++++++------
 5 files changed, 45 insertions(+), 19 deletions(-)

diff --git a/bootloader/bootloader-display.c b/bootloader/bootloader-display.c
index 450109439..290e9199a 100644
--- a/bootloader/bootloader-display.c
+++ b/bootloader/bootloader-display.c
@@ -8,8 +8,16 @@
 
 static void bootloader_display_splash(void)
 {
-	gfx_copy_region(&display_screen, 0, 0, 160, 80, GFX_RLE_MONO,
-			     sizeof(splash), (const void *)(splash));
+	gfx_copy_region(
+		&display_screen,
+		0,
+		0,
+		160,
+		80,
+		GFX_RLE_MONO,
+		sizeof(splash),
+		(const void *)(splash)
+	);
 	gfx_update(&display_screen);
 }
 
diff --git a/epicardium/main.c b/epicardium/main.c
index 249ff1094..34fa56ca4 100644
--- a/epicardium/main.c
+++ b/epicardium/main.c
@@ -54,8 +54,14 @@ int main(void)
 	card10_diag();
 
 	gfx_copy_region(
-		&display_screen, 0, 0, 160, 80, GFX_RAW, sizeof(Heart),
-				      		  (const void *)(Heart)
+		&display_screen,
+		0,
+		0,
+		160,
+		80,
+		GFX_RAW,
+		sizeof(Heart),
+		(const void *)(Heart)
 	);
 	gfx_update(&display_screen);
 
diff --git a/hw-tests/dual-core/main.c b/hw-tests/dual-core/main.c
index b84503430..30026b805 100644
--- a/hw-tests/dual-core/main.c
+++ b/hw-tests/dual-core/main.c
@@ -3,19 +3,19 @@
  ******************************************************************************/
 
 /***** Includes *****/
-#include "pmic.h"
-#include "leds.h"
 #include "card10.h"
+#include "leds.h"
+#include "pmic.h"
 
-#include "gfx.h"
 #include "display.h"
+#include "gfx.h"
 
 #include "tmr_utils.h"
 
-#include <stdio.h>
+#include <Heart.h>
 #include <stdint.h>
+#include <stdio.h>
 #include <string.h>
-#include <Heart.h>
 
 int main(void)
 {
@@ -23,8 +23,14 @@ int main(void)
 	card10_diag();
 
 	gfx_copy_region(
-		&display_screen, 0, 0, 160, 80, GFX_RAW, sizeof(Heart),
-				      		  (const void *)(Heart)
+		&display_screen,
+		0,
+		0,
+		160,
+		80,
+		GFX_RAW,
+		sizeof(Heart),
+		(const void *)(Heart)
 	);
 	gfx_update(&display_screen);
 
diff --git a/hw-tests/hello-world/main.c b/hw-tests/hello-world/main.c
index 79007e145..5f2a82aad 100644
--- a/hw-tests/hello-world/main.c
+++ b/hw-tests/hello-world/main.c
@@ -31,8 +31,14 @@ int main(void)
 	card10_diag();
 
 	gfx_copy_region(
-		&display_screen, 0, 0, 160, 80, GFX_RAW, sizeof(Heart),
-				      		  (const void *)(Heart)
+		&display_screen,
+		0,
+		0,
+		160,
+		80,
+		GFX_RAW,
+		sizeof(Heart),
+		(const void *)(Heart)
 	);
 	gfx_update(&display_screen);
 
diff --git a/lib/gfx/gfx.c b/lib/gfx/gfx.c
index 704fb9afa..a77913c11 100644
--- a/lib/gfx/gfx.c
+++ b/lib/gfx/gfx.c
@@ -303,9 +303,9 @@ static void gfx_copy_region_mono(
 	const void *p
 ) {
 	const char *bp = p;
-	int bit = 0;
-	Color white = gfx_color(reg, WHITE);
-	Color black = gfx_color(reg, BLACK);
+	int bit        = 0;
+	Color white    = gfx_color(reg, WHITE);
+	Color black    = gfx_color(reg, BLACK);
 
 	for (int y_ = 0; y_ < h; y_++) {
 		for (int x_ = 0; x_ < w; x_++) {
@@ -341,9 +341,9 @@ static void gfx_copy_region_rle_mono(
 	const void *p
 ) {
 	const char *data = p;
-	int idx = 0;
-	Color white = gfx_color(reg, WHITE);
-	Color black = gfx_color(reg, BLACK);
+	int idx          = 0;
+	Color white      = gfx_color(reg, WHITE);
+	Color black      = gfx_color(reg, BLACK);
 
 	for (int i = 0; i < size; i++) {
 		Color color    = (data[i] & 0x80) ? white : black;
-- 
GitLab