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
ALL_CFLAGS := $(CFLAGS)
ALL_CFLAGS += -Wall -Ofast
#ALL_CFLAGS += -Wall -O0 -pg
# Preprocessor Flags
ALL_CPPFLAGS := $(CPPFLAGS)

View file

@ -72,13 +72,20 @@ void surfaceBlit(SurfaceT *source, uint16_t x, uint16_t y) {
void surfaceClear(ColorT color) {
uint16_t x;
uint16_t y;
for (y=0; y<_activeSurface->height; y++) {
uint16_t x;
size_t offsetTarget;
// Draw the top line.
for (x=0; x<_activeSurface->width; x++) {
surfacePutPixel(x, y, color);
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 y;
// This could be optimized similar to surfaceClear
for (y=y1; y<=y2; y++) {
for (x=x1; x<=x2; x++) {
surfacePutPixel(x, y, color);

View file

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