@@ -15,11 +15,11 @@ IC s32 clamp_to_8bit(const s32 val) throw()
1515
1616// XXX: maybe make functions constexpr
1717// maps unsigned 8 bits/channel to D3DCOLOR
18- ICF u32 color_argb (u32 a , u32 r , u32 g , u32 b ) throw ()
18+ ICF u32 color_argb (u32 a , u32 r , u32 g , u32 b ) noexcept
1919{ return ((a & 0xff ) << 24 ) | ((r & 0xff ) << 16 ) | ((g & 0xff ) << 8 ) | (b & 0xff ); }
20- ICF u32 color_rgba (u32 r , u32 g , u32 b , u32 a ) throw ()
20+ ICF u32 color_rgba (u32 r , u32 g , u32 b , u32 a ) noexcept
2121{ return color_argb (a , r , g , b ); }
22- ICF u32 color_argb_f (f32 a , f32 r , f32 g , f32 b ) throw ()
22+ ICF u32 color_argb_f (f32 a , f32 r , f32 g , f32 b ) noexcept
2323{
2424#if 0
2525 s32 _r = clampr (iFloor (r * 255.f ), 0 , 255 );
@@ -34,13 +34,13 @@ ICF u32 color_argb_f(f32 a, f32 r, f32 g, f32 b) throw()
3434#endif
3535 return color_argb (_a , _r , _g , _b );
3636}
37- ICF u32 color_rgba_f (f32 r , f32 g , f32 b , f32 a ) throw ()
37+ ICF u32 color_rgba_f (f32 r , f32 g , f32 b , f32 a ) noexcept
3838{ return color_argb_f (a , r , g , b ); }
3939ICF u32 color_xrgb (u32 r , u32 g , u32 b ) { return color_argb (0xff , r , g , b ); }
40- ICF u32 color_get_R (u32 rgba ) throw () { return ((rgba >> 16 ) & 0xff ); }
41- ICF u32 color_get_G (u32 rgba ) throw () { return ((rgba >> 8 ) & 0xff ); }
42- ICF u32 color_get_B (u32 rgba ) throw () { return (rgba & 0xff ); }
43- ICF u32 color_get_A (u32 rgba ) throw () { return (rgba >> 24 ); }
40+ ICF u32 color_get_R (u32 rgba ) noexcept { return ((rgba >> 16 ) & 0xff ); }
41+ ICF u32 color_get_G (u32 rgba ) noexcept { return ((rgba >> 8 ) & 0xff ); }
42+ ICF u32 color_get_B (u32 rgba ) noexcept { return (rgba & 0xff ); }
43+ ICF u32 color_get_A (u32 rgba ) noexcept { return (rgba >> 24 ); }
4444ICF u32 subst_alpha (u32 rgba , u32 a ) { return (rgba & ~color_rgba (0 , 0 , 0 , 0xff )) | color_rgba (0 , 0 , 0 , a ); }
4545ICF u32 bgr2rgb (u32 bgr ) { return color_rgba (color_get_B (bgr ), color_get_G (bgr ), color_get_R (bgr ), 0 ); }
4646ICF u32 rgb2bgr (u32 rgb ) { return bgr2rgb (rgb ); }
@@ -49,7 +49,7 @@ struct Fcolor
4949{
5050 float r , g , b , a ;
5151
52- Fcolor & set (u32 dw ) throw ()
52+ Fcolor & set (u32 dw ) noexcept
5353 {
5454 const float f = float (1.0 ) / float (255.0 );
5555 a = f * float ((dw >> 24 ) & 0xff );
@@ -66,16 +66,16 @@ struct Fcolor
6666 a = _a ;
6767 return * this ;
6868 };
69- Fcolor & set (const Fcolor & rhs ) throw ()
69+ Fcolor & set (const Fcolor & rhs ) noexcept
7070 {
7171 r = rhs .r ;
7272 g = rhs .g ;
7373 b = rhs .b ;
7474 a = rhs .a ;
7575 return * this ;
7676 }
77- u32 get () const throw () { return color_rgba_f (r , g , b , a ); }
78- u32 get_windows () const throw () // Get color as a Windows DWORD value.
77+ u32 get () const noexcept { return color_rgba_f (r , g , b , a ); }
78+ u32 get_windows () const noexcept // Get color as a Windows DWORD value.
7979 {
8080 u8 _a , _r , _g , _b ;
8181 _a = u8 (a * 255.f );
@@ -84,7 +84,7 @@ struct Fcolor
8484 _b = u8 (b * 255.f );
8585 return (u32 )(_a << 24 ) | (_b << 16 ) | (_g << 8 ) | _r ;
8686 }
87- Fcolor & set_windows (u32 dw ) throw () // Set color from a Windows DWORD color value.
87+ Fcolor & set_windows (u32 dw ) noexcept // Set color from a Windows DWORD color value.
8888 {
8989 const float f = 1.0f / 255.0f ;
9090 a = f * (float )(u8 )(dw >> 24 );
@@ -93,21 +93,21 @@ struct Fcolor
9393 r = f * (float )(u8 )(dw >> 0 );
9494 return * this ;
9595 }
96- Fcolor & adjust_contrast (float f ) throw () // >1 - contrast will be increased
96+ Fcolor & adjust_contrast (float f ) noexcept // >1 - contrast will be increased
9797 {
9898 r = 0.5f + f * (r - 0.5f );
9999 g = 0.5f + f * (g - 0.5f );
100100 b = 0.5f + f * (b - 0.5f );
101101 return * this ;
102102 }
103- Fcolor & adjust_contrast (const Fcolor & in , float f ) throw () // >1 - contrast will be increased
103+ Fcolor & adjust_contrast (const Fcolor & in , float f ) noexcept // >1 - contrast will be increased
104104 {
105105 r = 0.5f + f * (in .r - 0.5f );
106106 g = 0.5f + f * (in .g - 0.5f );
107107 b = 0.5f + f * (in .b - 0.5f );
108108 return * this ;
109109 }
110- Fcolor & adjust_saturation (float s ) throw ()
110+ Fcolor & adjust_saturation (float s ) noexcept
111111 {
112112 // Approximate values for each component's contribution to luminance.
113113 // Based upon the NTSC standard described in ITU-R Recommendation BT.709.
@@ -117,7 +117,7 @@ struct Fcolor
117117 b = grey + s * (b - grey );
118118 return * this ;
119119 }
120- Fcolor & adjust_saturation (const Fcolor & in , float s ) throw ()
120+ Fcolor & adjust_saturation (const Fcolor & in , float s ) noexcept
121121 {
122122 // Approximate values for each component's contribution to luminance.
123123 // Based upon the NTSC standard described in ITU-R Recommendation BT.709.
@@ -127,31 +127,31 @@ struct Fcolor
127127 b = grey + s * (in .b - grey );
128128 return * this ;
129129 }
130- Fcolor & modulate (Fcolor & in ) throw () { r *= in .r ; g *= in .g ; b *= in .b ; a *= in .a ; return * this ; }
131- Fcolor & modulate (const Fcolor & in1 , const Fcolor & in2 ) throw () { r = in1 .r * in2 .r ; g = in1 .g * in2 .g ; b = in1 .b * in2 .b ; a = in1 .a * in2 .a ; return * this ; }
132- Fcolor & negative (const Fcolor & in ) throw () { r = 1.0f - in .r ; g = 1.0f - in .g ; b = 1.0f - in .b ; a = 1.0f - in .a ; return * this ; }
133- Fcolor & negative () throw () { r = 1.0f - r ; g = 1.0f - g ; b = 1.0f - b ; a = 1.0f - a ; return * this ; }
134- Fcolor & sub_rgb (float s ) throw () { r -= s ; g -= s ; b -= s ; return * this ; }
135- Fcolor & add_rgb (float s ) throw () { r += s ; g += s ; b += s ; return * this ; }
136- Fcolor & add_rgba (float s ) throw () { r += s ; g += s ; b += s ; a += s ; return * this ; }
137- Fcolor & mul_rgba (float s ) throw () { r *= s ; g *= s ; b *= s ; a *= s ; return * this ; }
138- Fcolor & mul_rgb (float s ) throw () { r *= s ; g *= s ; b *= s ; return * this ; }
139- Fcolor & mul_rgba (const Fcolor & c , float s ) throw () { r = c .r * s ; g = c .g * s ; b = c .b * s ; a = c .a * s ; return * this ; }
140- Fcolor & mul_rgb (const Fcolor & c , float s ) throw () { r = c .r * s ; g = c .g * s ; b = c .b * s ; return * this ; }
130+ Fcolor & modulate (Fcolor & in ) noexcept { r *= in .r ; g *= in .g ; b *= in .b ; a *= in .a ; return * this ; }
131+ Fcolor & modulate (const Fcolor & in1 , const Fcolor & in2 ) noexcept { r = in1 .r * in2 .r ; g = in1 .g * in2 .g ; b = in1 .b * in2 .b ; a = in1 .a * in2 .a ; return * this ; }
132+ Fcolor & negative (const Fcolor & in ) noexcept { r = 1.0f - in .r ; g = 1.0f - in .g ; b = 1.0f - in .b ; a = 1.0f - in .a ; return * this ; }
133+ Fcolor & negative () noexcept { r = 1.0f - r ; g = 1.0f - g ; b = 1.0f - b ; a = 1.0f - a ; return * this ; }
134+ Fcolor & sub_rgb (float s ) noexcept { r -= s ; g -= s ; b -= s ; return * this ; }
135+ Fcolor & add_rgb (float s ) noexcept { r += s ; g += s ; b += s ; return * this ; }
136+ Fcolor & add_rgba (float s ) noexcept { r += s ; g += s ; b += s ; a += s ; return * this ; }
137+ Fcolor & mul_rgba (float s ) noexcept { r *= s ; g *= s ; b *= s ; a *= s ; return * this ; }
138+ Fcolor & mul_rgb (float s ) noexcept { r *= s ; g *= s ; b *= s ; return * this ; }
139+ Fcolor & mul_rgba (const Fcolor & c , float s ) noexcept { r = c .r * s ; g = c .g * s ; b = c .b * s ; a = c .a * s ; return * this ; }
140+ Fcolor & mul_rgb (const Fcolor & c , float s ) noexcept { r = c .r * s ; g = c .g * s ; b = c .b * s ; return * this ; }
141141
142142 // SQ magnitude
143- float magnitude_sqr_rgb () const throw () { return r * r + g * g + b * b ;}
143+ float magnitude_sqr_rgb () const noexcept { return r * r + g * g + b * b ;}
144144 // magnitude
145- float magnitude_rgb () const throw () { return _sqrt (magnitude_sqr_rgb ()); }
146- float intensity () const throw ()
145+ float magnitude_rgb () const noexcept { return _sqrt (magnitude_sqr_rgb ()); }
146+ float intensity () const noexcept
147147 {
148148 // XXX: Use the component percentages from adjust_saturation()?
149149 return (r + g + b ) / 3.f ;
150150 }
151151 // Normalize
152- Fcolor & normalize_rgb () throw () { VERIFY ( magnitude_sqr_rgb () > EPS_S ) ; return mul_rgb ( 1.f / magnitude_rgb ()); }
153- Fcolor & normalize_rgb (const Fcolor & c ) throw () { VERIFY (c .magnitude_sqr_rgb () > EPS_S ); return mul_rgb (c , 1.f / c .magnitude_rgb ()); }
154- Fcolor & lerp (const Fcolor & c1 , const Fcolor & c2 , float t ) throw ()
152+ Fcolor & normalize_rgb () noexcept { VERIFY ( magnitude_sqr_rgb () > EPS_S ); return mul_rgb ( 1.f / magnitude_rgb ()); }
153+ Fcolor & normalize_rgb (const Fcolor & c ) noexcept { VERIFY (c .magnitude_sqr_rgb () > EPS_S ); return mul_rgb (c , 1.f / c .magnitude_rgb ()); }
154+ Fcolor & lerp (const Fcolor & c1 , const Fcolor & c2 , float t ) noexcept
155155 {
156156 float invt = 1.f - t ;
157157 r = c1 .r * invt + c2 .r * t ;
@@ -160,15 +160,15 @@ struct Fcolor
160160 a = c1 .a * invt + c2 .a * t ;
161161 return * this ;
162162 }
163- Fcolor & lerp (const Fcolor & c1 , const Fcolor & c2 , const Fcolor & c3 , float t ) throw ()
163+ Fcolor & lerp (const Fcolor & c1 , const Fcolor & c2 , const Fcolor & c3 , float t ) noexcept
164164 {
165165 if (t > .5f )
166166 return lerp (c2 , c3 , t * 2.f - 1.f );
167167 else
168168 return lerp (c1 , c2 , t * 2.f );
169169 }
170- bool similar_rgba (const Fcolor & v , float E = EPS_L ) const throw () { return _abs (r - v .r ) < E && _abs (g - v .g ) < E && _abs (b - v .b ) < E && _abs (a - v .a ) < E ; }
171- bool similar_rgb (const Fcolor & v , float E = EPS_L ) const throw () { return _abs (r - v .r ) < E && _abs (g - v .g ) < E && _abs (b - v .b ) < E ; }
170+ bool similar_rgba (const Fcolor & v , float E = EPS_L ) const noexcept { return _abs (r - v .r ) < E && _abs (g - v .g ) < E && _abs (b - v .b ) < E && _abs (a - v .a ) < E ; }
171+ bool similar_rgb (const Fcolor & v , float E = EPS_L ) const noexcept { return _abs (r - v .r ) < E && _abs (g - v .g ) < E && _abs (b - v .b ) < E ; }
172172};
173173
174- IC bool _valid (const Fcolor & c ) throw () { return _valid (c .r ) && _valid (c .g ) && _valid (c .b ) && _valid (c .a ); }
174+ IC bool _valid (const Fcolor & c ) noexcept { return _valid (c .r ) && _valid (c .g ) && _valid (c .b ) && _valid (c .a ); }
0 commit comments