gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash server/impl.cpp libbase/image.cpp libbase...


From: Michael Carlson
Subject: [Gnash-commit] gnash server/impl.cpp libbase/image.cpp libbase...
Date: Wed, 15 Feb 2006 03:07:22 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Branch:         
Changes by:     Michael Carlson <address@hidden>        06/02/15 03:07:22

Modified files:
        server         : impl.cpp 
        libbase        : image.cpp image.h jpeg.cpp 
        .              : ChangeLog 

Log message:
        Add read_swf_jpeg2_version6 to image.h/cpp
        Undo previous patch (to jpeg.cpp) - solution doesn't work for all 
versions
        Call read_swf_jpeg2_version6 when flash file is version 6 or lower

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/impl.cpp.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/libbase/image.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/libbase/image.h.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/libbase/jpeg.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/ChangeLog.diff?tr1=1.140&tr2=1.141&r1=text&r2=text

Patches:
Index: gnash/ChangeLog
diff -u gnash/ChangeLog:1.140 gnash/ChangeLog:1.141
--- gnash/ChangeLog:1.140       Tue Feb 14 18:00:53 2006
+++ gnash/ChangeLog     Wed Feb 15 03:07:22 2006
@@ -1,3 +1,13 @@
+2006-02-15 Michael Carlson <address@hidden>
+
+       * server/impl.cpp: use read_swf_jpeg2_version6() when flash file
+       version <= 6
+       * libbase/jpeg.cpp: undo previous patch - only worked for some
+       flash file versions
+       * libbase/image.h: Add read_swf_jpeg2_version6()
+       * libbase/image.cpp: Fix jpeg2 loading code to work on flash
+       file versions <=6 and >=7 (implement read_swf_jpeg2_version6)
+
 2006-02-14  Rob Savoye  <address@hidden>
 
        * configure.ac: Look for shm_open().
Index: gnash/libbase/image.cpp
diff -u gnash/libbase/image.cpp:1.2 gnash/libbase/image.cpp:1.3
--- gnash/libbase/image.cpp:1.2 Fri Feb  3 21:31:32 2006
+++ gnash/libbase/image.cpp     Wed Feb 15 03:07:22 2006
@@ -280,22 +280,29 @@
 
                return im;
        }
-
-
+
        rgb*    read_swf_jpeg2(tu_file* in)
        // Create and read a new image from the stream.  Image is in
        // SWF JPEG2-style format (the encoding tables come first in a
        // separate "stream" -- otherwise it's just normal JPEG).  The
        // IJG documentation describes this as "abbreviated" format.
        {
-               jpeg::input*    j_in = 
jpeg::input::create_swf_jpeg2_header_only(in);
+               jpeg::input*    j_in = jpeg::input::create(in);
                if (j_in == NULL) return NULL;
-               
-               rgb*    im = read_swf_jpeg2_with_tables(j_in);
+               
+               // start_image already called by create() above
+
+               rgb*    im = image::create_rgb(j_in->get_width(), 
j_in->get_height());
+
+               for (int y = 0; y < j_in->get_height(); y++) {
+                       j_in->read_scanline(scanline(im, y));
+               }
+
+               j_in->finish_image();
 
                delete j_in;
 
-               return im;
+               return im;              
        }
 
 
@@ -318,6 +325,20 @@
                return im;
        }
 
+       rgb* read_swf_jpeg2_version6(tu_file* in)
+       // The same as read_swf_jpeg2, but this version works in flash files 
with
+       // version 6 or lower
+       {
+               jpeg::input*    j_in = 
jpeg::input::create_swf_jpeg2_header_only(in);
+               if (j_in == NULL) return NULL;
+               
+               rgb*    im = read_swf_jpeg2_with_tables(j_in);
+
+               delete j_in;
+
+               return im;
+       }
+
 
        rgba*   read_swf_jpeg3(tu_file* in)
        // For reading SWF JPEG3-style image data, like ordinary JPEG, 
Index: gnash/libbase/image.h
diff -u gnash/libbase/image.h:1.2 gnash/libbase/image.h:1.3
--- gnash/libbase/image.h:1.2   Fri Feb  3 21:31:32 2006
+++ gnash/libbase/image.h       Wed Feb 15 03:07:22 2006
@@ -108,6 +108,11 @@
        /// headers stored in the given jpeg::input object.
        rgb*    read_swf_jpeg2_with_tables(jpeg::input* loader);
 
+       // \brief
+       // For reading SWF JPEG2-style image data, version 6 flash files
+       // or lower
+       rgb* read_swf_jpeg2_version6(tu_file* in);
+
        /// \brief
        /// For reading SWF JPEG3-style image data, like ordinary JPEG, 
        /// but stores the data in rgba format.
Index: gnash/libbase/jpeg.cpp
diff -u gnash/libbase/jpeg.cpp:1.2 gnash/libbase/jpeg.cpp:1.3
--- gnash/libbase/jpeg.cpp:1.2  Tue Feb 14 16:26:17 2006
+++ gnash/libbase/jpeg.cpp      Wed Feb 15 03:07:22 2006
@@ -284,8 +284,7 @@
                struct jpeg_decompress_struct   m_cinfo;
                struct jpeg_error_mgr   m_jerr;
 
-               bool    m_compressor_opened;
-               bool    m_header_read;
+               bool    m_compressor_opened;
 
 
                enum SWF_DEFINE_BITS_JPEG2 { SWF_JPEG2 };
@@ -303,9 +302,7 @@
                        // Initialize decompression object.
                        jpeg_create_decompress(&m_cinfo);
 
-                       setup_rw_source(&m_cinfo, in);
-
-                       m_header_read = FALSE;
+                       setup_rw_source(&m_cinfo, in);
 
                        start_image();
                }
@@ -331,7 +328,6 @@
 
                        // Read the encoding tables.
                        jpeg_read_header(&m_cinfo, FALSE);
-                       m_header_read = TRUE;
 
                        // Don't start reading any image data!
                        // App does that manually using start_image.
@@ -375,10 +371,8 @@
                {
                        assert(m_compressor_opened == false);
 
-                       // Now, read the image header.
-                       if (!m_header_read)
-                               jpeg_read_header(&m_cinfo, TRUE);
-                       m_header_read = TRUE;
+                       // Now, read the image header.
+                       jpeg_read_header(&m_cinfo, TRUE);
 
                        jpeg_start_decompress(&m_cinfo);
                        m_compressor_opened = true;
Index: gnash/server/impl.cpp
diff -u gnash/server/impl.cpp:1.16 gnash/server/impl.cpp:1.17
--- gnash/server/impl.cpp:1.16  Sun Feb 12 02:12:07 2006
+++ gnash/server/impl.cpp       Wed Feb 15 03:07:22 2006
@@ -932,7 +932,11 @@
     if (m->get_create_bitmaps() == DO_LOAD_BITMAPS)
        {
 #if TU_CONFIG_LINK_TO_JPEGLIB
-           image::rgb* im = image::read_swf_jpeg2(in->get_underlying_stream());
+               image::rgb* im;
+               if (m->get_version() <= 6)
+                       im = 
image::read_swf_jpeg2_version6(in->get_underlying_stream());
+               else
+                   im = image::read_swf_jpeg2(in->get_underlying_stream());
            bi = render::create_bitmap_info_rgb(im);
            delete im;
 #else




reply via email to

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