Fix more -Wc++11-narrowing errors with clang
Follow-up to and fixes #17725 (again).
This commit is contained in:
parent
92030e31fe
commit
b29b35cee5
|
@ -1518,8 +1518,8 @@ Error Image::_decompress_bc() {
|
|||
col_b |= src[2];
|
||||
|
||||
uint8_t table[4][4] = {
|
||||
{ (col_a >> 11) << 3, ((col_a >> 5) & 0x3f) << 2, ((col_a)&0x1f) << 3, 255 },
|
||||
{ (col_b >> 11) << 3, ((col_b >> 5) & 0x3f) << 2, ((col_b)&0x1f) << 3, 255 },
|
||||
{ (uint8_t)((col_a >> 11) << 3), (uint8_t)(((col_a >> 5) & 0x3f) << 2), (uint8_t)(((col_a)&0x1f) << 3), 255 },
|
||||
{ (uint8_t)((col_b >> 11) << 3), (uint8_t)(((col_b >> 5) & 0x3f) << 2), (uint8_t)(((col_b)&0x1f) << 3), 255 },
|
||||
{ 0, 0, 0, 255 },
|
||||
{ 0, 0, 0, 255 }
|
||||
};
|
||||
|
@ -1611,8 +1611,8 @@ Error Image::_decompress_bc() {
|
|||
col_b |= src[8 + 2];
|
||||
|
||||
uint8_t table[4][4] = {
|
||||
{ (col_a >> 11) << 3, ((col_a >> 5) & 0x3f) << 2, ((col_a)&0x1f) << 3, 255 },
|
||||
{ (col_b >> 11) << 3, ((col_b >> 5) & 0x3f) << 2, ((col_b)&0x1f) << 3, 255 },
|
||||
{ (uint8_t)((col_a >> 11) << 3), (uint8_t)(((col_a >> 5) & 0x3f) << 2), (uint8_t)(((col_a)&0x1f) << 3), 255 },
|
||||
{ (uint8_t)((col_b >> 11) << 3), (uint8_t)(((col_b >> 5) & 0x3f) << 2), (uint8_t)(((col_b)&0x1f) << 3), 255 },
|
||||
{ 0, 0, 0, 255 },
|
||||
{ 0, 0, 0, 255 }
|
||||
};
|
||||
|
@ -1722,8 +1722,8 @@ Error Image::_decompress_bc() {
|
|||
col_b |= src[8 + 2];
|
||||
|
||||
uint8_t table[4][4] = {
|
||||
{ (col_a >> 11) << 3, ((col_a >> 5) & 0x3f) << 2, ((col_a)&0x1f) << 3, 255 },
|
||||
{ (col_b >> 11) << 3, ((col_b >> 5) & 0x3f) << 2, ((col_b)&0x1f) << 3, 255 },
|
||||
{ (uint8_t)((col_a >> 11) << 3), (uint8_t)(((col_a >> 5) & 0x3f) << 2), (uint8_t)(((col_a)&0x1f) << 3), 255 },
|
||||
{ (uint8_t)((col_b >> 11) << 3), (uint8_t)(((col_b >> 5) & 0x3f) << 2), (uint8_t)(((col_b)&0x1f) << 3), 255 },
|
||||
{ 0, 0, 0, 255 },
|
||||
{ 0, 0, 0, 255 }
|
||||
};
|
||||
|
|
|
@ -2135,9 +2135,9 @@ Error RasterizerGLES2::_surface_set_arrays(Surface *p_surface, uint8_t *p_mem, u
|
|||
for (int i = 0; i < p_surface->array_len; i++) {
|
||||
|
||||
GLbyte vector[4] = {
|
||||
CLAMP(src[i].x * 127, -128, 127),
|
||||
CLAMP(src[i].y * 127, -128, 127),
|
||||
CLAMP(src[i].z * 127, -128, 127),
|
||||
(GLbyte)CLAMP(src[i].x * 127, -128, 127),
|
||||
(GLbyte)CLAMP(src[i].y * 127, -128, 127),
|
||||
(GLbyte)CLAMP(src[i].z * 127, -128, 127),
|
||||
0,
|
||||
};
|
||||
|
||||
|
@ -2169,10 +2169,10 @@ Error RasterizerGLES2::_surface_set_arrays(Surface *p_surface, uint8_t *p_mem, u
|
|||
for (int i = 0; i < p_surface->array_len; i++) {
|
||||
|
||||
GLbyte xyzw[4] = {
|
||||
CLAMP(src[i * 4 + 0] * 127, -128, 127),
|
||||
CLAMP(src[i * 4 + 1] * 127, -128, 127),
|
||||
CLAMP(src[i * 4 + 2] * 127, -128, 127),
|
||||
CLAMP(src[i * 4 + 3] * 127, -128, 127)
|
||||
(GLbyte)CLAMP(src[i * 4 + 0] * 127, -128, 127),
|
||||
(GLbyte)CLAMP(src[i * 4 + 1] * 127, -128, 127),
|
||||
(GLbyte)CLAMP(src[i * 4 + 2] * 127, -128, 127),
|
||||
(GLbyte)CLAMP(src[i * 4 + 3] * 127, -128, 127)
|
||||
};
|
||||
|
||||
copymem(&p_mem[a.ofs + i * stride], xyzw, a.size);
|
||||
|
|
|
@ -280,7 +280,7 @@ void AudioMixerSW::mix_channel(Channel &c) {
|
|||
//stereo pan
|
||||
float pan = c.pan * 0.5 + 0.5;
|
||||
float panv[2] = {
|
||||
(1.0 - pan) * (1 << MIX_VOL_FRAC_BITS),
|
||||
(1.0f - pan) * (1 << MIX_VOL_FRAC_BITS),
|
||||
(pan) * (1 << MIX_VOL_FRAC_BITS)
|
||||
};
|
||||
|
||||
|
@ -297,9 +297,9 @@ void AudioMixerSW::mix_channel(Channel &c) {
|
|||
float pany = c.depth * 0.5 + 0.5;
|
||||
// with this model every speaker plays at 0.25 energy at the center.. i'm not sure if it's correct but it seems to be balanced
|
||||
float panv[4] = {
|
||||
(1.0 - pany) * (1.0 - panx) * (1 << MIX_VOL_FRAC_BITS),
|
||||
(1.0 - pany) * (panx) * (1 << MIX_VOL_FRAC_BITS),
|
||||
(pany) * (1.0 - panx) * (1 << MIX_VOL_FRAC_BITS),
|
||||
(1.0f - pany) * (1.0f - panx) * (1 << MIX_VOL_FRAC_BITS),
|
||||
(1.0f - pany) * (panx) * (1 << MIX_VOL_FRAC_BITS),
|
||||
(pany) * (1.0f - panx) * (1 << MIX_VOL_FRAC_BITS),
|
||||
(pany) * (panx) * (1 << MIX_VOL_FRAC_BITS)
|
||||
};
|
||||
|
||||
|
|
|
@ -689,7 +689,7 @@ bool SpatialSoundServerSW::internal_buffer_mix(int32_t *p_buffer, int p_frames)
|
|||
case 2: {
|
||||
|
||||
float p = sd.panning.x * 0.5 + 0.5;
|
||||
float panf[2] = { (1.0 - p), p };
|
||||
float panf[2] = { (1.0f - p), p };
|
||||
panf[0] *= sd.volume;
|
||||
panf[1] *= sd.volume;
|
||||
|
||||
|
@ -740,7 +740,7 @@ bool SpatialSoundServerSW::internal_buffer_mix(int32_t *p_buffer, int p_frames)
|
|||
|
||||
float xp = sd.panning.x * 0.5 + 0.5;
|
||||
float yp = sd.panning.y * 0.5 + 0.5;
|
||||
float panf[4] = { (1.0 - xp) * (1.0 - yp), (xp) * (1.0 - yp), (1.0 - xp) * (yp), (xp) * (yp) };
|
||||
float panf[4] = { (1.0f - xp) * (1.0f - yp), (xp) * (1.0f - yp), (1.0f - xp) * (yp), (xp) * (yp) };
|
||||
panf[0] *= sd.volume;
|
||||
panf[1] *= sd.volume;
|
||||
panf[2] *= sd.volume;
|
||||
|
|
|
@ -675,7 +675,7 @@ bool SpatialSound2DServerSW::internal_buffer_mix(int32_t *p_buffer, int p_frames
|
|||
case 2: {
|
||||
|
||||
float p = sd.panning.x * 0.5 + 0.5;
|
||||
float panf[2] = { (1.0 - p), p };
|
||||
float panf[2] = { (1.0f - p), p };
|
||||
panf[0] *= sd.volume;
|
||||
panf[1] *= sd.volume;
|
||||
|
||||
|
@ -726,7 +726,7 @@ bool SpatialSound2DServerSW::internal_buffer_mix(int32_t *p_buffer, int p_frames
|
|||
|
||||
float xp = sd.panning.x * 0.5 + 0.5;
|
||||
float yp = sd.panning.y * 0.5 + 0.5;
|
||||
float panf[4] = { (1.0 - xp) * (1.0 - yp), (xp) * (1.0 - yp), (1.0 - xp) * (yp), (xp) * (yp) };
|
||||
float panf[4] = { (1.0f - xp) * (1.0f - yp), (xp) * (1.0f - yp), (1.0f - xp) * (yp), (xp) * (yp) };
|
||||
panf[0] *= sd.volume;
|
||||
panf[1] *= sd.volume;
|
||||
panf[2] *= sd.volume;
|
||||
|
|
Loading…
Reference in New Issue