Minor surface optimization.

This commit is contained in:
Scott Duensing 2021-11-30 20:29:58 -06:00
parent 6749ba828e
commit 395899445a
3 changed files with 22 additions and 11 deletions

View file

@ -44,6 +44,7 @@ TARGET_ARCH :=
# Compiler Flags # Compiler Flags
ALL_CFLAGS := $(CFLAGS) ALL_CFLAGS := $(CFLAGS)
ALL_CFLAGS += -Wall -Ofast ALL_CFLAGS += -Wall -Ofast
#ALL_CFLAGS += -Wall -O0 -pg
# Preprocessor Flags # Preprocessor Flags
ALL_CPPFLAGS := $(CPPFLAGS) ALL_CPPFLAGS := $(CPPFLAGS)

View file

@ -72,13 +72,20 @@ void surfaceBlit(SurfaceT *source, uint16_t x, uint16_t y) {
void surfaceClear(ColorT color) { void surfaceClear(ColorT color) {
uint16_t x;
uint16_t y;
for (y=0; y<_activeSurface->height; y++) { uint16_t x;
for (x=0; x<_activeSurface->width; x++) { size_t offsetTarget;
surfacePutPixel(x, y, color);
} // Draw the top line.
for (x=0; x<_activeSurface->width; x++) {
surfacePutPixel(x, 0, color);
}
// Copy it to the other lines.
offsetTarget = _activeSurface->scanline;
for (x=1; x<_activeSurface->height; x++) {
memcpy(&_activeSurface->buffer.bits8[offsetTarget], &_activeSurface->buffer.bits8[0], _activeSurface->scanline);
offsetTarget += _activeSurface->scanline;
} }
} }
@ -204,6 +211,8 @@ void surfaceRectangleFilledDraw(int16_t x1, int16_t y1, int16_t x2, int16_t y2,
uint16_t x; uint16_t x;
uint16_t y; uint16_t y;
// This could be optimized similar to surfaceClear
for (y=y1; y<=y2; y++) { for (y=y1; y<=y2; y++) {
for (x=x1; x<=x2; x++) { for (x=x1; x<=x2; x++) {
surfacePutPixel(x, y, color); surfacePutPixel(x, y, color);

View file

@ -193,8 +193,9 @@ convergence = 0
# cycledown: Setting it lower than 100 will be a percentage. # cycledown: Setting it lower than 100 will be a percentage.
core = auto core = auto
cputype = 486 cputype = pentium_slow
cycles = 5000 cycles = 12000
#cycles = auto
cycleup = 10 cycleup = 10
cycledown = 20 cycledown = 20
@ -457,9 +458,9 @@ phonebookfile = phonebook.txt
# Common settings are 3.3, 5.0, 6.22, and 7.1. # Common settings are 3.3, 5.0, 6.22, and 7.1.
# keyboardlayout: Language code of the keyboard layout (or none). # keyboardlayout: Language code of the keyboard layout (or none).
xms = true xms = false
ems = true ems = false
umb = true umb = false
ver = 5.0 ver = 5.0
keyboardlayout = auto keyboardlayout = auto