graphics_rgb565.c: Replaced hardtabs with spaces

replace/cd7a1fa802f1ec65e1ac329ce36f017e83a7a5c4
Federico Amedeo Izzo 2020-10-09 13:32:05 +02:00 zatwierdzone przez Niccolò Izzo
rodzic 05f15d0488
commit dac60a7be5
1 zmienionych plików z 19 dodań i 20 usunięć

Wyświetl plik

@ -24,6 +24,7 @@
#include "display.h" #include "display.h"
#include "graphics.h" #include "graphics.h"
#include <string.h> #include <string.h>
#include <stdio.h>
#define COLOR_WHITE = {31, 63, 31} #define COLOR_WHITE = {31, 63, 31}
@ -91,49 +92,47 @@ rgb565_t _true2highColor(color_t true_color)
uint8_t high_g = true_color.g >> 2; uint8_t high_g = true_color.g >> 2;
uint8_t high_b = true_color.b >> 3; uint8_t high_b = true_color.b >> 3;
rgb565_t high_color = {high_r, high_g, high_b}; rgb565_t high_color = {high_r, high_g, high_b};
/*printf("Converting color... True: R:%02XG:%02XB:%02X High:R:%02XG:%02XB:%02X\n", true_color.r,
true_color.g, true_color.b, high_r, high_g, high_b);*/
return high_color; return high_color;
} }
void graphics_clearScreen() void graphics_clearScreen()
{ {
if(!initialized) if(!initialized) return;
return;
// Set the whole framebuffer to 0x00 = make the screen black // Set the whole framebuffer to 0x00 = make the screen black
memset(buf, 0x00, sizeof(rgb565_t) * screen_width * screen_height); memset(buf, 0x00, sizeof(rgb565_t) * screen_width * screen_height);
} }
void graphics_fillScreen(color_t color) void graphics_fillScreen(color_t color)
{ {
if(!initialized) if(!initialized) return;
return;
rgb565_t color_565 = _true2highColor(color); rgb565_t color_565 = _true2highColor(color);
for(int y=0; y < screen_height; y++) for(int y=0; y < screen_height; y++)
{ {
for(int x=0; x < screen_width; x++) for(int x=0; x < screen_width; x++)
{ {
buf[x + y*screen_width] = color_565; buf[x + y*screen_width] = color_565;
} }
} }
} }
void graphics_drawLine(point_t start, point_t end, color_t color) void graphics_drawLine(point_t start, point_t end, color_t color)
{ {
if(!initialized) if(!initialized) return;
return;
rgb565_t color_565 = _true2highColor(color); rgb565_t color_565 = _true2highColor(color);
for(int y=0; y < screen_height; y++) for(int y=0; y < screen_height; y++)
{ {
for(int x=0; x < screen_width; x++) for(int x=0; x < screen_width; x++)
{ {
buf[x + y*screen_width] = color_565; buf[x + y*screen_width] = color_565;
} }
} }
} }
void graphics_drawRect(point_t start, uint16_t width, uint16_t height, color_t color, bool fill) void graphics_drawRect(point_t start, uint16_t width, uint16_t height, color_t color, bool fill)
{ {
if(!initialized) if(!initialized) return;
return;
rgb565_t color_565 = _true2highColor(color); rgb565_t color_565 = _true2highColor(color);
uint16_t x_max = start.x + width; uint16_t x_max = start.x + width;
uint16_t y_max = start.y + height; uint16_t y_max = start.y + height;
@ -141,10 +140,10 @@ void graphics_drawRect(point_t start, uint16_t width, uint16_t height, color_t c
if(y_max > (screen_height - 1)) y_max = screen_height - 1; if(y_max > (screen_height - 1)) y_max = screen_height - 1;
for(int y=start.y; y < y_max; y++) for(int y=start.y; y < y_max; y++)
{ {
for(int x=start.x; x < x_max; x++) for(int x=start.x; x < x_max; x++)
{ {
buf[x + y*screen_width] = color_565; buf[x + y*screen_width] = color_565;
} }
} }
} }