Removed redundant pixel param from screen routines
This commit is contained in:
parent
8a3c86a879
commit
8b43d0d7ae
|
@ -108,17 +108,17 @@ screen_clear(UxnScreen *p, Layer *layer)
|
|||
}
|
||||
|
||||
void
|
||||
screen_redraw(UxnScreen *p, Uint32 *pixels)
|
||||
screen_redraw(UxnScreen *p)
|
||||
{
|
||||
Uint32 i, size = p->width * p->height, palette[16];
|
||||
for(i = 0; i < 16; i++)
|
||||
palette[i] = p->palette[(i >> 2) ? (i >> 2) : (i & 3)];
|
||||
if(p->mono) {
|
||||
for(i = 0; i < size; i++)
|
||||
pixels[i] = palette_mono[(p->fg.pixels[i] ? p->fg.pixels[i] : p->bg.pixels[i]) & 0x1];
|
||||
p->pixels[i] = palette_mono[(p->fg.pixels[i] ? p->fg.pixels[i] : p->bg.pixels[i]) & 0x1];
|
||||
} else {
|
||||
for(i = 0; i < size; i++)
|
||||
pixels[i] = palette[p->fg.pixels[i] << 2 | p->bg.pixels[i]];
|
||||
p->pixels[i] = palette[p->fg.pixels[i] << 2 | p->bg.pixels[i]];
|
||||
}
|
||||
p->fg.changed = p->bg.changed = 0;
|
||||
}
|
||||
|
@ -130,10 +130,10 @@ clamp(int val, int min, int max)
|
|||
}
|
||||
|
||||
void
|
||||
screen_mono(UxnScreen *p, Uint32 *pixels)
|
||||
screen_mono(UxnScreen *p)
|
||||
{
|
||||
p->mono = !p->mono;
|
||||
screen_redraw(p, pixels);
|
||||
screen_redraw(p);
|
||||
}
|
||||
|
||||
/* IO */
|
||||
|
|
|
@ -28,8 +28,8 @@ extern UxnScreen uxn_screen;
|
|||
void screen_palette(UxnScreen *p, Uint8 *addr);
|
||||
void screen_resize(UxnScreen *p, Uint16 width, Uint16 height);
|
||||
void screen_clear(UxnScreen *p, Layer *layer);
|
||||
void screen_redraw(UxnScreen *p, Uint32 *pixels);
|
||||
void screen_mono(UxnScreen *p, Uint32 *pixels);
|
||||
void screen_redraw(UxnScreen *p);
|
||||
void screen_mono(UxnScreen *p);
|
||||
|
||||
Uint8 screen_dei(Uxn *u, Uint8 addr);
|
||||
void screen_deo(Uint8 *ram, Uint8 *d, Uint8 port);
|
||||
|
|
|
@ -220,7 +220,7 @@ static void
|
|||
redraw(void)
|
||||
{
|
||||
if(gRect.w != uxn_screen.width || gRect.h != uxn_screen.height) set_size();
|
||||
screen_redraw(&uxn_screen, uxn_screen.pixels);
|
||||
screen_redraw(&uxn_screen);
|
||||
if(SDL_UpdateTexture(gTexture, NULL, uxn_screen.pixels, uxn_screen.width * sizeof(Uint32)) != 0)
|
||||
error("SDL_UpdateTexture", SDL_GetError());
|
||||
SDL_RenderClear(gRenderer);
|
||||
|
@ -376,7 +376,7 @@ do_shortcut(Uxn *u, SDL_Event *event)
|
|||
else if(event->key.keysym.sym == SDLK_F4)
|
||||
restart(u);
|
||||
else if(event->key.keysym.sym == SDLK_F5) {
|
||||
screen_mono(&uxn_screen, uxn_screen.pixels);
|
||||
screen_mono(&uxn_screen);
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue