Skip to content

Commit

Permalink
screen_savers/Nebula: Create header files for Draw.c/DrawStars.c.
Browse files Browse the repository at this point in the history
  • Loading branch information
waddlesplash committed Jul 8, 2015
1 parent 0173279 commit 43b42b9
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 8 deletions.
7 changes: 5 additions & 2 deletions src/add-ons/screen_savers/nebula/Draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@
* Effect from corTeX / Optimum.
*/

// Hand-translated from x86 assembly.
#include <SupportDefs.h>

#include "Draw.h"


// Hand-translated from x86 assembly.
/* memshset (char *dst, int center_shade,int fixed_shade, int length_2) */
/* dst is the *center* of the dst segment */
/* center shade is the initial color (at center) (!! 8:8 also) */
/* fixed_shade is the fixed point increment (8:8) */
/* length_2 is the 1/2 length to set (to the left, and to the right) */

/* a memaddshadedset function (or something like that ) */

void memshset(char* dstParam, int center_shade, int fixed_shade, int half_length)
{
unsigned char* dst;
Expand Down
16 changes: 16 additions & 0 deletions src/add-ons/screen_savers/nebula/Draw.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2015, Augustin Cavalier <waddlesplash>. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Effect from corTeX / Optimum.
*/
#ifndef NEBULA_DRAW_H
#define NEBULA_DRAW_H


void memshset(char* dstParam, int center_shade, int fixed_shade, int half_length);
void mblur(char* srcParam, int nbpixels);


#endif /* NEBULA_DRAW_H */
10 changes: 6 additions & 4 deletions src/add-ons/screen_savers/nebula/DrawStars.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
* Effect from corTeX / Optimum.
*/

// Hand-translated from x86 assembly.
#include <SupportDefs.h>

#include "DrawStars.h"


// Hand-translated from x86 assembly.
/* draw a star (5 pixels) */
void draw_stars(int star_width, char* dstParam, char incParam)
{
unsigned char* dst;
unsigned char inc;
unsigned char inc, al, cl;
dst = (unsigned char*)dstParam;
inc = (unsigned char)incParam;

Expand All @@ -23,9 +27,7 @@ void draw_stars(int star_width, char* dstParam, char incParam)
}

inc >>= 1;
unsigned char al;
al = *dst;
unsigned char cl;
cl = dst[star_width - 1];
al += inc;
if (al >= inc) {
Expand Down
15 changes: 15 additions & 0 deletions src/add-ons/screen_savers/nebula/DrawStars.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2015, Augustin Cavalier <waddlesplash>. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Effect from corTeX / Optimum.
*/
#ifndef NEBULA_DRAWSTARS_H
#define NEBULA_DRAWSTARS_H


void draw_stars(int star_width, char* dstParam, char incParam);


#endif /* NEBULA_DRAWSTARS_H */
2 changes: 2 additions & 0 deletions src/add-ons/screen_savers/nebula/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ SubDirC++Flags -Wno-error ;
AddResources Nebula : Nebula.rdef ;

ScreenSaver Nebula :
Draw.c
DrawStars.c
Nebula.cpp :
be libscreensaver.so [ TargetLibsupc++ ]
;
4 changes: 2 additions & 2 deletions src/add-ons/screen_savers/nebula/Nebula.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ float presin[512];
typedef unsigned short word;

extern "C" {
#include "Draw.c"
#include "DrawStars.c"
#include "Draw.h"
#include "DrawStars.h"
}

const uint32 kMsgWidth = 'widt';
Expand Down

0 comments on commit 43b42b9

Please sign in to comment.