aboutsummaryrefslogtreecommitdiff
path: root/src/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics')
-rw-r--r--src/graphics/drawer.c100
-rw-r--r--src/graphics/lfb.c6
2 files changed, 3 insertions, 103 deletions
diff --git a/src/graphics/drawer.c b/src/graphics/drawer.c
deleted file mode 100644
index dc0ffe1..0000000
--- a/src/graphics/drawer.c
+++ /dev/null
@@ -1,100 +0,0 @@
-#include <graphics/drawer.h>
-#include <graphics/lfb.h>
-
-void write_cchar(struct Drawer* d, char s, unsigned int c)
-{
- lock(&d->l);
- d->x %= GG_MAX_X;
- d->y %= GG_MAX_Y;
- if (s == 0x0A) {
- d->y += 1;
- d->x = 0;
- } else {
- draw_cletter(d->x++, d->y, s, c);
- if (d->x >= GG_MAX_X) {
- d->y += 1;
- d->x = 0;
- }
- }
- unlock(&d->l);
- // CHECK Y EVENTUALLY
-}
-
-void write_char(struct Drawer* d, char s)
-{
- write_cchar(d, s, 0xFFFFFF);
-}
-
-void write_cstring(struct Drawer* d, char* s, unsigned int c)
-{
- lock(&d->l);
- d->x %= GG_MAX_X;
- d->y %= GG_MAX_Y;
- unsigned int idx = 0;
- while(s[idx] != 0) {
- if (s[idx] == 0x0A) {
- d->y += 1;
- d->x = 0;
- idx++;
- } else {
- draw_cletter(d->x++, d->y, s[idx++], c);
- if (d->x >= GG_MAX_X) {
- d->y += 1;
- d->x = 0;
- }
- }
- // CHECK Y EVENTUALLY
- }
- unlock(&d->l);
-}
-
-void write_string(struct Drawer* d, char* s)
-{
- write_cstring(d, s, 0xFFFFFF);
-}
-
-void write_chex32(struct Drawer* d, unsigned long val, unsigned int c)
-{
- lock(&d->l);
- draw_chex32(d->x, d->y, val, c);
- d->x += 8;
- if (d->x >= GG_MAX_X) {
- d->y += 1;
- d->x %= GG_MAX_X;
- }
- unlock(&d->l);
-}
-
-void write_hex32(struct Drawer* d, unsigned long val)
-{
- write_chex32(d, val, 0xFFFFFF);
-}
-
-void write_c10(struct Drawer* d, unsigned long val, unsigned int c)
-{
- static char out[] = "0000000000\0";
- char* s = (char*)out+9;
- unsigned long tmp = val;
- for(int i = 0; i < 10; i++) {
- unsigned char rem = tmp%10;
- tmp /= 10;
- *s = rem + 0x30;
- if (tmp==0)
- break;
- s--;
- }
- write_cstring(d, s, c);
-}
-
-void write_10(struct Drawer* d, unsigned long val)
-{
- write_c10(d, val, 0xFFFFFF);
-}
-
-void set_drawer(struct Drawer* d, unsigned int x, unsigned int y)
-{
- lock(&d->l);
- d->x = x % GG_MAX_X;
- d->y = y % GG_MAX_Y;
- unlock(&d->l);
-}
diff --git a/src/graphics/lfb.c b/src/graphics/lfb.c
index ee31514..8f7ad06 100644
--- a/src/graphics/lfb.c
+++ b/src/graphics/lfb.c
@@ -116,12 +116,12 @@ void draw_cpixel(unsigned long lx, unsigned long ly, unsigned int c)
*((unsigned int*)ptr) = gisrgb ? (unsigned int)((c&0xFF)<<16 | (c&0xFF00) | (c&0xFF0000)>>16) : c;
}
-void draw_cbox(unsigned long lx, unsigned long ly, unsigned char dx, unsigned char dy, unsigned int c)
+void draw_cbox(unsigned long lx, unsigned long ly, unsigned int dx, unsigned int dy, unsigned int c)
{
unsigned char* ptr = lfb;
ptr += (gpitch*ly+lx*4);
- for(int y = 0; y < dy; y++) {
- for(int x = 0; x < dx; x++) {
+ for(unsigned int y = 0; y < dy; y++) {
+ for(unsigned int x = 0; x < dx; x++) {
*((unsigned int*)ptr) = gisrgb ? (unsigned int)((c&0xFF)<<16 | (c&0xFF00) | (c&0xFF0000)>>16) : c;
ptr += 4;
}