gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. 8a5fc4d997179ffd9aa0


From: Sandro Santilli
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. 8a5fc4d997179ffd9aa0724ec1903c84eecee9fe
Date: Fri, 22 Oct 2010 15:36:11 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  8a5fc4d997179ffd9aa0724ec1903c84eecee9fe (commit)
      from  45c15b8d2f018d0555212a578c3e6ec6ee4fceba (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=8a5fc4d997179ffd9aa0724ec1903c84eecee9fe


commit 8a5fc4d997179ffd9aa0724ec1903c84eecee9fe
Author: Sandro Santilli <address@hidden>
Date:   Fri Oct 22 17:35:45 2010 +0200

    Put ScreenShotter in its own file (trying to make gui cleaner)

diff --git a/gui/Makefile.am b/gui/Makefile.am
index 9dffc5e..27643e3 100644
--- a/gui/Makefile.am
+++ b/gui/Makefile.am
@@ -214,6 +214,7 @@ GUI_SRCS = gnash.cpp \
        gui.cpp gui.h \
        Player.cpp Player.h \
        NullGui.cpp NullGui.h \
+       ScreenShotter.cpp ScreenShotter.h \
        $(NULL)
 
 if BUILD_AQUA_GUI
diff --git a/gui/ScreenShotter.cpp b/gui/ScreenShotter.cpp
new file mode 100644
index 0000000..dc2a529
--- /dev/null
+++ b/gui/ScreenShotter.cpp
@@ -0,0 +1,77 @@
+// ScreenShotter.cpp:  Handles screen dumps
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "ScreenShotter.h"
+#include "tu_file.h" // still here ?
+
+#include <cstdio>
+#include <boost/algorithm/string/replace.hpp>
+#include <boost/lexical_cast.hpp>
+
+namespace gnash {
+
+void
+ScreenShotter::saveImage(const std::string& id) const
+{
+    // Replace all "%f" in the filename with the frameAdvance.
+    std::string outfile(_fileName);
+    boost::replace_all(outfile, "%f", id);
+    
+    FILE* f = std::fopen(outfile.c_str(), "wb");
+    if (f) {
+        boost::shared_ptr<IOChannel> t(new tu_file(f, true));
+        _renderer->renderToImage(t, GNASH_FILETYPE_PNG);
+    } else {
+        log_error("Failed to open screenshot file \"%s\"!", outfile);
+    }
+}
+
+void
+ScreenShotter::screenShot(size_t frameAdvance)
+{
+    // Save an image if an spontaneous screenshot was requested or the
+    // frame is in the list of requested frames.
+    if (_immediate || std::binary_search(_frames.begin(), _frames.end(),
+                frameAdvance)) {
+        saveImage(boost::lexical_cast<std::string>(frameAdvance));
+        _immediate = false;
+    }
+}
+
+void
+ScreenShotter::last() const
+{
+    if (_last) {
+       saveImage("last");
+    }
+}
+
+void
+ScreenShotter::setFrames(const FrameList& frames)
+{
+    _frames = frames;
+    std::sort(_frames.begin(), _frames.end());
+}
+
+} // end of gnash namespace
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
diff --git a/gui/ScreenShotter.h b/gui/ScreenShotter.h
new file mode 100644
index 0000000..9acbe0d
--- /dev/null
+++ b/gui/ScreenShotter.h
@@ -0,0 +1,103 @@
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program 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 General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifndef GNASH_GUI_SCREENSHOTTER_H
+#define GNASH_GUI_SCREENSHOTTER_H
+
+#include "Renderer.h" 
+
+#include <string>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+namespace gnash {
+
+/// Handles screen dumps.
+class ScreenShotter
+{
+public:
+
+    typedef std::vector<size_t> FrameList;
+
+    /// Create a ScreenShotter with renderer and output name.
+    ScreenShotter(boost::shared_ptr<Renderer> r, const std::string& fileName)
+        :
+        _renderer(r),
+        _immediate(false),
+        _fileName(fileName),
+        _last(false)
+    {}
+
+    /// Take a screenshot at the next possible moment.
+    void now() {
+        _immediate = true;
+    }
+
+    /// Take a screenshot when the last frame is reached.
+    void lastFrame() {
+        _last = true;
+    }
+
+    /// Called on the last frame before exit.
+    //
+    /// Which frame is last depends on the execution path of the SWF, whether
+    /// the SWF loops, whether a timeout was requested or a maximum number of
+    /// advances set. Those conditions are not knowable in advance, so
+    /// the last frame is a special case.
+    void last() const;
+
+    /// Takes a screenshot if required.
+    //
+    /// Called on each advance.
+    //
+    /// @param frameAdvance     used to check whether a screenshot is required
+    ///                         as well as to construct the filename.
+    void screenShot(size_t frameAdvance);
+
+    /// Request a list of frames to be rendered to image files.
+    void setFrames(const FrameList& frames);
+
+private:
+
+    /// Take the screenshot.
+    void saveImage(const std::string& filename) const;
+
+    boost::shared_ptr<Renderer> _renderer;
+
+    /// If true, the next call to screenshot will take a screenshot
+    bool _immediate;
+
+    /// Name used to generate output file.
+    const std::string _fileName;
+
+    /// Whether to take a screenshot on the last frame.
+    bool _last;
+
+    FrameList _frames;
+
+};
+
+} // end of gnash namespace
+
+// end of GNASH_GUI_SCREENSHOTTER_H
+#endif
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/gui/gui.cpp b/gui/gui.cpp
index 29aca8b..75f556d 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -28,8 +28,6 @@
 #include <cstdio>
 #include <cstring>
 #include <algorithm> 
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/lexical_cast.hpp>
 
 #include "MovieClip.h"
 #include "Renderer.h"
