]> OCCT Git - occt-copy.git/commitdiff
0023725: C++11 compatibility issues in Image_Color.hxx
authorkgv <kgv@opencascade.org>
Sat, 26 Jan 2013 18:48:12 +0000 (22:48 +0400)
committerkgv <kgv@opencascade.com>
Fri, 1 Feb 2013 12:30:36 +0000 (16:30 +0400)
Fixed warning emited by g++ 4.7.2

src/Image/Image_Color.hxx

index d0bc8c76ea5554a09126b101bcab12ee9695538d..ace24c088a61f523f3de0f2e0efb80b492aa142a 100644 (file)
@@ -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<typename ColorType_t>
 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<typename ColorType_t>
 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<typename ColorType_t>
 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<typename ColorType_t>
 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;
 }