~ubuntu-branches/debian/sid/coin2/sid

« back to all changes in this revision

Viewing changes to src/base/SbColor.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2008-06-28 02:38:17 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080628023817-lgrh0u677j1gcqgf
Tags: 2.5.0-2
* debian/control: Change suggests from libopenal0 to libopenal0a.
  Closes: #488001.  Change ${Source-Version} to ${binary:Version}.
  Update to standards version 3.8.0.

* debian/rules: Do not ignore errors in clean rule.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**************************************************************************\
2
2
 *
3
3
 *  This file is part of the Coin 3D visualization library.
4
 
 *  Copyright (C) 1998-2006 by Systems in Motion.  All rights reserved.
 
4
 *  Copyright (C) 1998-2007 by Systems in Motion.  All rights reserved.
5
5
 *
6
6
 *  This library is free software; you can redistribute it and/or
7
7
 *  modify it under the terms of the GNU General Public License
130
130
                     float value)
131
131
{
132
132
#if COIN_DEBUG
133
 
  if (!(hue>=0.0f && hue<=1.0f)) {
134
 
    SoDebugError::postWarning("SbColor::setHSVValue",
135
 
                              "'hue' (%f) not within [0.0,1.0]; clamping.",
136
 
                              hue);
137
 
    if (hue<0.0f) hue=0.0f;
138
 
    else if (hue>1.0f) hue=1.0f;
139
 
  }
140
 
 
141
 
  if (!(saturation>=0.0f && saturation<=1.0f)) {
142
 
    SoDebugError::postWarning("SbColor::setHSVValue",
143
 
                              "'saturation' (%f) not within [0.0,1.0]; "
144
 
                              "clamping.", saturation);
145
 
    if (saturation<0.0f) saturation=0.0f;
146
 
    else if (saturation>1.0f) saturation=1.0f;
147
 
  }
148
 
 
149
 
  if (!(value>=0.0f && value<=1.0f)) {
150
 
    SoDebugError::postWarning("SbColor::setHSVValue",
151
 
                              "'value' (%f) not within [0.0,1.0]; clamping.",
152
 
                              value);
153
 
    if (value<0.0f) value=0.0f;
154
 
    else if (value>1.0f) value=1.0f;
 
133
  if (!(hue>=0.0f && hue<=1.0f) ||
 
134
      !(saturation>=0.0f && saturation<=1.0f) ||
 
135
      !(value>=0.0f && value<=1.0f)) {
 
136
    SoDebugError::postWarning("SbColor::setHSVValue",
 
137
                              "One or more values out of range, clamping.");
 
138
    hue = SbClamp(hue, 0.f, 1.f);
 
139
    saturation = SbClamp(saturation, 0.f, 1.f);
 
140
    value = SbClamp(value, 0.f, 1.f);
155
141
  }
156
142
#endif // COIN_DEBUG
157
143