@@ -37,7 +35,6 @@
 #include "movie_root.h"
 #include "VM.h"
 #include "DisplayObject.h"
-#include "tu_file.h"
 #include "GnashEnums.h"
 #include "RunResources.h"
 #include "StreamProvider.h"
@@ -1350,48 +1347,6 @@ Gui::callCallback(int fd)
     f();
 }
 
-void
-ScreenShotter::saveImage(const std::string& id) const
-{
-    // Replace all "%f" in the filename with the frameAdvance.
-    std::string outfile(_fileName);
-    boost::replace_all(outfile, "%f", id);
-    
-    FILE* f = std::fopen(outfile.c_str(), "wb");
-    if (f) {
-        boost::shared_ptr<IOChannel> t(new tu_file(f, true));
-        _renderer->renderToImage(t, GNASH_FILETYPE_PNG);
-    } else {
-        log_error("Failed to open screenshot file \"%s\"!", outfile);
-    }
-}
-
-void
-ScreenShotter::screenShot(size_t frameAdvance)
-{
-    // Save an image if an spontaneous screenshot was requested or the
-    // frame is in the list of requested frames.
-    if (_immediate || std::binary_search(_frames.begin(), _frames.end(),
-                frameAdvance)) {
-        saveImage(boost::lexical_cast<std::string>(frameAdvance));
-        _immediate = false;
-    }
-}
-
-void
-ScreenShotter::last() const
-{
-    if (_last) {
-       saveImage("last");
-    }
-}
-
-void
-ScreenShotter::setFrames(const FrameList& frames)
-{
-    _frames = frames;
-    std::sort(_frames.begin(), _frames.end());
-}
 
 // end of namespace
 }
diff --git a/gui/gui.h b/gui/gui.h
index bbe83c6..128aeef 100644
--- a/gui/gui.h
+++ b/gui/gui.h
@@ -24,6 +24,7 @@
 #endif
 
 #include "snappingrange.h"  // for InvalidatedRanges
+#include "ScreenShotter.h"
 #include "GnashKey.h"
 #include "Renderer.h" 
 #include "VirtualClock.h"
@@ -80,72 +81,6 @@ enum gnash_cursor_type {
   CURSOR_INPUT
 };
 
-
-/// Handles screen dumps.
-class ScreenShotter
-{
-public:
-
-    typedef std::vector<size_t> FrameList;
-
-    /// Create a ScreenShotter with renderer and output name.
-    ScreenShotter(boost::shared_ptr<Renderer> r, const std::string& fileName)
-        :
-        _renderer(r),
-        _immediate(false),
-        _fileName(fileName),
-        _last(false)
-    {}
-
-    /// Take a screenshot at the next possible moment.
-    void now() {
-        _immediate = true;
-    }
-
-    /// Take a screenshot when the last frame is reached.
-    void lastFrame() {
-        _last = true;
-    }
-
-    /// Called on the last frame before exit.
-    //
-    /// Which frame is last depends on the execution path of the SWF, whether
-    /// the SWF loops, whether a timeout was requested or a maximum number of
-    /// advances set. Those conditions are not knowable in advance, so
-    /// the last frame is a special case.
-    void last() const;
-
-    /// Takes a screenshot if required.
-    //
-    /// Called on each advance.
-    //
-    /// @param frameAdvance     used to check whether a screenshot is required
-    ///                         as well as to construct the filename.
-    void screenShot(size_t frameAdvance);
-
-    /// Request a list of frames to be rendered to image files.
-    void setFrames(const FrameList& frames);
-
-private:
-
-    /// Take the screenshot.
-    void saveImage(const std::string& filename) const;
-
-    boost::shared_ptr<Renderer> _renderer;
-
-    /// If true, the next call to screenshot will take a screenshot
-    bool _immediate;
-
-    /// Name used to generate output file.
-    const std::string _fileName;
-
-    /// Whether to take a screenshot on the last frame.
-    bool _last;
-
-    FrameList _frames;
-
-};
-
 /// Parent class from which all GUI implementations will depend.
 class Gui {
 

-----------------------------------------------------------------------

Summary of changes:
 gui/Makefile.am       |    1 +
 gui/ScreenShotter.cpp |   77 ++++++++++++++++++++++++++++++++++++
 gui/ScreenShotter.h   |  103 +++++++++++++++++++++++++++++++++++++++++++++++++
 gui/gui.cpp           |   45 ---------------------
 gui/gui.h             |   67 +-------------------------------
 5 files changed, 182 insertions(+), 111 deletions(-)
 create mode 100644 gui/ScreenShotter.cpp
 create mode 100644 gui/ScreenShotter.h


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]