From a6163888f3c56123b1db313743c6147ba498732c Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Fri, 8 Aug 2014 14:42:07 +0300 Subject: Add third_party libs --- .../windows/fltk-1.1.10/test/doublebuffer.cxx | 128 +++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 third_party/windows/fltk-1.1.10/test/doublebuffer.cxx (limited to 'third_party/windows/fltk-1.1.10/test/doublebuffer.cxx') diff --git a/third_party/windows/fltk-1.1.10/test/doublebuffer.cxx b/third_party/windows/fltk-1.1.10/test/doublebuffer.cxx new file mode 100644 index 0000000..7227907 --- /dev/null +++ b/third_party/windows/fltk-1.1.10/test/doublebuffer.cxx @@ -0,0 +1,128 @@ +// +// "$Id: doublebuffer.cxx 5519 2006-10-11 03:12:15Z mike $" +// +// Double-buffering test program for the Fast Light Tool Kit (FLTK). +// +// This demo shows how double buffering helps, by drawing the +// window in a particularily bad way. +// +// The single-buffered window will blink as it updates. The +// double buffered one will not. It will take just as long +// (or longer) to update, but often it will appear to be faster. +// +// This demo should work for both the GL and X versions of Fl, +// even though the double buffering mechanism is totally different. +// +// Copyright 1998-2005 by Bill Spitzak and others. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems on the following page: +// +// http://www.fltk.org/str.php +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// this purposely draws each line 10 times to be slow: +void star(int w, int h, int n) { + fl_push_matrix(); + fl_translate(w/2, h/2); + fl_scale(w/2, h/2); + for (int i = 0; i < n; i++) { + for (int j = i+1; j < n; j++)/* for (int k=0; k<10; k++)*/ { + fl_begin_line(); + fl_vertex(cos(2*M_PI*i/n+.1), sin(2*M_PI*i/n+.1)); + fl_vertex(cos(2*M_PI*j/n+.1), sin(2*M_PI*j/n+.1)); + fl_end_line(); + } + } + fl_pop_matrix(); +} + +int sides[2] = {20,20}; + +void slider_cb(Fl_Widget* o, long v) { + sides[v] = int(((Fl_Slider*)o)->value()); + o->parent()->redraw(); +} + +void bad_draw(int w,int h,int which) { +// for (int i=0; i<10; i++) { +// fl_color(7); fl_rectf(0,0,w,h); fl_color(0); star(w,h); +// fl_color(0); fl_rectf(0,0,w,h); fl_color(7); star(w,h); +// } + fl_color(FL_BLACK); fl_rectf(0,0,w,h); + fl_color(FL_WHITE); star(w,h,sides[which]); + // for (int x=0; x