Skip to content

Commit 1c3619d

Browse files
authored
[gui] Avoid implicit type casts in staging_buffer (#4861)
1 parent 433b0e3 commit 1c3619d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

python/taichi/ui/staging_buffer.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ def copy_image_f32_to_u8(src: ti.template(), dst: ti.template(),
8989
c = src[i, j][k]
9090
c = max(0.0, min(1.0, c))
9191
c = c * 255
92-
dst[i, j][k] = int(c)
92+
dst[i, j][k] = ti.cast(c, u8)
9393
if num_components < 4:
9494
# alpha channel
95-
dst[i, j][3] = 255
95+
dst[i, j][3] = u8(255)
9696

9797

9898
@ti.kernel
@@ -103,7 +103,7 @@ def copy_image_u8_to_u8(src: ti.template(), dst: ti.template(),
103103
dst[i, j][k] = src[i, j][k]
104104
if num_components < 4:
105105
# alpha channel
106-
dst[i, j][3] = 255
106+
dst[i, j][3] = u8(255)
107107

108108

109109
# ggui renderer always assumes the input image to be u8 RGBA

0 commit comments

Comments
 (0)