From 5ab87cdc38003765a845f36ccda500ea1fa30b88 Mon Sep 17 00:00:00 2001 From: Andreas Schenk <andreas_schenk@hms.harvard.edu> Date: Wed, 19 Sep 2012 10:41:22 -0400 Subject: [PATCH] added #undefs for RGB fixed some ambiguous fmods and fabs changed class Bitmap to struct Bitmap in fw decl to be consistent --- modules/gfx/src/color.cc | 2 +- modules/gfx/src/color.hh | 2 +- modules/gfx/src/texture.hh | 2 +- modules/gfx/src/vertex_array.cc | 1 + modules/gfx/tests/test_color.cc | 14 +++++++------- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/modules/gfx/src/color.cc b/modules/gfx/src/color.cc index 43316f51c..60607ad0e 100644 --- a/modules/gfx/src/color.cc +++ b/modules/gfx/src/color.cc @@ -263,7 +263,7 @@ Color& Color::operator/=(float rhs) void Color::to_rgb() const { - float hh=fmod(hsv_[0],1.0); + float hh=fmod(hsv_[0],1.0f); if(hh<0.0) hh+=1.0; float ss=std::min(1.0f,std::max(0.0f,hsv_[1])); float vv=std::min(1.0f,std::max(0.0f,hsv_[2])); diff --git a/modules/gfx/src/color.hh b/modules/gfx/src/color.hh index 6f0220bc2..1340967f9 100644 --- a/modules/gfx/src/color.hh +++ b/modules/gfx/src/color.hh @@ -159,7 +159,7 @@ private: mutable bool hsv_dirty_; }; - +#undef RGB /// \brief RGB color spec from floats (0.0-1.0) Color DLLEXPORT_OST_GFX RGB(float r, float g, float b); diff --git a/modules/gfx/src/texture.hh b/modules/gfx/src/texture.hh index dd71404fe..aa3fec45f 100644 --- a/modules/gfx/src/texture.hh +++ b/modules/gfx/src/texture.hh @@ -32,7 +32,7 @@ namespace ost { namespace gfx { -class Bitmap; +struct Bitmap; class Texture { diff --git a/modules/gfx/src/vertex_array.cc b/modules/gfx/src/vertex_array.cc index d37c83af1..520e0d0e9 100644 --- a/modules/gfx/src/vertex_array.cc +++ b/modules/gfx/src/vertex_array.cc @@ -617,6 +617,7 @@ void IndexedVertexArray::Reset() outline_exp_factor_=0.1; outline_exp_color_=Color(0,0,0); solid_=false; + #undef RGB solid_color_=RGB(1,1,1); clip_offset_=0.0; draw_normals_=false; diff --git a/modules/gfx/tests/test_color.cc b/modules/gfx/tests/test_color.cc index 88856fb17..26784b4cc 100644 --- a/modules/gfx/tests/test_color.cc +++ b/modules/gfx/tests/test_color.cc @@ -36,13 +36,13 @@ static const float tolerance=1e-4; namespace { bool compare_colors(const Color& c1, const Color& c2, float tol=1e-6) { - return std::fabs(c1.GetRed()-c2.GetRed()<tol) && - std::fabs(c1.GetGreen()-c2.GetGreen()<tol) && - std::fabs(c1.GetBlue()-c2.GetBlue()<tol) && - std::fabs(c1.GetAlpha()-c2.GetAlpha()<tol) && - std::fabs(c1.GetHue()-c2.GetHue()<tol) && - std::fabs(c1.GetSat()-c2.GetSat()<tol) && - std::fabs(c1.GetVal()-c2.GetVal()<tol); + return std::abs<float>(c1.GetRed()-c2.GetRed()<tol) && + std::abs<float>(c1.GetGreen()-c2.GetGreen()<tol) && + std::abs<float>(c1.GetBlue()-c2.GetBlue()<tol) && + std::abs<float>(c1.GetAlpha()-c2.GetAlpha()<tol) && + std::abs<float>(c1.GetHue()-c2.GetHue()<tol) && + std::abs<float>(c1.GetSat()-c2.GetSat()<tol) && + std::abs<float>(c1.GetVal()-c2.GetVal()<tol); } } -- GitLab