Skip to content

Commit

Permalink
screen_savers/Nebula: Cleanup DrawStars.
Browse files Browse the repository at this point in the history
The assembly I converted this from didn't look hand-generated, which
probably explains why it was so convoluted.

No functional change intended (the generated code will change, though.)
  • Loading branch information
waddlesplash committed Jul 8, 2015
1 parent 548f42a commit e274ee1
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions src/add-ons/screen_savers/nebula/DrawStars.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,40 +27,32 @@ void draw_stars(int star_width, char* dstParam, char incParam)
}

inc >>= 1;
al = *dst;
cl = dst[star_width - 1];
al += inc;
if (al >= inc) {
cl += inc;
if (cl < inc) {
*dst = 255;
dst[star_width - 1] = 255;
} else {
*dst = al;
dst[star_width - 1] = cl;
}
cl += inc;
if (cl < inc) {
*dst = 255;
dst[star_width - 1] = 255;
} else {
cl += inc;
if (cl < inc) {
*dst = 255;
dst[star_width - 1] = 255;
} else {
al = *dst;
al += inc;
if (al >= inc)
*dst = al;
else
*dst = 255;
dst[star_width - 1] = cl;
}
dst[star_width - 1] = cl;
}

al = dst[star_width * 2];
cl = dst[star_width + 1];
al += inc;
cl += inc;
if (al < inc) {
cl += inc;
if (cl >= inc) {
dst[star_width * 2] = 255;
dst[star_width + 1] = cl;
return;
}
} else {
cl += inc;
if (cl >= inc) {
dst[star_width * 2] = al;
dst[star_width + 1] = cl;
Expand Down

0 comments on commit e274ee1

Please sign in to comment.