=== modified file 'src/composite-test-simple-fade.cc'
@@ -28,6 +28,7 @@
#include <sstream>
using std::string;
+using std::list;
const string CompositeTestSimpleFade::fade_bias_name_("alpha_bias");
@@ -53,11 +54,14 @@
uint64_t last_eof_;
float bias_;
float duration_;
- Fader();
public:
- Fader(const string& duration) :
+ Fader() :
+ start_time_(0),
last_eof_(0),
- bias_(0.0)
+ bias_(0.0),
+ duration_(0.0) {}
+ ~Fader() {}
+ void init(const string& duration)
{
// Convert the string representation of the duration in seconds
// to microseconds as that's what we'll need to track the time.
@@ -66,7 +70,6 @@
duration_ *= 1000000;
start_time_ = Profiler::get_timestamp_us();
}
- ~Fader() {}
void update()
{
last_eof_ = Profiler::get_timestamp_us();
@@ -84,8 +87,17 @@
float bias() const { return bias_; }
};
-void
-CompositeTestSimpleFade::draw(std::list<CompositeWindow *> &window_list)
+static Fader fader;
+
+void
+CompositeTestSimpleFade::prepare_for_run(list<CompositeWindow*>& window_list)
+{
+ CompositeTestSimpleBase::prepare_for_run(window_list);
+ fader.init(options_["duration"].value);
+}
+
+void
+CompositeTestSimpleFade::draw(list<CompositeWindow*>& window_list)
{
vboData_.bind();
glActiveTexture(GL_TEXTURE0);
@@ -100,7 +112,6 @@
glEnableVertexAttribArray(texcoordIndex_);
program_[projection_matrix_name_] = projection_matrix.getCurrent();
- static Fader fader(options_["duration"].value);
program_[fade_bias_name_] = fader.bias();
/* Find out how many windows are visible and calculate the angular step */
@@ -109,7 +120,7 @@
/* Draw the windows in a circle using the calculated angular step */
GLint i(0);
- for(std::list<CompositeWindow*>::iterator iter = window_list.begin();
+ for(list<CompositeWindow*>::iterator iter = window_list.begin();
iter != window_list.end(); ++iter)
{
CompositeWindow *comp_win = *iter;
=== modified file 'src/composite-test.h'
@@ -227,6 +227,7 @@
virtual void draw(std::list<CompositeWindow*> &window_list);
virtual bool init_shaders(ShaderSource& vtx, ShaderSource& frg);
+ virtual void prepare_for_run(std::list<CompositeWindow*>& window_list);
};
struct BlurPrivate;