Limited to 16 bit color to test inlining pixel operations.

This commit is contained in:
Scott Duensing 2022-06-05 19:14:48 -05:00
parent 4c7be223a9
commit 05b666f977
4 changed files with 19 additions and 4 deletions

View file

@ -84,7 +84,6 @@ BIN := $(BINDIR)/$(TARGET)
#$(info [${SRC}])
#$(info [${OBJ}])
# Verbosity Control, ala automake
V = 0

View file

@ -11,8 +11,7 @@ int main(int argc, char *argv[]) {
memoryStartup(argv[0]);
logOpenByHandle(memoryLogHandleGet());
if (guiStartup(800, 600, 32) == SUCCESS) {
i = 1;
if (guiStartup(800, 600, 16) == SUCCESS) {
for (i=1; i<4; i++) {
sprintf(title, "Testing %d", i);
windowCreate(i * 50, i * 50, 300, 200, title, WIN_CLOSE | WIN_MAXIMIZE | WIN_MINIMIZE | WIN_RESIZE);

View file

@ -164,7 +164,7 @@ static VBEInfoT _vbeInfo;
static VBEModeInfoT _vbeModeInfo;
static PModeInterfaceT *_pmodeInterfacePtr;
static uint32_t *_yTable;
static SurfaceT *_activeSurface = NULL;
/* static */ SurfaceT *_activeSurface = NULL;
static void vbeCreatePalette(void);
@ -176,6 +176,7 @@ static uint16_t vbeSelectModeNumber(uint16_t xRes, uint16_t yRes, uint8_t b
static VBESurfaceT *vbeSetMode(uint16_t vbeModeNumber);
static uint16_t vbeSetScanlineLength(uint16_t pixelLength);
/*
static ColorT videoSurfacePixelGet8(SurfaceT *surface, int16_t x, int16_t y);
static ColorT videoSurfacePixelGet16(SurfaceT *surface, int16_t x, int16_t y);
static ColorT videoSurfacePixelGet32(SurfaceT *surface, int16_t x, int16_t y);
@ -183,11 +184,14 @@ static ColorT videoSurfacePixelGet32(SurfaceT *surface, int16_t x, int16_t y);
static void videoSurfacePixelSet8(uint16_t x, uint16_t y, ColorT color);
static void videoSurfacePixelSet16(uint16_t x, uint16_t y, ColorT color);
static void videoSurfacePixelSet32(uint16_t x, uint16_t y, ColorT color);
*/
static void (*pmVBESetDisplayStart)(void);
/*
ColorT (*videoSurfacePixelGet)(SurfaceT *surface, int16_t x, int16_t y);
void (*videoSurfacePixelSet)(uint16_t x, uint16_t y, ColorT color);
*/
void platformEventGet(EventT *event) {
@ -375,10 +379,12 @@ uint8_t platformStartup(int16_t width, int16_t height, int16_t depth) {
return FAIL;
}
/*
if (_vbeSurface.bitsPerPixel == 8) { videoSurfacePixelSet = videoSurfacePixelSet8; videoSurfacePixelGet = videoSurfacePixelGet8; }
if (_vbeSurface.bitsPerPixel == 16) { videoSurfacePixelSet = videoSurfacePixelSet16; videoSurfacePixelGet = videoSurfacePixelGet16; }
if (_vbeSurface.bitsPerPixel == 15) { videoSurfacePixelSet = videoSurfacePixelSet16; videoSurfacePixelGet = videoSurfacePixelGet16; }
if (_vbeSurface.bitsPerPixel == 32) { videoSurfacePixelSet = videoSurfacePixelSet32; videoSurfacePixelGet = videoSurfacePixelGet32; }
*/
__guiBaseColors = (ColorT *)malloc(sizeof(ColorT) * 16);
for (i=0; i<16; i++) {
@ -975,6 +981,7 @@ void videoSurfaceLineV(int16_t x, int16_t y1, int16_t y2, ColorT c) {
}
/*
static ColorT videoSurfacePixelGet8(SurfaceT *surface, int16_t x, int16_t y) {
return surface->buffer.bits8[y * surface->width + x];
}
@ -1003,6 +1010,7 @@ static void videoSurfacePixelSet16(uint16_t x, uint16_t y, ColorT color) {
static void videoSurfacePixelSet32(uint16_t x, uint16_t y, ColorT color) {
_activeSurface->buffer.bits32[y * _activeSurface->width + x] = color;
}
*/
void videoSurfaceSet(SurfaceT *surface) {

View file

@ -47,8 +47,17 @@ typedef struct EventS {
#define KEY_ESC 27
extern SurfaceT *_activeSurface;
#define videoSurfacePixelGet(s,x,y) ((s)->buffer.bits16[(y) * (s)->width + (x)])
#define videoSurfacePixelSet(x,y,c) _activeSurface->buffer.bits16[(y) * _activeSurface->width + (x)] = (uint16_t)(c)
/*
extern ColorT (*videoSurfacePixelGet)(SurfaceT *surface, int16_t x, int16_t y);
extern void (*videoSurfacePixelSet)(uint16_t x, uint16_t y, ColorT color);
*/
void platformEventGet(EventT *event);