Changed the RGBA8 define to RGBA8_MAXALPHA and adjusted it + moved it into gfx.h. Added RGBA8 define to gfx.h which is the same as the original except it now uses an input alpha param. Added a comment to gfx.c regarding width/height.

This commit is contained in:
yellows8 2017-12-13 13:42:02 -05:00
parent 945615ece3
commit 0e1a90a7a9
3 changed files with 32 additions and 27 deletions

View File

@ -1,3 +1,9 @@
/// Converts red, green, blue, and alpha components to packed RGBA8.
#define RGBA8(r,g,b,a) (((r)&0xff)|(((g)&0xff)<<8)|(((b)&0xff)<<16)|(((a)&0xff)<<24))
/// Same as RGBA8 except with alpha=0xff.
#define RGBA8_MAXALPHA(r,g,b) RGBA8(r,g,b,0xff)
/// Do not use viInitialize/viExit when using these. /// Do not use viInitialize/viExit when using these.
void gfxInitDefault(void); void gfxInitDefault(void);
void gfxExit(void); void gfxExit(void);

View File

@ -5,37 +5,34 @@
#include "default_font_bin.h" #include "default_font_bin.h"
/// Converts red, green, and blue components to packed RGBA8, with alpha=0xff.
#define RGBA8(r,g,b) (((r)&0xff)|(((g)&0xff)<<8)|(((b)&0xff)<<16)|(0xff<<24))
//set up the palette for color printing //set up the palette for color printing
static u32 colorTable[] = { static u32 colorTable[] = {
RGBA8( 0, 0, 0), // black RGBA8_MAXALPHA( 0, 0, 0), // black
RGBA8(128, 0, 0), // red RGBA8_MAXALPHA(128, 0, 0), // red
RGBA8( 0,128, 0), // green RGBA8_MAXALPHA( 0,128, 0), // green
RGBA8(128,128, 0), // yellow RGBA8_MAXALPHA(128,128, 0), // yellow
RGBA8( 0, 0,128), // blue RGBA8_MAXALPHA( 0, 0,128), // blue
RGBA8(128, 0,128), // magenta RGBA8_MAXALPHA(128, 0,128), // magenta
RGBA8( 0,128,128), // cyan RGBA8_MAXALPHA( 0,128,128), // cyan
RGBA8(192,192,192), // white RGBA8_MAXALPHA(192,192,192), // white
RGBA8(128,128,128), // bright black RGBA8_MAXALPHA(128,128,128), // bright black
RGBA8(255, 0, 0), // bright red RGBA8_MAXALPHA(255, 0, 0), // bright red
RGBA8( 0,255, 0), // bright green RGBA8_MAXALPHA( 0,255, 0), // bright green
RGBA8(255,255, 0), // bright yellow RGBA8_MAXALPHA(255,255, 0), // bright yellow
RGBA8( 0, 0,255), // bright blue RGBA8_MAXALPHA( 0, 0,255), // bright blue
RGBA8(255, 0,255), // bright magenta RGBA8_MAXALPHA(255, 0,255), // bright magenta
RGBA8( 0,255,255), // bright cyan RGBA8_MAXALPHA( 0,255,255), // bright cyan
RGBA8(255,255,255), // bright white RGBA8_MAXALPHA(255,255,255), // bright white
RGBA8( 0, 0, 0), // faint black RGBA8_MAXALPHA( 0, 0, 0), // faint black
RGBA8( 64, 0, 0), // faint red RGBA8_MAXALPHA( 64, 0, 0), // faint red
RGBA8( 0, 64, 0), // faint green RGBA8_MAXALPHA( 0, 64, 0), // faint green
RGBA8( 64, 64, 0), // faint yellow RGBA8_MAXALPHA( 64, 64, 0), // faint yellow
RGBA8( 0, 0, 64), // faint blue RGBA8_MAXALPHA( 0, 0, 64), // faint blue
RGBA8( 64, 0, 64), // faint magenta RGBA8_MAXALPHA( 64, 0, 64), // faint magenta
RGBA8( 0, 64, 64), // faint cyan RGBA8_MAXALPHA( 0, 64, 64), // faint cyan
RGBA8( 96, 96, 96), // faint white RGBA8_MAXALPHA( 96, 96, 96), // faint white
}; };
//The below width/height is for 720p. //The below width/height is for 720p.

View File

@ -30,6 +30,8 @@ extern size_t g_nvgfx_singleframebuf_size;
//static Result _gfxGetDisplayResolution(u64 *width, u64 *height); //static Result _gfxGetDisplayResolution(u64 *width, u64 *height);
//TODO: Figure out what all is required to use non-720p width/height.
//TODO: Let the user configure some of this? //TODO: Let the user configure some of this?
static bufferProducerQueueBufferInput g_gfxQueueBufferData = { static bufferProducerQueueBufferInput g_gfxQueueBufferData = {
.timestamp = 0x0, .timestamp = 0x0,