gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9523: Minor cleanups.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9523: Minor cleanups.
Date: Wed, 23 Jul 2008 10:22:20 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9523
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Wed 2008-07-23 10:22:20 +0200
message:
  Minor cleanups.
modified:
  gui/gtk_glue_agg.cpp
  gui/gtk_glue_agg.h
    ------------------------------------------------------------
    revno: 9516.1.11
    committer: Benjamin Wolsey <address@hidden>
    branch nick: workingcopy
    timestamp: Wed 2008-07-23 10:16:16 +0200
    message:
      Drop unneeded <memory> include. Use references instead of pointers for
      decodeMask. Don't define or declare it unless ENABLE_MIT_SHM is defined.
      
      No need to memset buffer on resize as the renderer has to redraw it all
      anyway. Drop unneeded <cstring> include.
    modified:
      gui/gtk_glue_agg.cpp
      gui/gtk_glue_agg.h
=== modified file 'gui/gtk_glue_agg.cpp'
--- a/gui/gtk_glue_agg.cpp      2008-07-22 08:00:17 +0000
+++ b/gui/gtk_glue_agg.cpp      2008-07-23 08:16:16 +0000
@@ -43,7 +43,6 @@
 // Also worth checking: http://en.wikipedia.org/wiki/X_video_extension
 
 #include <cerrno>
-#include <cstring> // std::memset
 #include <exception>
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
@@ -293,9 +292,9 @@
     unsigned int green_shift, green_prec;
     unsigned int blue_shift, blue_prec;
 
-    decode_mask(_shm_image->red_mask,   &red_shift,   &red_prec);
-    decode_mask(_shm_image->green_mask, &green_shift, &green_prec);
-    decode_mask(_shm_image->blue_mask,  &blue_shift,  &blue_prec);
+    decodeMask(_shm_image->red_mask, red_shift, red_prec);
+    decodeMask(_shm_image->green_mask, green_shift, green_prec);
+    decodeMask(_shm_image->blue_mask, blue_shift, blue_prec);
 
   
     log_debug("X server pixel format is (R%d:%d, G%d:%d, B%d:%d, %d bpp)",
@@ -363,7 +362,7 @@
     assert(height > 0);
     assert(_agg_renderer != NULL);
 
-    const size_t CHUNK_SIZE = 100 * 100 * (_bpp / 8);
+    static const size_t chunkSize = 100 * 100 * (_bpp / 8);
     
     if (width == _width && height == _height) return;
        
@@ -399,7 +398,7 @@
         // Reallocate the buffer when it shrinks or grows.
         if (newBufferSize != _offscreenbuf_size) {
 
-            newBufferSize = (newBufferSize / CHUNK_SIZE + 1) * CHUNK_SIZE;
+            newBufferSize = (newBufferSize / chunkSize + 1) * chunkSize;
 
             try {
                   _offscreenbuf.reset(new unsigned char[newBufferSize]);
@@ -416,7 +415,7 @@
             }
       
             _offscreenbuf_size = newBufferSize;
-            std::memset(_offscreenbuf.get(), 0, _offscreenbuf_size);
+
         }
       
         // Only the AGG renderer has the function init_buffer, which is *not* 
part of
@@ -553,25 +552,26 @@
     }
 }
 
-
+#ifdef ENABLE_MIT_SHM
 void 
-GtkAggGlue::decode_mask(unsigned long mask, unsigned int *shift, unsigned int 
*size)
+GtkAggGlue::decodeMask(unsigned long mask, unsigned int& shift, unsigned int& 
size)
 {
-    *shift = 0;
-    *size = 0;
+    shift = 0;
+    size = 0;
 
-    if (mask==0) return; // invalid mask
+    if (mask == 0) return; // invalid mask
 
     while (!(mask & 1)) {
-        (*shift)++;
+        ++shift;
         mask = mask >> 1;
     }
 
     while (mask & 1) {
-        (*size)++;
+        ++size;
         mask = mask >> 1;
     }
 }
+#endif
 
 } // namespace gnash
 

=== modified file 'gui/gtk_glue_agg.h'
--- a/gui/gtk_glue_agg.h        2008-07-22 08:00:17 +0000
+++ b/gui/gtk_glue_agg.h        2008-07-23 08:16:16 +0000
@@ -24,7 +24,6 @@
 
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
-#include <memory>
 #include <boost/scoped_array.hpp>
 
 #undef ENABLE_MIT_SHM
@@ -94,16 +93,18 @@
     /// Tries to create a AGG render handler based on the X server pixel
     /// format. Returns NULL on failure.
     render_handler *create_shm_handler();    
-    
-    /// converts a bitmask to a shift/size information (used for pixel format
-    /// detection)
-    void decode_mask(unsigned long mask, unsigned int *shift, unsigned int 
*size);
-    
+        
     /// Tries to detect the pixel format used by the X server (usually RGB24).
     /// It does not have to match the hardware pixel format, just the one
     /// expected for pixmaps. This function is /not/ used for MIT-SHM!
     bool detect_pixelformat();
-    
+
+#ifdef ENABLE_MIT_SHM
+    /// converts a bitmask to a shift/size information (used for pixel format
+    /// detection)
+    static void decodeMask(unsigned long mask, unsigned int& shift, unsigned 
int& size);
+#endif
+
 };
 
 } // namespace gnash


reply via email to

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