|
|
|
@ -7,10 +7,10 @@
|
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
|
|
#include <SDL.h>
|
|
|
|
|
#include <SDL_ttf.h>
|
|
|
|
|
|
|
|
|
|
#define MAX_SOURCE_SIZE (0x100000)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef CACHE
|
|
|
|
|
int** cached_points;
|
|
|
|
|
int** cached_x;
|
|
|
|
@ -249,7 +249,6 @@ int julia_point(int res_x, int res_y, int image_x, int image_y, float zoom, int
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Splits the image in pieces and calls the corresponding algorithm
|
|
|
|
|
void *thread_launcher(void *arguments)
|
|
|
|
|
{
|
|
|
|
@ -302,6 +301,7 @@ void *thread_launcher(void *arguments)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int get_cpus()
|
|
|
|
|
{
|
|
|
|
|
int number_of_cores = 0;
|
|
|
|
@ -309,6 +309,7 @@ int get_cpus()
|
|
|
|
|
return number_of_cores;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argn, char **argv)
|
|
|
|
|
{
|
|
|
|
|
// Init SDL
|
|
|
|
@ -318,7 +319,7 @@ int main(int argn, char **argv)
|
|
|
|
|
printf("SDL Initialized\n");
|
|
|
|
|
|
|
|
|
|
// Create screen surface
|
|
|
|
|
SDL_Surface *screen;
|
|
|
|
|
SDL_Surface *screen, *message;
|
|
|
|
|
int res_x = 800;
|
|
|
|
|
int res_y = 600;
|
|
|
|
|
int julia_mode = 0;
|
|
|
|
@ -373,6 +374,28 @@ int main(int argn, char **argv)
|
|
|
|
|
screen = SDL_SetVideoMode(res_x, res_y, 0, SDL_DOUBLEBUF);
|
|
|
|
|
if(!screen)
|
|
|
|
|
fprintf(stderr,"Could not set video mode: %s\n",SDL_GetError());
|
|
|
|
|
// Set the title bar
|
|
|
|
|
SDL_WM_SetCaption("CLFract", "CLFract");
|
|
|
|
|
|
|
|
|
|
//Initialize SDL_ttf
|
|
|
|
|
if( TTF_Init() == -1 )
|
|
|
|
|
{
|
|
|
|
|
printf("Error setting up TTF module.\n");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Load a font
|
|
|
|
|
TTF_Font *font;
|
|
|
|
|
font = TTF_OpenFont("font.ttf", 24);
|
|
|
|
|
if (font == NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("TTF_OpenFont() Failed: %s", TTF_GetError());
|
|
|
|
|
SDL_Quit();
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//The color of the font
|
|
|
|
|
SDL_Color textColor = { 255, 255, 255 };
|
|
|
|
|
|
|
|
|
|
// Prepare the resolution and sizes and colors, threads...
|
|
|
|
|
iteration_pixels = malloc(res_x * res_y * sizeof(int));
|
|
|
|
@ -468,6 +491,16 @@ int main(int argn, char **argv)
|
|
|
|
|
else
|
|
|
|
|
zoom -= 0.01;
|
|
|
|
|
|
|
|
|
|
// Draw message on a corner...
|
|
|
|
|
char* msg = (char *)malloc(100 * sizeof(char));
|
|
|
|
|
sprintf(msg, "Zoom level: %0.3f", zoom * 100.0);
|
|
|
|
|
message = TTF_RenderText_Solid( font, msg, textColor );
|
|
|
|
|
free(msg);
|
|
|
|
|
if (message != NULL)
|
|
|
|
|
SDL_BlitSurface(message, NULL, screen, NULL);
|
|
|
|
|
|
|
|
|
|
free(message);
|
|
|
|
|
|
|
|
|
|
SDL_Flip(screen);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|