ppu_resize: f49143782a
was wrong. keep successfully reallocated layers
This commit is contained in:
parent
831014e811
commit
8bbe5c1dfd
|
@ -57,18 +57,15 @@ ppu_resize(Ppu *p, Uint16 width, Uint16 height)
|
||||||
Uint8
|
Uint8
|
||||||
*bg = realloc(p->bg.pixels, width * height),
|
*bg = realloc(p->bg.pixels, width * height),
|
||||||
*fg = realloc(p->fg.pixels, width * height);
|
*fg = realloc(p->fg.pixels, width * height);
|
||||||
if(!bg || !fg) {
|
if(bg) p->bg.pixels = bg;
|
||||||
free(bg);
|
if(fg) p->fg.pixels = fg;
|
||||||
free(fg);
|
if(bg && fg) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
p->bg.pixels = bg;
|
|
||||||
p->fg.pixels = fg;
|
|
||||||
p->width = width;
|
p->width = width;
|
||||||
p->height = height;
|
p->height = height;
|
||||||
ppu_clear(p, &p->bg);
|
ppu_clear(p, &p->bg);
|
||||||
ppu_clear(p, &p->fg);
|
ppu_clear(p, &p->fg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ppu_clear(Ppu *p, Layer *layer)
|
ppu_clear(Ppu *p, Layer *layer)
|
||||||
|
|
Loading…
Reference in New Issue