From 5654f62097b2ace3648055b442e6a6d55872a0b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 12 Mar 2009 11:27:22 +0000 Subject: [PATCH] Almost didn't notice this patch from Christian Packmann: * changed function names iterate() and iterate1() to more descriptive iterate_float() and iterate_double() * set better starting position for Mandelbrot set * add higher values to "Iterations" menu: 2048, 4096, 8192 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29477 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/mandelbrot/Mandelbrot.cpp | 6 ++++++ src/apps/mandelbrot/tsb.cpp | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/apps/mandelbrot/Mandelbrot.cpp b/src/apps/mandelbrot/Mandelbrot.cpp index 1b1ed79ab6..c543a5ff13 100644 --- a/src/apps/mandelbrot/Mandelbrot.cpp +++ b/src/apps/mandelbrot/Mandelbrot.cpp @@ -72,6 +72,9 @@ TMainWindow::TMainWindow(BRect bound, char* name, window_type type, long flags) menu->AddItem(new BMenuItem("512", new BMessage(512))); menu->AddItem(new BMenuItem("768", new BMessage(768))); menu->AddItem(new BMenuItem("1024", new BMessage(1024))); + menu->AddItem(new BMenuItem("2048", new BMessage(2048))); + menu->AddItem(new BMenuItem("4096", new BMessage(4096))); + menu->AddItem(new BMenuItem("8192", new BMessage(8192))); menuBar->AddItem(menu); item->SetMarked(true); @@ -173,6 +176,9 @@ TMainWindow::MessageReceived(BMessage* message) case 512: case 768: case 1024: + case 2048: + case 4096: + case 8192: fView->set_iter(message->what); break; diff --git a/src/apps/mandelbrot/tsb.cpp b/src/apps/mandelbrot/tsb.cpp index 0afea97ae9..51aa8e814d 100644 --- a/src/apps/mandelbrot/tsb.cpp +++ b/src/apps/mandelbrot/tsb.cpp @@ -150,9 +150,9 @@ TShowBit::TShowBit(BRect r, uint32 resizeMask, uint32 flags) : the_bitmap = new BBitmap(bitmap_r, B_COLOR_8_BIT); bits = (char *)the_bitmap->Bits(); memset(bits, 0x00, size_x*size_y); - px = -1.5; - py = -1.5; - scale = 3.0; + px = -2.5; + py = -2.0; + scale = 4.0; set_palette(2); } @@ -174,7 +174,7 @@ void TShowBit::Draw(BRect update_rect) /*------------------------------------------------------------*/ -int iterate1(double a, double b) +int iterate_double(double a, double b) { double x; double y; @@ -203,7 +203,7 @@ int iterate1(double a, double b) //extern "C" int iterate(float a, float b); /*------------------------------------------------------------*/ -int iterate(float a, float b) +int iterate_float(float a, float b) { float x; float y; @@ -309,13 +309,13 @@ void TShowBit::precompute(double vx, double vy, double sx, double sy) if (scale < 0.000025 || niter != 256) { for (x = 0; x < 32; x++) { cx += sx; - pc[x][y] = iterate1(cx, cy); + pc[x][y] = iterate_double(cx, cy); } } else for (x = 0; x < 32; x++) { cx += sx; - pc[x][y] = iterate(cx, cy); + pc[x][y] = iterate_float(cx, cy); } } } @@ -366,14 +366,14 @@ void TShowBit::mandb(double vx, double vy, double sx, double sy) if (scale < 0.000025 || niter != 256) { for (x = bx; x < (bx+12); x++) { cx += sx; - v = iterate1(cx, cy); + v = iterate_double(cx, cy); *b0++ = palette[v]; } } else for (x = bx; x < (bx+12); x++) { cx += sx; - v = iterate(cx, cy); + v = iterate_float(cx, cy); *b0++ = palette[v]; } } @@ -428,14 +428,14 @@ void TShowBit::manda(double vx, double vy, double sx, double sy) if (scale < 0.000025 || niter != 256) { for (x = bx; x < (bx+12); x++) { cx += sx; - v = iterate1(cx, cy); + v = iterate_double(cx, cy); *b0++ = palette[v]; } } else for (x = bx; x < (bx+12); x++) { cx += sx; - v = iterate(cx, cy); + v = iterate_float(cx, cy); *b0++ = palette[v]; } }