From c033979130b1c5822c5e9fc55bffc09632d5a48f Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sat, 28 May 2011 23:09:06 +0200 Subject: [PATCH] screen shot fixes (issue #127 related) Provide proper return status when screen grabbing. Allow tasks to remove themselves (return task entries to the queue _before_ executig them) --- simgear/screen/screen-dump.cxx | 5 ++--- simgear/structure/SGAtomic.cxx | 6 +++--- simgear/structure/event_mgr.cxx | 7 +++---- simgear/timing/timestamp.hxx | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/simgear/screen/screen-dump.cxx b/simgear/screen/screen-dump.cxx index 5ba9f9ef..ecea8659 100644 --- a/simgear/screen/screen-dump.cxx +++ b/simgear/screen/screen-dump.cxx @@ -75,11 +75,10 @@ bool sg_glWritePPMFile(const char *filename, GLubyte *buffer, int win_width, int } -// dump the screen buffer to a png file +// dump the screen buffer to a png file, returns true on success bool sg_glDumpWindow(const char *filename, int win_width, int win_height) { osg::ref_ptr img(new osg::Image); img->readPixels(0,0, win_width, win_height, GL_RGB, GL_UNSIGNED_BYTE); - osgDB::writeImageFile(*img, filename); - return true; + return osgDB::writeImageFile(*img, filename); } diff --git a/simgear/structure/SGAtomic.cxx b/simgear/structure/SGAtomic.cxx index e7dd76c2..728994df 100644 --- a/simgear/structure/SGAtomic.cxx +++ b/simgear/structure/SGAtomic.cxx @@ -22,12 +22,12 @@ #if defined(SGATOMIC_USE_GCC4_BUILTINS) && defined (__i386__) -// Usually the apropriate functions are inlined by gcc. -// But if gcc is called with something aequivalent to -march=i386, +// Usually the appropriate functions are inlined by gcc. +// But if gcc is called with something equivalent to -march=i386, // it will not assume that there is a lock instruction and instead // calls this pair of functions. We will provide them here in this case. // Note that this assembler code will not work on a i386 chip anymore. -// But I hardly believe that we can assume to run at least on a i486 ... +// But I firmly believe that we can assume to run at least on a i486 ... extern "C" { diff --git a/simgear/structure/event_mgr.cxx b/simgear/structure/event_mgr.cxx index 63e4672f..eeefaac9 100644 --- a/simgear/structure/event_mgr.cxx +++ b/simgear/structure/event_mgr.cxx @@ -94,12 +94,11 @@ void SGTimerQueue::update(double deltaSecs) _now += deltaSecs; while(_numEntries && nextTime() <= _now) { SGTimer* t = remove(); - t->run(); - if(t->repeat) { + if(t->repeat) insert(t, t->interval); - } else { + t->run(); + if (!t->repeat) delete t; - } } } diff --git a/simgear/timing/timestamp.hxx b/simgear/timing/timestamp.hxx index 880d5dcc..e6aeb0a2 100644 --- a/simgear/timing/timestamp.hxx +++ b/simgear/timing/timestamp.hxx @@ -44,7 +44,7 @@ * level of accuracy). * * The SGTimeStamp is useful for tracking the elapsed time of various - * events in your program. You can also use it to keep constistant + * events in your program. You can also use it to keep consistent * motion across varying frame rates. * * Note SGTimestamp does not deliver the time of day. The content of this -- 2.39.5