diff options
Diffstat (limited to 'libs/canvas/test/gtk_many.cc')
-rw-r--r-- | libs/canvas/test/gtk_many.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/libs/canvas/test/gtk_many.cc b/libs/canvas/test/gtk_many.cc new file mode 100644 index 0000000000..e75ce05ac0 --- /dev/null +++ b/libs/canvas/test/gtk_many.cc @@ -0,0 +1,39 @@ +#include <iostream> +#include <gtkmm.h> +#include "canvas/canvas.h" +#include "canvas/rectangle.h" + +using namespace std; +using namespace ArdourCanvas; + +int main (int argc, char* argv[]) +{ + Gtk::Main kit (argc, argv); + + Gtk::Window window; + window.set_title ("Hello world"); + window.set_size_request (512, 512); + GtkCanvas canvas; + canvas.set_size_request (2048, 2048); + + int const N = 10000; + double Ns = sqrt (N); + int max_x = 1024; + int max_y = 1024; + + for (int x = 0; x < Ns; ++x) { + for (int y = 0; y < Ns; ++y) { + Rectangle* r = new Rectangle (canvas.root ()); + r->set (Rect (x * max_x / Ns, y * max_y / Ns, (x + 1) * max_x / Ns, (y + 1) * max_y / Ns)); + } + } + + Gtk::ScrolledWindow scroller; + scroller.add (canvas); + window.add (scroller); + canvas.show (); + window.show_all (); + + Gtk::Main::run (window); + return 0; +} |