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. cb5f0ec90ea63cfd9bb7


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. cb5f0ec90ea63cfd9bb7f9d83020f1f5f798d202
Date: Mon, 24 Jan 2011 12:33:24 +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  cb5f0ec90ea63cfd9bb7f9d83020f1f5f798d202 (commit)
       via  85aa9fb011fce132de5722e5c2ad89b245a8a15a (commit)
      from  a9bf8739358c0fc33ed178b71b21b93f730b54e6 (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=cb5f0ec90ea63cfd9bb7f9d83020f1f5f798d202


commit cb5f0ec90ea63cfd9bb7f9d83020f1f5f798d202
Author: Benjamin Wolsey <address@hidden>
Date:   Mon Jan 24 12:58:19 2011 +0100

    Hide GIF implementation.

diff --git a/libbase/GnashImage.cpp b/libbase/GnashImage.cpp
index edd82d9..b93ace2 100644
--- a/libbase/GnashImage.cpp
+++ b/libbase/GnashImage.cpp
@@ -208,7 +208,7 @@ Input::readImageData(boost::shared_ptr<IOChannel> in, 
FileType type)
 #endif
 #ifdef USE_GIF                
         case GNASH_FILETYPE_GIF:
-            inChannel = GifInput::create(in);
+            inChannel = createGifInput(in);
             break;
 #endif
         case GNASH_FILETYPE_JPEG:
diff --git a/libbase/GnashImageGif.cpp b/libbase/GnashImageGif.cpp
index 1b85579..8e8c913 100644
--- a/libbase/GnashImageGif.cpp
+++ b/libbase/GnashImageGif.cpp
@@ -28,12 +28,12 @@ extern "C" {
 #include <gif_lib.h>
 }
 
+#include "GnashImage.h"
 #include "utility.h"
 #include "log.h"
 #include "GnashException.h"
 #include "IOChannel.h"
 
-
 namespace gnash {
 namespace image {
 
@@ -48,7 +48,67 @@ readData(GifFileType* ft, GifByteType* data, int length)
     return in->read(reinterpret_cast<char*>(data), length);
 }
 
-}
+class GifInput : public Input
+{
+
+public:
+
+    /// Construct a GifInput object to read from an IOChannel.
+    //
+    /// @param in   The stream to read GIF data from. Ownership is shared
+    ///             between caller and GifInput, so it is freed
+    ///             automatically when the last owner is destroyed.
+    GifInput(boost::shared_ptr<IOChannel> in);
+    
+    ~GifInput();
+
+    /// Begin processing the image data.
+    void read();
+
+    /// Get the image's height in pixels.
+    //
+    /// @return     The height of the image in pixels.
+    size_t getHeight() const;
+
+    /// Get the image's width in pixels.
+    //
+    /// @return     The width of the image in pixels.
+    size_t getWidth() const;
+
+    /// Get number of components (channels)
+    //
+    /// @return     The number of components, e.g. 3 for RGB
+    size_t getComponents() const { return 3; }
+
+    /// Read a scanline's worth of image data into the given buffer.
+    //
+    /// The amount of data read is getWidth() * getComponents().
+    ///
+    /// @param rgbData  The buffer for writing raw RGB data to.
+    void readScanline(unsigned char* rgb_data);
+
+private:
+    
+    /// Initialize gif_lib
+    void init();
+
+    /// Process a single image record
+    //
+    /// @return     false if no image was parsed, true if we have an image.
+    bool processRecord(GifRecordType record);
+
+    // State needed for input.
+    GifFileType* _gif;
+    
+    // A counter for keeping track of the last row copied.
+    size_t _currentRow;
+    
+    typedef boost::scoped_array<GifPixelType> PixelRow;
+
+    // A 2-dimensional scoped array holding the unpacked pixel data.
+    boost::scoped_array<PixelRow> _gifData;
+};
+
 
 GifInput::GifInput(boost::shared_ptr<IOChannel> in)
     :
@@ -232,6 +292,16 @@ GifInput::read()
 
 }
 
+} // unnamed namespace
+
+std::auto_ptr<Input>
+createGifInput(boost::shared_ptr<IOChannel> in)
+{
+    std::auto_ptr<Input> ret(new GifInput(in));
+    ret->read();
+    return ret;
+}
+
 } // namespace image
 } // namespace gnash
 
diff --git a/libbase/GnashImageGif.h b/libbase/GnashImageGif.h
index 982478d..a8cc37c 100644
--- a/libbase/GnashImageGif.h
+++ b/libbase/GnashImageGif.h
@@ -22,96 +22,24 @@
 #define GNASH_IMAGE_GIF_H
 
 #include <memory>
