|
|
|
@ -50,7 +50,7 @@ void compmandelbrot_line(bitmap_t * mbrot, size_t y) {
|
|
|
|
|
for (size_t x = 0; x < mbrot->width; x++) {
|
|
|
|
|
|
|
|
|
|
float complex c = ((3.0f * x / mbrot->width) - 2.0f)
|
|
|
|
|
+ I * ((2.0f * y / mbrot->height) - 1.0f);
|
|
|
|
|
+ I * ((2.0f * y / mbrot->height) - 1.0f);
|
|
|
|
|
|
|
|
|
|
bool diverges = false;
|
|
|
|
|
float complex z = 0;
|
|
|
|
@ -143,7 +143,7 @@ static int save_png_to_file(bitmap_t * bitmap, const char *path) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
png_ptr =
|
|
|
|
|
png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
|
|
|
|
png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
|
|
|
|
if (png_ptr == NULL) {
|
|
|
|
|
goto png_create_write_struct_failed;
|
|
|
|
|
}
|
|
|
|
@ -172,7 +172,7 @@ static int save_png_to_file(bitmap_t * bitmap, const char *path) {
|
|
|
|
|
row_pointers = png_malloc(png_ptr, bitmap->height * sizeof(png_byte *));
|
|
|
|
|
for (y = 0; y < bitmap->height; ++y) {
|
|
|
|
|
png_byte *row =
|
|
|
|
|
png_malloc(png_ptr, sizeof(uint8_t) * bitmap->width * pixel_size);
|
|
|
|
|
png_malloc(png_ptr, sizeof(uint8_t) * bitmap->width * pixel_size);
|
|
|
|
|
row_pointers[y] = row;
|
|
|
|
|
for (x = 0; x < bitmap->width; ++x) {
|
|
|
|
|
pixel_t *pixel = bitmap->pixels + (y * bitmap->width + x);
|
|
|
|
@ -235,7 +235,7 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
|
|
|
|
|
for (int t = 0; t < num_threads; t++) {
|
|
|
|
|
ret =
|
|
|
|
|
pthread_create(&threads[t], NULL, compmandelbrot, (void *) NULL);
|
|
|
|
|
pthread_create(&threads[t], NULL, compmandelbrot, (void *) NULL);
|
|
|
|
|
assert(ret == 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|