@@ -15,11 +15,11 @@ IC s32 clamp_to_8bit(const s32 val) throw()
15
15
16
16
// XXX: maybe make functions constexpr
17
17
// 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
19
19
{ 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
21
21
{ 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
23
23
{
24
24
#if 0
25
25
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()
34
34
#endif
35
35
return color_argb (_a , _r , _g , _b );
36
36
}
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
38
38
{ return color_argb_f (a , r , g , b ); }
39
39
ICF 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 ); }
44
44
ICF u32 subst_alpha (u32 rgba , u32 a ) { return (rgba & ~color_rgba (0 , 0 , 0 , 0xff )) | color_rgba (0 , 0 , 0 , a ); }
45
45
ICF u32 bgr2rgb (u32 bgr ) { return color_rgba (color_get_B (bgr ), color_get_G (bgr ), color_get_R (bgr ), 0 ); }
46
46
ICF u32 rgb2bgr (u32 rgb ) { return bgr2rgb (rgb ); }
@@ -49,7 +49,7 @@ struct Fcolor
49
49
{
50
50
float r , g , b , a ;
51
51
52
- Fcolor & set (u32 dw ) throw ()
52
+ Fcolor & set (u32 dw ) noexcept
53
53
{
54
54
const float f = float (1.0 ) / float (255.0 );
55
55
a = f * float ((dw >> 24 ) & 0xff );
@@ -66,16 +66,16 @@ struct Fcolor
66
66
a = _a ;
67
67
return * this ;
68
68
};
69
- Fcolor & set (const Fcolor & rhs ) throw ()
69
+ Fcolor & set (const Fcolor & rhs ) noexcept
70
70
{
71
71
r = rhs .r ;
72
72
g = rhs .g ;
73
73
b = rhs .b ;
74
74
a = rhs .a ;
75
75
return * this ;
76
76
}
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.
79
79
{
80
80
u8 _a , _r , _g , _b ;
81
81
_a = u8 (a * 255.f );
@@ -84,7 +84,7 @@ struct Fcolor
84
84
_b = u8 (b * 255.f );
85
85
return (u32 )(_a << 24 ) | (_b << 16 ) | (_g << 8 ) | _r ;
86
86
}
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.
88
88
{
89
89
const float f = 1.0f / 255.0f ;
90
90
a = f * (float )(u8 )(dw >> 24 );
@@ -93,21 +93,21 @@ struct Fcolor
93
93
r = f * (float )(u8 )(dw >> 0 );
94
94
return * this ;
95
95
}
96
- Fcolor & adjust_contrast (float f ) throw () // >1 - contrast will be increased
96
+ Fcolor & adjust_contrast (float f ) noexcept // >1 - contrast will be increased
97
97
{
98
98
r = 0.5f + f * (r - 0.5f );
99
99
g = 0.5f + f * (g - 0.5f );
100
100
b = 0.5f + f * (b - 0.5f );
101
101
return * this ;
102
102
}
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
104
104
{
105
105
r = 0.5f + f * (in .r - 0.5f );
106
106
g = 0.5f + f * (in .g - 0.5f );
107
107
b = 0.5f + f * (in .b - 0.5f );
108
108
return * this ;
109
109
}
110
- Fcolor & adjust_saturation (float s ) throw ()
110
+ Fcolor & adjust_saturation (float s ) noexcept
111
111
{
112
112
// Approximate values for each component's contribution to luminance.
113
113
// Based upon the NTSC standard described in ITU-R Recommendation BT.709.
@@ -117,7 +117,7 @@ struct Fcolor
117
117
b = grey + s * (b - grey );
118
118
return * this ;
119
119
}
120
- Fcolor & adjust_saturation (const Fcolor & in , float s ) throw ()
120
+ Fcolor & adjust_saturation (const Fcolor & in , float s ) noexcept
121
121
{
122
122
// Approximate values for each component's contribution to luminance.
123
123
// Based upon the NTSC standard described in ITU-R Recommendation BT.709.
@@ -127,31 +127,31 @@ struct Fcolor
127
127
b = grey + s * (in .b - grey );
128
128
return * this ;
129
129
}
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 ; }
141
141
142
142
// 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 ;}
144
144
// 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
147
147
{
148
148
// XXX: Use the component percentages from adjust_saturation()?
149
149
return (r + g + b ) / 3.f ;
150
150
}
151
151
// 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
155
155
{
156
156
float invt = 1.f - t ;
157
157
r = c1 .r * invt + c2 .r * t ;
@@ -160,15 +160,15 @@ struct Fcolor
160
160
a = c1 .a * invt + c2 .a * t ;
161
161
return * this ;
162
162
}
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
164
164
{
165
165
if (t > .5f )
166
166
return lerp (c2 , c3 , t * 2.f - 1.f );
167
167
else
168
168
return lerp (c1 , c2 , t * 2.f );
169
169
}
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 ; }
172
172
};
173
173
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