ppu: remove unused "pixels" field from Ppu; reset bg/fg to all zeroes on init

This commit is contained in:
Sigrid Solveig Haflínudóttir 2021-09-17 20:24:50 +02:00
parent 67e30f7d88
commit ccd9aabecd
2 changed files with 3 additions and 3 deletions

View File

@ -76,7 +76,7 @@ ppu_init(Ppu *p, Uint8 hor, Uint8 ver)
{
p->width = 8 * hor;
p->height = 8 * ver;
p->bg = malloc(p->width / 4 * p->height * sizeof(Uint8));
p->fg = malloc(p->width / 4 * p->height * sizeof(Uint8));
p->bg = calloc(1, p->width / 4 * p->height * sizeof(Uint8));
p->fg = calloc(1, p->width / 4 * p->height * sizeof(Uint8));
return 1;
}

View File

@ -19,7 +19,7 @@ typedef unsigned int Uint32;
typedef struct Ppu {
Uint16 width, height;
Uint8 *pixels, *bg, *fg;
Uint8 *bg, *fg;
} Ppu;
int ppu_init(Ppu *p, Uint8 hor, Uint8 ver);