]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/Color.C
fix crash with "save as"
[lyx.git] / src / frontends / xforms / Color.C
index 262a29971227b4ca77b2cf560e9d2a462a84e171..72197c07232824ef93cb8fb852d8843cd0913e77 100644 (file)
@@ -1,26 +1,28 @@
-/* This file is part of
- * ======================================================
- * 
- *           LyX, The Document Processor
- *      
- *         Copyright 1995 Matthias Ettrich
- *          Copyright 1995-2001 The LyX Team.
+/**
+ * \file Color.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *======================================================*/
+ * \author Angus Leeming 
+ *
+ * Full author contact details are available in file CREDITS
+ */
 
 #include <config.h>
 
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "Color.h"
 #include <algorithm> // max
 #include <cmath> // floor
-
 #include FORMS_H_LOCATION
 
-#ifdef __GNUG_
-#pragma implementation
+#ifndef CXX_GLOBAL_CSTD
+using std::floor;
 #endif
 
-#include "Color.h"
-
 using std::max;
 using std::min;
 
@@ -35,9 +37,9 @@ RGBColor::RGBColor(HSVColor const & hsv)
        double h = hsv.h;
        double const s = hsv.s;
        double const v = hsv.v;
-       
+
        double rd, gd, bd;
-       
+
        if (h == nohue || s == 0.0) {
                rd = gd = bd = v;
        } else {
@@ -45,7 +47,7 @@ RGBColor::RGBColor(HSVColor const & hsv)
                h /= 60.0;
 
                int const j = max(0, static_cast<int>(::floor(h)));
-               //if( j < 0 ) j = 0;
+               //if (j < 0) j = 0;
 
                double const f = h - j;
                double const p = v * (1.0 - s);
@@ -91,9 +93,9 @@ RGBColor::RGBColor(HSVColor const & hsv)
                }
        }
 
-       r = static_cast<int>( ::floor((rd * 255.0) + 0.5) );
-       g = static_cast<int>( ::floor((gd * 255.0) + 0.5) );
-       b = static_cast<int>( ::floor((bd * 255.0) + 0.5) );
+       r = static_cast<int>(::floor((rd * 255.0) + 0.5));
+       g = static_cast<int>(::floor((gd * 255.0) + 0.5));
+       b = static_cast<int>(::floor((bd * 255.0) + 0.5));
 }
 
 
@@ -103,8 +105,8 @@ HSVColor::HSVColor(RGBColor const & rgb)
        double const g = rgb.g / 255.0;
        double const b = rgb.b / 255.0;
 
-       double const maxval = max( max( r, g ), b );
-       double const minval = min( min( r, g ), b );
+       double const maxval = max(max(r, g), b);
+       double const minval = min(min(r, g), b);
 
        v = maxval;