Revision: 7232
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7232&view=rev
Author:   thjc
Date:     2009-01-04 01:34:05 +0000 (Sun, 04 Jan 2009)

Log Message:
-----------
applied patch 2475933 - Allow graphics2d with gui disabled

Modified Paths:
--------------
    code/stage/branches/release-2-1-patches/src/p_driver.cc
    code/stage/branches/release-2-1-patches/src/p_graphics2d.cc

Modified: code/stage/branches/release-2-1-patches/src/p_driver.cc
===================================================================
--- code/stage/branches/release-2-1-patches/src/p_driver.cc     2009-01-04 
01:01:31 UTC (rev 7231)
+++ code/stage/branches/release-2-1-patches/src/p_driver.cc     2009-01-04 
01:34:05 UTC (rev 7232)
@@ -383,16 +383,8 @@
          break;          
          
        case PLAYER_GRAPHICS2D_CODE:
-          if(_stg_disable_gui)
-          {
-            PLAYER_WARN("Stage graphics2d interface disabled when not running 
GUI");
-            continue;
-          }
-          else
-          {
-            ifsrc = new InterfaceGraphics2d( player_addr,  this, cf, section );
-            break;       
-          }
+      ifsrc = new InterfaceGraphics2d( player_addr,  this, cf, section );
+      break;
 
        case PLAYER_GRIPPER_CODE:
          ifsrc = new InterfaceGripper( player_addr,  this, cf, section );

Modified: code/stage/branches/release-2-1-patches/src/p_graphics2d.cc
===================================================================
--- code/stage/branches/release-2-1-patches/src/p_graphics2d.cc 2009-01-04 
01:01:31 UTC (rev 7231)
+++ code/stage/branches/release-2-1-patches/src/p_graphics2d.cc 2009-01-04 
01:34:05 UTC (rev 7232)
@@ -41,6 +41,8 @@
 - PLAYER_GRAPHICS2D_CMD_POLYGON
 */
 
+extern int _stg_disable_gui;
+
 static unsigned int rgb32_pack( player_color_t *pcol )
 {
   unsigned int col=0;
@@ -89,7 +91,8 @@
                            PLAYER_GRAPHICS2D_CMD_CLEAR, 
                            this->addr))
     {
-      stg_rtk_fig_clear( this->figs[index].stageFig );
+         if (!_stg_disable_gui)
+                 stg_rtk_fig_clear( this->figs[index].stageFig );
       return 0; //ok
     }
   
@@ -97,6 +100,9 @@
                            PLAYER_GRAPHICS2D_CMD_POINTS, 
                            this->addr))
     {
+         if (_stg_disable_gui)
+                 return 0; // Can't draw on nothing
+         
       player_graphics2d_cmd_points_t* pcmd = 
        (player_graphics2d_cmd_points_t*)data;
       
@@ -116,6 +122,9 @@
                            PLAYER_GRAPHICS2D_CMD_POLYLINE, 
                            this->addr))
     {
+         if (_stg_disable_gui)
+                 return 0; // Can't draw on nothing
+         
       player_graphics2d_cmd_polyline_t* pcmd = 
        (player_graphics2d_cmd_polyline_t*)data;
       
@@ -144,6 +153,9 @@
                            PLAYER_GRAPHICS2D_CMD_POLYGON, 
                            this->addr))
     {
+         if (_stg_disable_gui)
+                 return 0; // Can't draw on nothing
+         
       player_graphics2d_cmd_polygon_t* pcmd = 
        (player_graphics2d_cmd_polygon_t*)data;
       
@@ -217,9 +229,12 @@
        char figname[10];
        snprintf(figname, 10, "g2d_fig%d", index); // Name the figures g2d_fig0 
through g2d_fign.
        
-       // Get or create a nice clean figure for the client to draw on.
-       figs[index].stageFig = stg_model_fig_get_or_create( mod, figname, 
"top", 99 );
-       stg_rtk_fig_clear( figs[index].stageFig );
+       if (!_stg_disable_gui) // Check there is a gui
+       {
+               // Get or create a nice clean figure for the client to draw on.
+               figs[index].stageFig = stg_model_fig_get_or_create( mod, 
figname, "top", 99 );
+               stg_rtk_fig_clear( figs[index].stageFig );
+       }
        
        return 0;
 }
@@ -242,8 +257,11 @@
                return -1;
        }
        
-       stg_rtk_fig_clear( figs[index].stageFig );
-       figs[index].queue = QueuePointer(); // Set to NULL.
+       if (!_stg_disable_gui) // Check there is a gui
+       {
+               stg_rtk_fig_clear( figs[index].stageFig );
+               figs[index].queue = QueuePointer(); // Set to NULL.
+       }
        
        return InterfaceModel::Unsubscribe(queue, addr);
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to