From 73a80de4228a498b483c8e10ab317920d978d507 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Thu, 20 Jan 2022 23:22:42 -0700 Subject: Moved globals to file --- src/graphics/drawer.c | 3 --- src/graphics/lfb.c | 33 ++++++++++++++++----------------- 2 files changed, 16 insertions(+), 20 deletions(-) (limited to 'src/graphics') diff --git a/src/graphics/drawer.c b/src/graphics/drawer.c index 35aea32..4445919 100644 --- a/src/graphics/drawer.c +++ b/src/graphics/drawer.c @@ -1,9 +1,6 @@ #include #include -#define GRAPHICS_DRAWER_C -struct Drawer g_Drawer = {.x = 0, .y = 0}; - void write_cchar(struct Drawer* d, char s, unsigned int c) { d->x %= GG_MAX_X; diff --git a/src/graphics/lfb.c b/src/graphics/lfb.c index 3ad9917..c3a3cac 100644 --- a/src/graphics/lfb.c +++ b/src/graphics/lfb.c @@ -1,11 +1,10 @@ #include +#include #include #include #include #include -#define GRAPHICS_LFB_C -unsigned int width, height, pitch, isrgb; /* dimensions and channel order */ unsigned char *lfb; /* raw frame buffer address */ #define SCR_WIDTH 1024 @@ -64,10 +63,10 @@ void lfb_init(void) //the closest supported resolution instead if(mbox_call(MBOX_CH_PROP) && mbox[20]==32 && mbox[28]!=0) { mbox[28]&=0x3FFFFFFF; //convert GPU address to ARM address - width=mbox[5]; //get actual physical width - height=mbox[6]; //get actual physical height - pitch=mbox[33]; //get number of bytes per line - isrgb=mbox[24]; //get the actual channel order + gwidth=mbox[5]; //get actual physical width + gheight=mbox[6]; //get actual physical height + gpitch=mbox[33]; //get number of bytes per line + gisrgb=mbox[24]; //get the actual channel order lfb=(void*)((unsigned long)mbox[28]); } else { uart_string("Unable to set screen resolution to 1024x768x32\n"); @@ -77,8 +76,8 @@ void lfb_init(void) void clear_screen(void) { unsigned char *ptr=lfb; - for(unsigned int y = 0; y < height; y++) { - for(unsigned int x = 0; x < width; x++) { + for(unsigned int y = 0; y < gheight; y++) { + for(unsigned int x = 0; x < gwidth; x++) { *(unsigned int*)ptr = 0x000000; ptr += 4; } @@ -95,16 +94,16 @@ void lfb_showpicture(void) unsigned char *ptr=lfb; char *data=toad_data, pixel[4]; - ptr = lfb + (height-toad_height)*pitch + (width-toad_width)*4; + ptr = lfb + (gheight-toad_height)*gpitch + (gwidth-toad_width)*4; for(y=0;y 0x39) { ltr += 7; @@ -120,13 +119,13 @@ void draw_cbyte(unsigned char lx, unsigned char ly, unsigned char letter, unsign for(y=0; y> ((GLYPH_X-1)-x)) & glyphs[y+GLYPH_Y*(ltr)]) { - *((unsigned int*)ptr) = isrgb ? (unsigned int)((c&0xFF)<<16 | (c&0xFF00) | (c&0xFF0000)>>16) : c; + *((unsigned int*)ptr) = gisrgb ? (unsigned int)((c&0xFF)<<16 | (c&0xFF00) | (c&0xFF0000)>>16) : c; } else { *((unsigned int*)ptr) = 0x000000; } ptr += 4; } - ptr += pitch - GLYPH_X*4; + ptr += gpitch - GLYPH_X*4; } } @@ -139,18 +138,18 @@ void draw_cletter(unsigned char lx, unsigned char ly, unsigned char letter, unsi { unsigned int x, y; unsigned char* ptr = lfb; - ptr += (pitch*ly*GLYPH_Y+lx*4*GLYPH_X); + ptr += (gpitch*ly*GLYPH_Y+lx*4*GLYPH_X); unsigned char ltr = letter & 0x7F; for(y=0; y> ((GLYPH_X-1)-x)) & glyphs[y+GLYPH_Y*(ltr)]) { - *((unsigned int*)ptr) = isrgb ? (unsigned int)((c&0xFF)<<16 | (c&0xFF00) | (c&0xFF0000)>>16) : c; + *((unsigned int*)ptr) = gisrgb ? (unsigned int)((c&0xFF)<<16 | (c&0xFF00) | (c&0xFF0000)>>16) : c; } else { *((unsigned int*)ptr) = 0x000000; } ptr += 4; } - ptr += pitch - GLYPH_X*4; + ptr += gpitch - GLYPH_X*4; } } -- cgit v1.2.1