From 9786a9af2b670971016e2fd3bff8a9b9fb8eed19 Mon Sep 17 00:00:00 2001 From: kgv Date: Sat, 26 Jan 2013 22:48:12 +0400 Subject: [PATCH] 0023725: C++11 compatibility issues in Image_Color.hxx Fixed warning emited by g++ 4.7.2 --- src/Image/Image_Color.hxx | 58 +++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/src/Image/Image_Color.hxx b/src/Image/Image_Color.hxx index d0bc8c76ea..ace24c088a 100644 --- a/src/Image/Image_Color.hxx +++ b/src/Image/Image_Color.hxx @@ -26,6 +26,9 @@ struct Image_ColorRGB { + //! Component type. + typedef Standard_Byte ComponentType_t; + //! Returns the number of components. static Standard_Integer Length() { @@ -62,6 +65,9 @@ public: struct Image_ColorRGB32 { + //! Component type. + typedef Standard_Byte ComponentType_t; + //! Returns the number of components. static Standard_Integer Length() { @@ -102,6 +108,9 @@ public: struct Image_ColorRGBA { + //! Component type. + typedef Standard_Byte ComponentType_t; + //! Returns the number of components. static Standard_Integer Length() { @@ -142,6 +151,9 @@ public: struct Image_ColorBGR { + //! Component type. + typedef Standard_Byte ComponentType_t; + //! Returns the number of components. static Standard_Integer Length() { @@ -176,6 +188,9 @@ public: struct Image_ColorBGR32 { + //! Component type. + typedef Standard_Byte ComponentType_t; + //! Returns the number of components. static Standard_Integer Length() { @@ -216,6 +231,9 @@ public: struct Image_ColorBGRA { + //! Component type. + typedef Standard_Byte ComponentType_t; + //! Returns the number of components. static Standard_Integer Length() { @@ -256,6 +274,9 @@ public: struct Image_ColorRGBF { + //! Component type. + typedef Standard_ShortReal ComponentType_t; + //! Returns the number of components. static Standard_Integer Length() { @@ -290,6 +311,9 @@ public: struct Image_ColorBGRF { + //! Component type. + typedef Standard_ShortReal ComponentType_t; + //! Returns the number of components. static Standard_Integer Length() { @@ -324,6 +348,9 @@ public: struct Image_ColorRGBAF { + //! Component type. + typedef Standard_ShortReal ComponentType_t; + //! Returns the number of components. static Standard_Integer Length() { @@ -364,6 +391,9 @@ public: struct Image_ColorBGRAF { + //! Component type. + typedef Standard_ShortReal ComponentType_t; + //! Returns the number of components. static Standard_Integer Length() { @@ -404,9 +434,9 @@ public: template inline ColorType_t Image_ColorSumm3 (const ColorType_t& theA, const ColorType_t& theB) { - ColorType_t aRes = {{theA.v[0] + theB.v[0], - theA.v[1] + theB.v[1], - theA.v[2] + theB.v[2]}}; + ColorType_t aRes = {{typename ColorType_t::ComponentType_t (theA.v[0] + theB.v[0]), + typename ColorType_t::ComponentType_t (theA.v[1] + theB.v[1]), + typename ColorType_t::ComponentType_t (theA.v[2] + theB.v[2])}}; return aRes; } @@ -433,10 +463,10 @@ inline Image_ColorBGRF operator+ (const Image_ColorBGRF& theA, const Image_Color template inline ColorType_t Image_ColorSumm4 (const ColorType_t& theA, const ColorType_t& theB) { - ColorType_t aRes = {{theA.v[0] + theB.v[0], - theA.v[1] + theB.v[1], - theA.v[2] + theB.v[2], - theA.v[3] + theB.v[3]}}; + ColorType_t aRes = {{typename ColorType_t::ComponentType_t (theA.v[0] + theB.v[0]), + typename ColorType_t::ComponentType_t (theA.v[1] + theB.v[1]), + typename ColorType_t::ComponentType_t (theA.v[2] + theB.v[2]), + typename ColorType_t::ComponentType_t (theA.v[3] + theB.v[3])}}; return aRes; } @@ -474,9 +504,9 @@ inline Image_ColorBGRAF operator+ (const Image_ColorBGRAF& theA, const Image_Col template inline ColorType_t Image_ColorSub3 (const ColorType_t& theA, const ColorType_t& theB) { - ColorType_t aRes = {{theA.v[0] - theB.v[0], - theA.v[1] - theB.v[1], - theA.v[2] - theB.v[2]}}; + ColorType_t aRes = {{typename ColorType_t::ComponentType_t (theA.v[0] - theB.v[0]), + typename ColorType_t::ComponentType_t (theA.v[1] - theB.v[1]), + typename ColorType_t::ComponentType_t (theA.v[2] - theB.v[2])}}; return aRes; } @@ -503,10 +533,10 @@ inline Image_ColorBGRF operator- (const Image_ColorBGRF& theA, const Image_Color template inline ColorType_t Image_ColorSub4 (const ColorType_t& theA, const ColorType_t& theB) { - ColorType_t aRes = {{theA.v[0] - theB.v[0], - theA.v[1] - theB.v[1], - theA.v[2] - theB.v[2], - theA.v[3] - theB.v[3]}}; + ColorType_t aRes = {{typename ColorType_t::ComponentType_t (theA.v[0] - theB.v[0]), + typename ColorType_t::ComponentType_t (theA.v[1] - theB.v[1]), + typename ColorType_t::ComponentType_t (theA.v[2] - theB.v[2]), + typename ColorType_t::ComponentType_t (theA.v[3] - theB.v[3])}}; return aRes; }