@@ -135,13 +135,13 @@ struct _NO_DISCARD_ Color {
135
135
136
136
float sharedexp = 65408 .000f ; // Result of: ((pow2to9 - 1.0f) / pow2to9) * powf(2.0f, 31.0f - 15.0f)
137
137
138
- float cRed = MAX (0 .0f , MIN (sharedexp, r));
139
- float cGreen = MAX (0 .0f , MIN (sharedexp, g));
140
- float cBlue = MAX (0 .0f , MIN (sharedexp, b));
138
+ float cRed = Math::max (0 .0f , Math::min (sharedexp, r));
139
+ float cGreen = Math::max (0 .0f , Math::min (sharedexp, g));
140
+ float cBlue = Math::max (0 .0f , Math::min (sharedexp, b));
141
141
142
- float cMax = MAX (cRed, MAX (cGreen, cBlue));
142
+ float cMax = Math::max (cRed, Math::max (cGreen, cBlue));
143
143
144
- float expp = MAX (-B - 1 .0f , floor (Math::log (cMax) / (real_t )Math_LN2)) + 1 .0f + B;
144
+ float expp = Math::max (-B - 1 .0f , floor (Math::log (cMax) / (real_t )Math_LN2)) + 1 .0f + B;
145
145
146
146
float sMax = (float )floor ((cMax / Math::pow (2 .0f , expp - B - N)) + 0 .5f );
147
147
@@ -204,14 +204,14 @@ struct _NO_DISCARD_ Color {
204
204
operator String () const ;
205
205
206
206
// For the binder.
207
- _FORCE_INLINE_ void set_r8 (int32_t r8) { r = (CLAMP (r8, 0 , 255 ) / 255 .0f ); }
208
- _FORCE_INLINE_ int32_t get_r8 () const { return int32_t (CLAMP (Math::round (r * 255 .0f ), 0 .0f , 255 .0f )); }
209
- _FORCE_INLINE_ void set_g8 (int32_t g8) { g = (CLAMP (g8, 0 , 255 ) / 255 .0f ); }
210
- _FORCE_INLINE_ int32_t get_g8 () const { return int32_t (CLAMP (Math::round (g * 255 .0f ), 0 .0f , 255 .0f )); }
211
- _FORCE_INLINE_ void set_b8 (int32_t b8) { b = (CLAMP (b8, 0 , 255 ) / 255 .0f ); }
212
- _FORCE_INLINE_ int32_t get_b8 () const { return int32_t (CLAMP (Math::round (b * 255 .0f ), 0 .0f , 255 .0f )); }
213
- _FORCE_INLINE_ void set_a8 (int32_t a8) { a = (CLAMP (a8, 0 , 255 ) / 255 .0f ); }
214
- _FORCE_INLINE_ int32_t get_a8 () const { return int32_t (CLAMP (Math::round (a * 255 .0f ), 0 .0f , 255 .0f )); }
207
+ _FORCE_INLINE_ void set_r8 (int32_t r8) { r = (Math::clamp (r8, 0 , 255 ) / 255 .0f ); }
208
+ _FORCE_INLINE_ int32_t get_r8 () const { return int32_t (Math::clamp (Math::round (r * 255 .0f ), 0 .0f , 255 .0f )); }
209
+ _FORCE_INLINE_ void set_g8 (int32_t g8) { g = (Math::clamp (g8, 0 , 255 ) / 255 .0f ); }
210
+ _FORCE_INLINE_ int32_t get_g8 () const { return int32_t (Math::clamp (Math::round (g * 255 .0f ), 0 .0f , 255 .0f )); }
211
+ _FORCE_INLINE_ void set_b8 (int32_t b8) { b = (Math::clamp (b8, 0 , 255 ) / 255 .0f ); }
212
+ _FORCE_INLINE_ int32_t get_b8 () const { return int32_t (Math::clamp (Math::round (b * 255 .0f ), 0 .0f , 255 .0f )); }
213
+ _FORCE_INLINE_ void set_a8 (int32_t a8) { a = (Math::clamp (a8, 0 , 255 ) / 255 .0f ); }
214
+ _FORCE_INLINE_ int32_t get_a8 () const { return int32_t (Math::clamp (Math::round (a * 255 .0f ), 0 .0f , 255 .0f )); }
215
215
216
216
_FORCE_INLINE_ void set_h (float p_h) { set_hsv (p_h, get_s (), get_v (), a); }
217
217
_FORCE_INLINE_ void set_s (float p_s) { set_hsv (get_h (), p_s, get_v (), a); }
0 commit comments