Skip to content

Commit

Permalink
[gui] Avoid implicit type casts in staging_buffer (#4861)
Browse files Browse the repository at this point in the history
  • Loading branch information
strongoier authored Apr 26, 2022
1 parent 433b0e3 commit 1c3619d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/taichi/ui/staging_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ def copy_image_f32_to_u8(src: ti.template(), dst: ti.template(),
c = src[i, j][k]
c = max(0.0, min(1.0, c))
c = c * 255
dst[i, j][k] = int(c)
dst[i, j][k] = ti.cast(c, u8)
if num_components < 4:
# alpha channel
dst[i, j][3] = 255
dst[i, j][3] = u8(255)


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


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

0 comments on commit 1c3619d

Please sign in to comment.