summaryrefslogtreecommitdiff
path: root/servers/rendering_server.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-04-27 10:08:26 +0200
committerGitHub <noreply@github.com>2022-04-27 10:08:26 +0200
commit8dfa12cae729258155fbad51ed41f1bb3ad1006a (patch)
tree15a556638bbff71f35e8b42879ccd6570e1f64fb /servers/rendering_server.cpp
parentf8cfff2aa6adcb2665f237d487611f8b2a63099f (diff)
parentde4c97758af117af97fad58e4a80ffeba0154ba8 (diff)
Merge pull request #59979 from bruvzg/cpp_check2
Diffstat (limited to 'servers/rendering_server.cpp')
-rw-r--r--servers/rendering_server.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp
index b58e6138eb..c2a6b83485 100644
--- a/servers/rendering_server.cpp
+++ b/servers/rendering_server.cpp
@@ -424,7 +424,7 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint
value |= CLAMP(int((src[i * 4 + 1] * 0.5 + 0.5) * 1023.0), 0, 1023) << 10;
value |= CLAMP(int((src[i * 4 + 2] * 0.5 + 0.5) * 1023.0), 0, 1023) << 20;
if (src[i * 4 + 3] > 0) {
- value |= 3 << 30;
+ value |= 3UL << 30;
}
memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], &value, 4);
@@ -440,7 +440,7 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint
value |= CLAMP(int((src[i * 4 + 1] * 0.5 + 0.5) * 1023.0), 0, 1023) << 10;
value |= CLAMP(int((src[i * 4 + 2] * 0.5 + 0.5) * 1023.0), 0, 1023) << 20;
if (src[i * 4 + 3] > 0) {
- value |= 3 << 30;
+ value |= 3UL << 30;
}
memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], &value, 4);
}
@@ -1093,7 +1093,7 @@ Array RenderingServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t
Vector2 *w = arr_2d.ptrw();
for (int j = 0; j < p_vertex_len; j++) {
- const float *v = (const float *)&r[j * vertex_elem_size + offsets[i]];
+ const float *v = reinterpret_cast<const float *>(&r[j * vertex_elem_size + offsets[i]]);
w[j] = Vector2(v[0], v[1]);
}
}
@@ -1107,7 +1107,7 @@ Array RenderingServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t
Vector3 *w = arr_3d.ptrw();
for (int j = 0; j < p_vertex_len; j++) {
- const float *v = (const float *)&r[j * vertex_elem_size + offsets[i]];
+ const float *v = reinterpret_cast<const float *>(&r[j * vertex_elem_size + offsets[i]]);
w[j] = Vector3(v[0], v[1], v[2]);
}
}
@@ -1156,7 +1156,7 @@ Array RenderingServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t
Color *w = arr.ptrw();
for (int32_t j = 0; j < p_vertex_len; j++) {
- const uint8_t *v = (const uint8_t *)&ar[j * attrib_elem_size + offsets[i]];
+ const uint8_t *v = reinterpret_cast<const uint8_t *>(&ar[j * attrib_elem_size + offsets[i]]);
w[j] = Color(v[0] / 255.0, v[1] / 255.0, v[2] / 255.0, v[3] / 255.0);
}
@@ -1170,7 +1170,7 @@ Array RenderingServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t
Vector2 *w = arr.ptrw();
for (int j = 0; j < p_vertex_len; j++) {
- const float *v = (const float *)&ar[j * attrib_elem_size + offsets[i]];
+ const float *v = reinterpret_cast<const float *>(&ar[j * attrib_elem_size + offsets[i]]);
w[j] = Vector2(v[0], v[1]);
}
@@ -1184,7 +1184,7 @@ Array RenderingServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t
Vector2 *w = arr.ptrw();
for (int j = 0; j < p_vertex_len; j++) {
- const float *v = (const float *)&ar[j * attrib_elem_size + offsets[i]];
+ const float *v = reinterpret_cast<const float *>(&ar[j * attrib_elem_size + offsets[i]]);
w[j] = Vector2(v[0], v[1]);
}
@@ -1209,7 +1209,7 @@ Array RenderingServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t
uint8_t *w = arr.ptrw();
for (int j = 0; j < p_vertex_len; j++) {
- const uint8_t *v = (const uint8_t *)&ar[j * attrib_elem_size + offsets[i]];
+ const uint8_t *v = reinterpret_cast<const uint8_t *>(&ar[j * attrib_elem_size + offsets[i]]);
memcpy(&w[j * s], v, s);
}
@@ -1228,7 +1228,7 @@ Array RenderingServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t
float *w = arr.ptrw();
for (int j = 0; j < p_vertex_len; j++) {
- const float *v = (const float *)&ar[j * attrib_elem_size + offsets[i]];
+ const float *v = reinterpret_cast<const float *>(&ar[j * attrib_elem_size + offsets[i]]);
memcpy(&w[j * s], v, s * sizeof(float));
}
ret[i] = arr;