Fresco/Berlin/modules/Drawing/openGL DrawingKit.hh,1.61,1.62 DrawingKit.cc,1.102,1.103
Nick Lewycky <[email protected]>
| Newsgroups | gmane.comp.video.fresco.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvs/fresco/Fresco/Berlin/modules/Drawing/openGL
In directory purcel:/tmp/cvs-serv18067
Modified Files:
DrawingKit.hh DrawingKit.cc
Log Message:
Don't call light::pop() from outside of the worker thread.
Index: DrawingKit.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Drawing/openGL/DrawingKit.hh,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- DrawingKit.hh 5 Jan 2003 16:21:31 -0000 1.61
+++ DrawingKit.hh 12 Jan 2003 04:11:41 -0000 1.62
@@ -48,11 +48,13 @@
class DrawingKit : public virtual POA_Fresco::DrawingKit3D,
public DrawingKitBase, public KitImpl
{
+ class Restore;
friend class Texture;
friend class Image;
class Light
{
+ friend class openGL::DrawingKit::Restore;
public:
Light(GLContext *);
int push();
Index: DrawingKit.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Drawing/openGL/DrawingKit.cc,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -d -r1.102 -r1.103
--- DrawingKit.cc 5 Jan 2003 16:21:30 -0000 1.102
+++ DrawingKit.cc 12 Jan 2003 04:11:41 -0000 1.103
@@ -98,12 +98,25 @@
_states.top().lights = _light->top();
}
+class openGL::DrawingKit::Restore : public virtual GLContext::Callback {
+public:
+ Restore::Restore(openGL::DrawingKit::Light *light, int prev_light)
+ : my_light(light), my_prev(prev_light) {}
+ void operator()() {
+ while (my_light->top() > my_prev) my_light->pop();
+ delete this;
+ }
+private:
+ openGL::DrawingKit::Light *my_light;
+ int my_prev;
+};
+
void openGL::DrawingKit::restore()
{
DrawingKitBase::restore();
if (_states.empty()) return; // no state to restore
DrawState &prev = _states.top();
- while (_light->top() > prev.lights) _light->pop();
+ my_glcontext->add_to_queue(new Restore(_light, prev.lights));
_states.pop();
}