mirror of
https://github.com/Tom-on64/kern.git
synced 2026-11-03 18:22:22 +00:00
Minor printing optimizations
This commit is contained in:
@@ -5,16 +5,6 @@
|
||||
#include "screen.h"
|
||||
#include "math.h"
|
||||
|
||||
// Basic full saturation colors
|
||||
#define BLACK 0x00000000 // 0
|
||||
#define RED 0x00ff0000 // 1
|
||||
#define GREEN 0x0000ff00 // 2
|
||||
#define YELLOW 0x00ffff00 // 3
|
||||
#define BLUE 0x000000ff // 4
|
||||
#define MAGENTA 0x00ff00ff // 5
|
||||
#define CYAN 0x0000ffff // 6
|
||||
#define WHITE 0x00ffffff // 7
|
||||
|
||||
#define rgb(r,g,b) ( ((r) << 16 | (g) << 8 | (b)) & 0x00ffffff )
|
||||
|
||||
void drawPixel(int32_t x, int32_t y, uint32_t color) {
|
||||
|
||||
+13
-2
@@ -4,6 +4,16 @@
|
||||
#include "stdint.h"
|
||||
#include "string.h"
|
||||
|
||||
// Basic full saturation colors
|
||||
#define BLACK 0x00000000 // 0
|
||||
#define RED 0x00ff0000 // 1
|
||||
#define GREEN 0x0000ff00 // 2
|
||||
#define YELLOW 0x00ffff00 // 3
|
||||
#define BLUE 0x000000ff // 4
|
||||
#define MAGENTA 0x00ff00ff // 5
|
||||
#define CYAN 0x0000ffff // 6
|
||||
#define WHITE 0x00ffffff // 7
|
||||
|
||||
#define MODE_INFO_BLOCK 0x9000
|
||||
#define BG_COLOR 0x00010b17
|
||||
#define FG_COLOR 0x00ebddf4
|
||||
@@ -105,14 +115,15 @@ void putcAt(unsigned char c, uint32_t x, uint32_t y) {
|
||||
char* bitmap = &font[((c % 128) - 1) * charHeight];
|
||||
for (uint8_t i = 0; i < charHeight; i++) { // Rows
|
||||
char bitmapRow = bitmap[i];
|
||||
|
||||
for (uint8_t j = 0; j < charHeight * bytesPerPx; ++j) { // Cols
|
||||
uint32_t color = convertColor((bitmapRow & 0x80) ? fgColor : bgColor);
|
||||
|
||||
for (uint8_t j = 0; j < charWidth * bytesPerPx; ++j) { // Cols
|
||||
uint8_t byte = j % bytesPerPx;
|
||||
vidmem[offset + j] = (uint8_t)(color >> (8 * byte));
|
||||
|
||||
if (byte == bytesPerPx - 1) {
|
||||
bitmapRow = bitmapRow << 1;
|
||||
color = convertColor((bitmapRow & 0x80) ? fgColor : bgColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user