Skip to content

Commit

Permalink
screen_savers/Nebula: Make STAR_WIDTH an argument instead of a #define.
Browse files Browse the repository at this point in the history
  • Loading branch information
waddlesplash committed Jul 8, 2015
1 parent 9bc305b commit c5fe084
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 47 deletions.
2 changes: 1 addition & 1 deletion src/add-ons/screen_savers/nebula/DrawStars.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// #define STAR_FUNCTION draw_stars320

/* draw a star (5 pixels) */
void STAR_FUNCTION(char* dstParam, char incParam)
void draw_stars(int STAR_WIDTH, char* dstParam, char incParam)
{
unsigned char* dst;
unsigned char inc;
Expand Down
47 changes: 1 addition & 46 deletions src/add-ons/screen_savers/nebula/Nebula.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,36 +34,6 @@ typedef unsigned short word;

extern "C" {
#include "Draw.c"

#define STAR_WIDTH 320
#define STAR_FUNCTION draw_stars320
#include "DrawStars.c"
#define STAR_WIDTH 512
#define STAR_FUNCTION draw_stars512
#include "DrawStars.c"
#define STAR_WIDTH 576
#define STAR_FUNCTION draw_stars576
#include "DrawStars.c"
#define STAR_WIDTH 640
#define STAR_FUNCTION draw_stars640
#include "DrawStars.c"
#define STAR_WIDTH 800
#define STAR_FUNCTION draw_stars800
#include "DrawStars.c"
#define STAR_WIDTH 1024
#define STAR_FUNCTION draw_stars1024
#include "DrawStars.c"
#define STAR_WIDTH 1152
#define STAR_FUNCTION draw_stars1152
#include "DrawStars.c"
#define STAR_WIDTH 1280
#define STAR_FUNCTION draw_stars1280
#include "DrawStars.c"
#define STAR_WIDTH 1400
#define STAR_FUNCTION draw_stars1400
#include "DrawStars.c"
#define STAR_WIDTH 1600
#define STAR_FUNCTION draw_stars1600
#include "DrawStars.c"
}

Expand All @@ -74,7 +44,6 @@ const uint32 kMsgMotionBlur = 'blur';
const uint32 kMsgSpeed = 'sped';
const uint32 kMsgFrames = 'mfps';

void (*gDrawStarFunc)(char *,char);
float gSpeed;
bool gMotionBlur;
int32 gSettingsWidth;
Expand Down Expand Up @@ -188,7 +157,7 @@ drawshdisk(int x0, int y0, int r)

if (r <= SLIMIT) {
/* range checking is already (more or less) done... */
(*gDrawStarFunc)(&gBuffer8[x0 + gWidth*y0], 10+r*5);
draw_stars(gWidth, &gBuffer8[x0 + gWidth*y0], 10+r*5);
//gBuffer8[x0+W*y0] = 10+r*5;
return;
}
Expand Down Expand Up @@ -745,20 +714,6 @@ Nebula::StartSaver(BView *view, bool preview)
}
view->SetScale(fFactor);

switch (gWidth) {
default:
case 320: gDrawStarFunc = draw_stars320; break;
case 512: gDrawStarFunc = draw_stars512; break;
case 576: gDrawStarFunc = draw_stars576; break;
case 640: gDrawStarFunc = draw_stars640; break;
case 800: gDrawStarFunc = draw_stars800; break;
case 1024: gDrawStarFunc = draw_stars1024; break;
case 1152: gDrawStarFunc = draw_stars1152; break;
case 1280: gDrawStarFunc = draw_stars1280; break;
case 1400: gDrawStarFunc = draw_stars1400; break;
case 1600: gDrawStarFunc = draw_stars1600; break;
}

gBitmap = new BBitmap(BRect(0, 0, gWidth - 1, gHeight - 1), B_RGB32);
gBuffer8 = (char *)malloc(gWidth * gHeight);

Expand Down

0 comments on commit c5fe084

Please sign in to comment.