]> git.mxchange.org Git - simgear.git/blobdiff - simgear/screen/colors.hxx
canvas::Text: get maximum width (if displayed on a single line).
[simgear.git] / simgear / screen / colors.hxx
index 40ce19e6945ecd71ad716fd640daf7f1b5199dff..eb78faef93694ffd6bd9afbbd24dd560dd7f5bce 100644 (file)
@@ -16,7 +16,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
 
 #include <math.h>
 
-#if defined( macintosh )
-const float system_gamma = 1.4;
-
-#elif defined (sgi)
-const float system_gamma = 1.7;
+#if defined (sgi)
+const float system_gamma = 2.0/1.7;
 
 #else  // others
 const float system_gamma = 2.5;
@@ -47,14 +44,7 @@ inline void gamma_correct_rgb(float *color,
     color[0] = pow(color[0], tmp);
     color[1] = pow(color[1], tmp);
     color[2] = pow(color[2], tmp);
-
-    if ( color[0] < 0.0 ) { color[0] = 0.0; }
-    if ( color[1] < 0.0 ) { color[1] = 0.0; }
-    if ( color[2] < 0.0 ) { color[2] = 0.0; }
-    if ( color[0] > 1.0 ) { color[0] = 1.0; }
-    if ( color[1] > 1.0 ) { color[1] = 1.0; }
-    if ( color[2] > 1.0 ) { color[2] = 1.0; }
-};
+}
 
 inline void gamma_correct_c(float *color,
                             float reff = 2.5, float system = system_gamma)
@@ -63,9 +53,7 @@ inline void gamma_correct_c(float *color,
       return;
 
    *color = pow(*color, reff/system);
-   if ( *color < 0.0 ) { *color = 0.0; }
-   if ( *color > 1.0 ) { *color = 1.0; }
-};
+}
 
 inline void gamma_restore_rgb(float *color,
                               float reff = 2.5, float system = system_gamma)
@@ -77,14 +65,7 @@ inline void gamma_restore_rgb(float *color,
     color[0] = pow(color[0], tmp);
     color[1] = pow(color[1], tmp);
     color[2] = pow(color[2], tmp);
-
-    if ( color[0] < 0.0 ) { color[0] = 0.0; }
-    if ( color[1] < 0.0 ) { color[1] = 0.0; }
-    if ( color[2] < 0.0 ) { color[2] = 0.0; }
-    if ( color[0] > 1.0 ) { color[0] = 1.0; }
-    if ( color[1] > 1.0 ) { color[1] = 1.0; }
-    if ( color[2] > 1.0 ) { color[2] = 1.0; }
-};
+}
 
 inline void gamma_restore_c(float *color,
                             float reff = 2.5, float system = system_gamma)
@@ -93,9 +74,7 @@ inline void gamma_restore_c(float *color,
       return;
 
    *color = pow(*color, system/reff);
-   if ( *color < 0.0 ) { *color = 0.0; }
-   if ( *color > 1.0 ) { *color = 1.0; }
-};
+}
 
 
 #endif // _SG_COLORS_HXX