-
-#include "dsodefs.h"
-#include "GnashImage.h"
-#include <boost/scoped_array.hpp>
 #include <boost/shared_ptr.hpp>
 
-extern "C" {
-#include <gif_lib.h>
-}
-
 // Forward declarations
-namespace gnash { class IOChannel; }
-
 namespace gnash {
-namespace image {
-
-class GifInput : public Input
-{
-
-public:
-
-    /// Construct a GifInput object to read from an IOChannel.
-    //
-    /// @param in   The stream to read GIF data from. Ownership is shared
-    ///             between caller and GifInput, so it is freed
-    ///             automatically when the last owner is destroyed.
-    GifInput(boost::shared_ptr<IOChannel> in);
-    
-    ~GifInput();
-
-    /// Begin processing the image data.
-    void read();
-
-    /// Get the image's height in pixels.
-    //
-    /// @return     The height of the image in pixels.
-    size_t getHeight() const;
-
-    /// Get the image's width in pixels.
-    //
-    /// @return     The width of the image in pixels.
-    size_t getWidth() const;
-
-    /// Get number of components (channels)
-    //
-    /// @return     The number of components, e.g. 3 for RGB
-    size_t getComponents() const { return 3; }
-
-    /// Read a scanline's worth of image data into the given buffer.
-    //
-    /// The amount of data read is getWidth() * getComponents().
-    ///
-    /// @param rgbData  The buffer for writing raw RGB data to.
-    void readScanline(unsigned char* rgb_data);
-
-    /// Create a GifInput and transfer ownership to the caller.
-    //
-    /// @param in   The IOChannel to read GIF data from.
-    DSOEXPORT static std::auto_ptr<Input> create(
-            boost::shared_ptr<IOChannel> in)
-    {
-        std::auto_ptr<Input> ret(new GifInput(in));
-        if (ret.get()) ret->read();
-        return ret;
+    class IOChannel;
+    namespace image {
+        class Input;
+        class Output;
     }
+}
 
-private:
-    
-    /// Initialize gif_lib
-    void init();
-
-    /// Process a single image record
-    //
-    /// @return     false if no image was parsed, true if we have an image.
-    bool processRecord(GifRecordType record);
-
-    // State needed for input.
-    GifFileType* _gif;
-    
-    // A counter for keeping track of the last row copied.
-    size_t _currentRow;
-    
-    typedef boost::scoped_array<GifPixelType> PixelRow;
-
-    // A 2-dimensional scoped array holding the unpacked pixel data.
-    boost::scoped_array<PixelRow> _gifData;
-
-
+namespace gnash {
+namespace image {
 
-};
+/// Create a GifInput and transfer ownership to the caller.
+//
+/// @param in   The IOChannel to read GIF data from.
+std::auto_ptr<Input> createGifInput(boost::shared_ptr<IOChannel> in);
 
 } // namespace image
 } // namespace gnash

http://git.savannah.gnu.org/cgit//commit/?id=85aa9fb011fce132de5722e5c2ad89b245a8a15a


commit 85aa9fb011fce132de5722e5c2ad89b245a8a15a
Author: Benjamin Wolsey <address@hidden>
Date:   Mon Jan 24 12:53:02 2011 +0100

    Hide implementation.

diff --git a/libbase/GnashImage.cpp b/libbase/GnashImage.cpp
index 97d65c6..edd82d9 100644
--- a/libbase/GnashImage.cpp
+++ b/libbase/GnashImage.cpp
@@ -169,7 +169,7 @@ Output::writeImageData(FileType type,
     switch (type) {
 #ifdef USE_PNG
         case GNASH_FILETYPE_PNG:
-            outChannel = PngOutput::create(out, width, height, quality);
+            outChannel = createPngOutput(out, width, height, quality);
             break;
 #endif
         case GNASH_FILETYPE_JPEG:
@@ -203,7 +203,7 @@ Input::readImageData(boost::shared_ptr<IOChannel> in, 
FileType type)
     switch (type) {
 #ifdef USE_PNG
         case GNASH_FILETYPE_PNG:
-            inChannel = PngInput::create(in);
+            inChannel = createPngInput(in);
             break;
 #endif
 #ifdef USE_GIF                
diff --git a/libbase/GnashImagePng.cpp b/libbase/GnashImagePng.cpp
index 8a57106..16ded78 100644
--- a/libbase/GnashImagePng.cpp
+++ b/libbase/GnashImagePng.cpp
@@ -18,16 +18,27 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-#include "utility.h"
+#ifdef HAVE_CONFIG_H
+# include "gnashconfig.h"
+#endif
+
 #include "GnashImagePng.h"
-#include "log.h"
-#include "GnashException.h"
-#include "IOChannel.h"
 
 #include <sstream>
-#include <cstring> // std::memcpy
 #include <boost/scoped_array.hpp>
 
+extern "C" {
+#ifdef HAVE_PNG_H
+# include <png.h>
+#endif
+}
+
+#include "GnashImage.h"
+#include "utility.h"
+#include "log.h"
+#include "GnashException.h"
+#include "IOChannel.h"
+
 namespace gnash {
 namespace image {
 
@@ -70,19 +81,99 @@ flushData(png_structp /*pngptr*/)
 {
 }
 
-} // unnamed namespace
+class PngInput : public Input
+{
 
-PngInput::PngInput(boost::shared_ptr<IOChannel> in)
-    :
-    Input(in),
-    _pngPtr(0),
-    _infoPtr(0),
-    _rowPtrs(0),
-    _pixelData(0),
-    _currentRow(0)
+public:
+
+    /// Construct a PngInput object to read from an IOChannel.
+    //
+    /// @param in   The stream to read PNG data from. Ownership is shared
+    ///             between caller and JpegInput, so it is freed
+    ///             automatically when the last owner is destroyed.
+    PngInput(boost::shared_ptr<IOChannel> in)
+        :
+        Input(in),
+        _pngPtr(0),
+        _infoPtr(0),
+        _rowPtrs(0),
+        _pixelData(0),
+        _currentRow(0)
+    {
+        init();
+    }
+    
+    ~PngInput();
+    
+    /// Begin processing the image data.
+    void read();
+
+    /// Get the image's height in pixels.
+    //
+    /// @return     The height of the image in pixels.
+    size_t getHeight() const;
+
+    /// Get the image's width in pixels.
+    //
+    /// @return     The width of the image in pixels.
+    size_t getWidth() const;
+
+    /// Read a scanline's worth of image data into the given buffer.
+    //
+    /// The amount of data read is getWidth() * getComponents().
+    ///
+    /// @param rgbData  The buffer for writing raw RGB data to.
+    void readScanline(unsigned char* imageData);
+
+private:
+
+    // State needed for input.
+    png_structp _pngPtr;
+    png_infop _infoPtr;
+    boost::scoped_array<png_bytep> _rowPtrs;
+    boost::scoped_array<png_byte> _pixelData;
+   
+    // A counter for keeping track of the last row copied.
+    size_t _currentRow;
+
+    void init();
+
+    // Return number of components (i.e. == 3 for RGB
+    // data).
+    size_t getComponents() const;
+
+};
+
+// Class object for writing PNG image data.
+class PngOutput : public Output
 {
-    init();
-}
+
+public:
+
+    /// Create an output object bound to a gnash::IOChannel
+    //
+    /// @param out      The IOChannel used for output. Must be kept alive
+    ///                 throughout
+    /// @param quality Unused in PNG output
+    PngOutput(boost::shared_ptr<IOChannel> out, size_t width,
+            size_t height, int quality);
+    
+    ~PngOutput();
+
+    void writeImageRGB(const unsigned char* rgbData);
+    
+    void writeImageRGBA(const unsigned char* rgbaData);
+    
+private:
+
+    /// Initialize libpng.
+    void init();
+
+    /// Libpng structures for image and output state.
+    png_structp _pngPtr;
+    png_infop _infoPtr;
+    
+};
 
 PngInput::~PngInput()
 {
@@ -309,9 +400,18 @@ PngOutput::writeImageRGB(const unsigned char* rgbData)
     png_write_png(_pngPtr, _infoPtr, PNG_TRANSFORM_IDENTITY, NULL);
 }
 
+} // unnamed namespace
+
+std::auto_ptr<Input>
+createPngInput(boost::shared_ptr<IOChannel> in)
+{
+    std::auto_ptr<Input> ret(new PngInput(in));
+    ret->read();
+    return ret;
+}
 
 std::auto_ptr<Output>
-PngOutput::create(boost::shared_ptr<IOChannel> o, size_t width,
+createPngOutput(boost::shared_ptr<IOChannel> o, size_t width,
                        size_t height, int quality)
 {
     std::auto_ptr<Output> outChannel(new PngOutput(o, width, height, quality));
diff --git a/libbase/GnashImagePng.h b/libbase/GnashImagePng.h
index 375a6f0..61910d6 100644
--- a/libbase/GnashImagePng.h
+++ b/libbase/GnashImagePng.h
@@ -22,125 +22,27 @@
 #define GNASH_IMAGE_PNG_H
 
 #include <memory>
-
-#include "dsodefs.h"
-#include "GnashImage.h"
-#include <boost/scoped_array.hpp>
-
-
-extern "C" {
-#ifdef HAVE_PNG_H
-#include <png.h>
-#else
-#warning "This system doesn't have png.h installed!"
-#endif
-}
+#include <boost/shared_ptr.hpp>
 
 // Forward declarations
 namespace gnash {
     class IOChannel;
+    namespace image {
+        class Input;
+        class Output;
+    }
 }
 
 namespace gnash {
 namespace image {
 
-class PngInput : public Input
-{
-
-public:
-
-    /// Construct a PngInput object to read from an IOChannel.
-    //
-    /// @param in   The stream to read PNG data from. Ownership is shared
-    ///             between caller and JpegInput, so it is freed
-    ///             automatically when the last owner is destroyed.
-    PngInput(boost::shared_ptr<IOChannel> in);
-    
-    ~PngInput();
-    
-    /// Begin processing the image data.
-    void read();
-
-    /// Get the image's height in pixels.
-    //
-    /// @return     The height of the image in pixels.
-    size_t getHeight() const;
-
-    /// Get the image's width in pixels.
-    //
-    /// @return     The width of the image in pixels.
-    size_t getWidth() const;
-
-    /// Read a scanline's worth of image data into the given buffer.
-    //
-    /// The amount of data read is getWidth() * getComponents().
-    ///
-    /// @param rgbData  The buffer for writing raw RGB data to.
-    void readScanline(unsigned char* imageData);
-
-    /// Create a PngInput and transfer ownership to the caller.
-    //
-    /// @param in   The IOChannel to read PNG data from.
-    DSOEXPORT static std::auto_ptr<Input> create(
-            boost::shared_ptr<IOChannel> in)
-    {
-        std::auto_ptr<Input> ret ( new PngInput(in) );
-        if (ret.get()) ret->read();
-        return ret;
-    }
-
-private:
-
-    // State needed for input.
-    png_structp _pngPtr;
-    png_infop _infoPtr;
-    boost::scoped_array<png_bytep> _rowPtrs;
-    boost::scoped_array<png_byte> _pixelData;
-   
-    // A counter for keeping track of the last row copied.
-    size_t _currentRow;
-
-    void init();
-
-    // Return number of components (i.e. == 3 for RGB
-    // data).
-    size_t getComponents() const;
-
-};
-
-// Class object for writing PNG image data.
-class PngOutput : public Output
-{
-
-public:
-
-    /// Create an output object bound to a gnash::IOChannel
-    //
-    /// @param out      The IOChannel used for output. Must be kept alive
-    ///                 throughout
-    /// @param quality Unused in PNG output
-    PngOutput(boost::shared_ptr<IOChannel> out, size_t width,
-            size_t height, int quality);
-    
-    ~PngOutput();
-
-    void writeImageRGB(const unsigned char* rgbData);
-    
-    void writeImageRGBA(const unsigned char* rgbaData);
-
-    static std::auto_ptr<Output> create(boost::shared_ptr<IOChannel> out,
-            size_t width, size_t height, int quality);
-    
-private:
-
-    /// Initialize libpng.
-    void init();
+/// Create a PngInput and transfer ownership to the caller.
+//
+/// @param in   The IOChannel to read PNG data from.
+std::auto_ptr<Input> createPngInput(boost::shared_ptr<IOChannel> in);
 
-    /// Libpng structures for image and output state.
-    png_structp _pngPtr;
-    png_infop _infoPtr;
-    
-};
+std::auto_ptr<Output> createPngOutput(boost::shared_ptr<IOChannel> out,
+        size_t width, size_t height, int quality);
 
 } // namespace image
 } // namespace gnash

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

Summary of changes:
 libbase/GnashImage.cpp    |    6 +-
 libbase/GnashImageGif.cpp |   74 ++++++++++++++++++++++++-
 libbase/GnashImageGif.h   |   94 ++++----------------------------
 libbase/GnashImagePng.cpp |  134 +++++++++++++++++++++++++++++++++++++++------
 libbase/GnashImagePng.h   |  120 ++++------------------------------------
 5 files changed, 214 insertions(+), 214 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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