1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Speedup Draw.update_mask() (#439)

This commit is contained in:
kleonc 2021-01-20 22:29:40 +01:00 committed by GitHub
parent 63838964b3
commit 85b0611ca0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,10 +131,10 @@ func update_mirror_brush() -> void:
func update_mask() -> void:
var size := _get_draw_image().get_size()
_mask = PoolByteArray()
_mask.resize(size.x * size.y)
for i in _mask.size():
_mask[i] = 0
# Faster then zeroing PoolByteArray directly. See: https://github.com/Orama-Interactive/Pixelorama/pull/439
var nulled_array := []
nulled_array.resize(size.x * size.y)
_mask = PoolByteArray(nulled_array)
func update_line_polylines(start : Vector2, end : Vector2) -> void: