gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/cxform.cpp server/swf/St...


From: Zou Lunkai
Subject: [Gnash-commit] gnash ChangeLog server/cxform.cpp server/swf/St...
Date: Mon, 19 May 2008 07:15:49 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Zou Lunkai <zoulunkai>  08/05/19 07:15:49

Modified files:
        .              : ChangeLog 
        server         : cxform.cpp 
        server/swf     : StartSoundTag.cpp 

Log message:
        * server/cxform.cpp, server/swf/StartSoundTag.cpp: more read_bit() 
reduction.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6639&r2=1.6640
http://cvs.savannah.gnu.org/viewcvs/gnash/server/cxform.cpp?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/StartSoundTag.cpp?cvsroot=gnash&r1=1.11&r2=1.12

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6639
retrieving revision 1.6640
diff -u -b -r1.6639 -r1.6640
--- ChangeLog   18 May 2008 20:36:10 -0000      1.6639
+++ ChangeLog   19 May 2008 07:15:47 -0000      1.6640
@@ -1,3 +1,7 @@
+2008-05-18 Zou Lunkai <address@hidden>
+       
+       * server/cxform.cpp, server/swf/StartSoundTag.cpp: more read_bit() 
reduction.
+       
 2008-05-18 Benjamin Wolsey <address@hidden>
 
        * libbase/utility.h: move general mathematical functions under

Index: server/cxform.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/cxform.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- server/cxform.cpp   18 May 2008 20:36:11 -0000      1.13
+++ server/cxform.cpp   19 May 2008 07:15:49 -0000      1.14
@@ -19,7 +19,7 @@
 //
 
 #ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
+    #include "gnashconfig.h"
 #endif
 
 #include "cxform.h"
@@ -92,6 +92,7 @@
        int      nbits = field & 0x0f;
 
        int reads = has_mult + has_add; // 0, 1 or 2
+    assert(reads <= 2);
        if ( reads ) {
         in.ensureBits(nbits*reads*3);
     }
@@ -124,12 +125,19 @@
        in.align();
 
        in.ensureBits(6);
-       bool    has_add = in.read_bit();
-       bool    has_mult = in.read_bit();
-       int     nbits = in.read_uint(4);
+    int  field =  in.read_uint(6);
+    bool has_add  =  field & (1 << 5);
+    bool has_mult =  field & (1 << 4);
+    int  nbits = field & 0x0f;
 
        int reads = has_mult + has_add; // 0, 1 or 2
-       if ( reads ) in.ensureBits(nbits*reads*4);
+    assert(reads <= 2);
+    if ( reads ) {
+        in.ensureBits(nbits*reads*4);
+    }
+    else {
+        return;
+    }
 
        if (has_mult) {
                m_[0][0] = in.read_sint(nbits) / 256.0f;
@@ -198,8 +206,10 @@
 {         
   for (int a=0; a<4; a++)
    for (int b=0; b<2; b++)
+        {
     if (m_[a][b] != identity.m_[a][b])
      return false;
+        }
   
   return true;
 }
@@ -207,7 +217,7 @@
 bool   cxform::is_invisible() const
 // Returns true when the cxform leads to alpha == 0
 {
-       return (255.0 * m_[3][0] + m_[3][1]) <= 0.0;    
+    return(255.0 * m_[3][0] + m_[3][1]) <= 0.0;    
 }
 
 

Index: server/swf/StartSoundTag.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/StartSoundTag.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/swf/StartSoundTag.cpp        30 Apr 2008 10:09:45 -0000      1.11
+++ server/swf/StartSoundTag.cpp        19 May 2008 07:15:49 -0000      1.12
@@ -19,7 +19,7 @@
 
 
 #ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
+    #include "gnashconfig.h"
 #endif
 
 #include "StartSoundTag.h"
@@ -50,12 +50,10 @@
                IF_VERBOSE_MALFORMED_SWF(
                // if there's no sound_handler we might have simply skipped
                // the definition of sound sample...
-               if (handler)
-               {
+            if (handler) {
                        log_swferror(_("start_sound_loader: sound_id %d is not 
defined"), sound_id);
                }
                );
-
                return;
        }
 
@@ -80,13 +78,14 @@
        in.align();
        in.ensureBytes(1); // header
 
-       in.read_uint(2);        // skip reserved bits.
-       m_stop_playback = in.read_bit(); 
-       bool    no_multiple = in.read_bit(); 
-       bool    has_envelope = in.read_bit();
-       bool    has_loops = in.read_bit(); 
-       bool    has_out_point = in.read_bit(); 
-       bool    has_in_point = in.read_bit(); 
+    int flags = in.read_u8();
+    // first two bits are reserved.
+    m_stop_playback     = flags & (1 << 5); 
+    bool  no_multiple   = flags & (1 << 4); 
+    bool  has_envelope  = flags & (1 << 3); 
+    bool  has_loops     = flags & (1 << 2); 
+    bool  has_out_point = flags & (1 << 1); 
+    bool  has_in_point  = flags & (1 << 0); 
 
        if (no_multiple)
        {
@@ -98,9 +97,18 @@
 
        in.ensureBytes(has_in_point*4 + has_out_point*4 + has_loops*2);
 
-       if (has_in_point) { in_point = in.read_u32(); }
-       if (has_out_point) { out_point = in.read_u32(); }
-       if (has_loops) { m_loop_count = in.read_u16(); }
+    if (has_in_point)
+    {
+        in_point = in.read_u32();
+    }
+    if (has_out_point)
+    {
+        out_point = in.read_u32();
+    }
+    if (has_loops)
+    {
+        m_loop_count = in.read_u16();
+    }
 
        if (has_envelope)
        {
@@ -119,15 +127,14 @@
 
 }
 
-
 void
 StartSoundTag::execute(sprite_instance* /* m */, DisplayList& /* dlist */) 
const
 {
+    //GNASH_REPORT_FUNCTION;
+
        // Make static ?
        media::sound_handler* handler = get_sound_handler();
 
-       //GNASH_REPORT_FUNCTION;
-
        if (handler)
        {
                if (m_stop_playback)
@@ -143,6 +150,7 @@
        }
 }
 
+
 } // namespace gnash::SWF
 } // namespace gnash
 




reply via email to

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