ppu_write: put new byte value only if it's different

This commit is contained in:
Sigrid Solveig Haflínudóttir 2021-11-02 18:18:30 +01:00
parent ca5675419e
commit 28aaf40e6d
No known key found for this signature in database
GPG Key ID: FC8DDA5A6A7456C4
1 changed files with 3 additions and 2 deletions

View File

@ -61,9 +61,10 @@ ppu_write(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 color)
Uint8 pix = p->pixels[row];
Uint8 mask = ~(0x3 << shift);
Uint8 pixnew = (pix & mask) + (color << shift);
p->pixels[row] = pixnew;
if(pix != pixnew)
if(pix != pixnew){
p->pixels[row] = pixnew;
p->reqdraw = 1;
}
}
}