From 05b666f977000cb710359d5e0ca065132d4a023a Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Sun, 5 Jun 2022 19:14:48 -0500 Subject: [PATCH] Limited to 16 bit color to test inlining pixel operations. --- Makefile.djgpp | 1 - client/src/main.c | 3 +-- client/src/platform/djgpp.c | 10 +++++++++- client/src/platform/djgpp.h | 9 +++++++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Makefile.djgpp b/Makefile.djgpp index a12ca2d..ea40b89 100644 --- a/Makefile.djgpp +++ b/Makefile.djgpp @@ -84,7 +84,6 @@ BIN := $(BINDIR)/$(TARGET) #$(info [${SRC}]) #$(info [${OBJ}]) - # Verbosity Control, ala automake V = 0 diff --git a/client/src/main.c b/client/src/main.c index 6413a77..0f96765 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -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); diff --git a/client/src/platform/djgpp.c b/client/src/platform/djgpp.c index 9fdd083..621c2c8 100644 --- a/client/src/platform/djgpp.c +++ b/client/src/platform/djgpp.c @@ -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) { diff --git a/client/src/platform/djgpp.h b/client/src/platform/djgpp.h index 93cacf9..ea20372 100644 --- a/client/src/platform/djgpp.h +++ b/client/src/platform/djgpp.h @@ -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);