gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog gui/gtk_glue_agg.h gui/gtk_glue...


From: Udo Giacomozzi
Subject: [Gnash-commit] gnash ChangeLog gui/gtk_glue_agg.h gui/gtk_glue...
Date: Wed, 01 Aug 2007 12:06:30 +0000

CVSROOT:        /cvsroot/gnash
Module name:    gnash
Changes by:     Udo Giacomozzi <udog>   07/08/01 12:06:30

Modified files:
        .              : ChangeLog 
        gui            : gtk_glue_agg.h gtk_glue_agg.cpp 

Log message:
        gui/gtk_glue_agg.{cpp,h}: stubbed pixel format detection. Will break 
OLPC support but fix bug #20649 for all others.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3894&r2=1.3895
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk_glue_agg.h?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk_glue_agg.cpp?cvsroot=gnash&r1=1.23&r2=1.24

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnash/gnash/ChangeLog,v
retrieving revision 1.3894
retrieving revision 1.3895
diff -u -b -r1.3894 -r1.3895
--- ChangeLog   1 Aug 2007 10:09:22 -0000       1.3894
+++ ChangeLog   1 Aug 2007 12:06:30 -0000       1.3895
@@ -1,3 +1,8 @@
+2007-08-01 Udo Giacomozzi <address@hidden>
+
+       * gui/gtk_glue_agg.{cpp,h}: stubbed pixel format detection. Will
+         break OLPC support but fix bug #20649 for all others.
+
 2007-08-01 Tomas Groth Christensen <address@hidden>
 
        * backend/sound_handler_gst.{h,cpp}: Switch to try_mutex, and in 

Index: gui/gtk_glue_agg.h
===================================================================
RCS file: /cvsroot/gnash/gnash/gui/gtk_glue_agg.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- gui/gtk_glue_agg.h  31 Jul 2007 16:43:47 -0000      1.13
+++ gui/gtk_glue_agg.h  1 Aug 2007 12:06:30 -0000       1.14
@@ -56,6 +56,7 @@
     int _offscreenbuf_size;
     render_handler *_agg_renderer;
     int _width, _height, _bpp;
+    char _pixelformat[16];
     bool _have_shm;
 #ifdef ENABLE_MIT_SHM
     XImage *_shm_image;
@@ -80,10 +81,15 @@
     /// format. Returns NULL on failure.
     render_handler *create_shm_handler();    
     
-    // converts a bitmask to a shift/size information (used for pixel format
-    // detection)
+    /// 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();
+    
 };
 
 } // namespace gnash

Index: gui/gtk_glue_agg.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/gui/gtk_glue_agg.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- gui/gtk_glue_agg.cpp        2 Jul 2007 08:13:27 -0000       1.23
+++ gui/gtk_glue_agg.cpp        1 Aug 2007 12:06:30 -0000       1.24
@@ -18,7 +18,7 @@
 //
 //
 
-/* $Id: gtk_glue_agg.cpp,v 1.23 2007/07/02 08:13:27 udog Exp $ */
+/* $Id: gtk_glue_agg.cpp,v 1.24 2007/08/01 12:06:30 udog Exp $ */
 
 
 /// \page gtk_shm_support GTK shared memory extension support
@@ -103,13 +103,14 @@
     
     _have_shm = check_mit_shm(gdk_display);
     
-#ifdef PIXELFORMAT_RGB565
-    _bpp = 16;
-#else
-    // GDK's gdk_draw_rgb_image() needs 24-bit RGB data, so we initialize the
-    // AGG renderer with RGB24 and let GTK take care of the proper pixel 
format.
-    _bpp = 24;
-#endif
+    if (!detect_pixelformat()) {
+      printf("FATAL: Could not detect the pixel format used by your X 
server.\n");
+      printf("Please report this problem to the Gnash developer team.\n");
+      return false;
+    }
+    
+    log_msg("Your X server expects %s pixmap data.", _pixelformat);
+    
     return true;
 }
 
@@ -233,6 +234,25 @@
     _drawing_area = drawing_area;
 }
 
+bool 
+GtkAggGlue::detect_pixelformat() 
+{
+
+  // <UdoG>: Currently there is NO detection of the pixel format used by the 
+  // X server. I tried with gdk_visual_get_system() and gdk_visual_get_best() 
+  // but they return the /hardware/ pixel format, which is not what we want.
+  // Normally any X server will use RGB24, regardless of video hardware.
+  // Only the OLPC has a hacked(?) X server that expects RGB565 data.
+  // I dropped support for the OLPC to make GTK-AGG work for normal X servers.
+  // We need to find a detection method that works in both cases...  
+  
+  _bpp = 24;
+  strcpy(_pixelformat, "RGB24");
+  
+  return true;
+  
+}
+
 render_handler*
 GtkAggGlue::create_shm_handler()
 {
@@ -311,13 +331,7 @@
     if (_agg_renderer) return _agg_renderer;
   }
 
-#ifdef PIXELFORMAT_RGB565
-#warning A pixel format of RGB565; you must have a (hacked) GTK which supports 
\
-         this format (e.g., GTK on the OLPC).
-    _agg_renderer = create_render_handler_agg("RGB565");
-#else
-    _agg_renderer = create_render_handler_agg("RGB24");
-#endif
+  _agg_renderer = create_render_handler_agg(_pixelformat);
     return _agg_renderer;
 }
 




reply via email to

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