Changeset 867

Show
Ignore:
Timestamp:
08/01/07 17:19:11 (1 year ago)
Author:
allenb
Message:

- Add auto-scaling of the virtual panel.

Todo: Make it so the text size can be adjusted. This does not seem to be working.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/fcptr_stable_jun07/Source/System/Statistics/Foregrounds/OSGPerfMonitorForeground.cpp

    r858 r867  
    209209   if(NULL == _face) 
    210210   {  
    211       initText(getFamily(), 10); //getSize());  
     211      initText(getFamily(), 10); //getSize());        
    212212   }    
    213213 
     
    343343   Real32 panelWidth  = textBlockWidth  + chartBlockWidth  + size + (getTextMargin().x() * 2.0f); 
    344344   Real32 panelHeight = textBlockHeight +                  + size + (getTextMargin().y() * 2.0f); 
    345    // XXX: Todo, make it auto-scale to some limit based on a setting 
    346    //Real32 surfaceWidth  = panelHeight * vpAspectRatio; //vpWidth; 
    347    //Real32 surfaceHeight = panelHeight;                 //vpHeight; 
    348    Real32 surfaceWidth  = vpWidth; 
    349    Real32 surfaceHeight = vpHeight; 
     345 
     346   // Scale the size of the virtual surfaced based on what can fit 
     347   float surf_mult(1.0); 
     348   if (panelHeight > vpHeight) 
     349   { surf_mult = (panelHeight/vpHeight); } 
     350 
     351   Real32 surfaceWidth  = vpWidth  * surf_mult; 
     352   Real32 surfaceHeight = vpHeight * surf_mult; 
    350353 
    351354   // ---- SETUP THE VIRTUAL VIEWPORT ---- //    
  • branches/fcptr_stable_jun07/Source/System/Statistics/Foregrounds/testPerfMonitorForeground.cpp

    r858 r867  
    187187} 
    188188 
    189 void recursiveFunc(unsigned depth=0
     189void recursiveFunc(unsigned depth=3
    190190{ 
    191191   PerfMonitorGuard g("recursiveFunc"); 
    192192 
    193    if (depth >= 3) 
     193   //osgSleep(10); 
     194   //std::cout << "depth: " << depth << std::endl; 
     195 
     196   if (depth == 0) 
    194197   { return; } 
    195  
    196    osgSleep(10); 
     198   else 
     199   { recursiveFunc(depth-1); }    
    197200} 
    198201 
     
    210213   PerfMonitorGuard g("doStuff"); 
    211214 
    212    recursiveFunc(); 
    213215   { 
    214216      PerfMonitorGuard g("Work1"); 
     217      recursiveFunc(); 
    215218      randWork(unsigned(10.0*x),       1, "10*x"); 
    216219      randWork(unsigned(10.0*(1.0-x)), 1, "10*(1-x)"); 
    217220   } 
    218221 
    219    /* 
    220    recursiveFunc(); 
    221222   { 
    222223      PerfMonitorGuard g("Work2"); 
    223       randWork(unsigned(400.0*x),    1, "400*x"); 
    224       randWork(5,                   30, "5-30"); 
    225    } 
    226  
    227    recursiveFunc(); 
     224      recursiveFunc(); 
     225      randWork(unsigned(5.0*x),    1, "5x-1"); 
     226      randWork(2,                 10, "2-10"); 
     227   } 
     228    
    228229   { 
    229230      PerfMonitorGuard g("Work3"); 
    230       randWork( 5, unsigned(30.0*x), "5-30x"); 
    231       randWork(10,                0, "10"); 
    232    } 
    233    */ 
    234 
     231      recursiveFunc(); 
     232      randWork( 1, unsigned(5.0*x), "1-5x"); 
     233      randWork(2,                0, "2-0"); 
     234   }    
     235 
     236   { 
     237      PerfMonitorGuard g("Work4"); 
     238      recursiveFunc(3);       
     239   } 
     240 
     241   { 
     242      PerfMonitorGuard g("Work5"); 
     243      recursiveFunc(3);       
     244   } 
     245 
     246   { 
     247      PerfMonitorGuard g("Work6"); 
     248      recursiveFunc(3);       
     249   } 
     250 
     251   { 
     252      PerfMonitorGuard g("Work7"); 
     253      recursiveFunc(3);       
     254   } 
     255