mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-28 00:33:02 +00:00
ppu_resize: f49143782a
was wrong. keep successfully reallocated layers
This commit is contained in:
parent
831014e811
commit
8bbe5c1dfd
1 changed files with 7 additions and 10 deletions
|
@ -57,17 +57,14 @@ ppu_resize(Ppu *p, Uint16 width, Uint16 height)
|
|||
Uint8
|
||||
*bg = realloc(p->bg.pixels, width * height),
|
||||
*fg = realloc(p->fg.pixels, width * height);
|
||||
if(!bg || !fg) {
|
||||
free(bg);
|
||||
free(fg);
|
||||
return;
|
||||
if(bg) p->bg.pixels = bg;
|
||||
if(fg) p->fg.pixels = fg;
|
||||
if(bg && fg) {
|
||||
p->width = width;
|
||||
p->height = height;
|
||||
ppu_clear(p, &p->bg);
|
||||
ppu_clear(p, &p->fg);
|
||||
}
|
||||
p->bg.pixels = bg;
|
||||
p->fg.pixels = fg;
|
||||
p->width = width;
|
||||
p->height = height;
|
||||
ppu_clear(p, &p->bg);
|
||||
ppu_clear(p, &p->fg);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue