mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Do not run update_mask() method if there is no pressure sensitivity option
Major speedup for large images. update_mask() is meant for pen pressure only, so there is no reason to calculate it if we don't have pressure sensitivity enabled
This commit is contained in:
parent
943a69c0e3
commit
6cce27a360
|
@ -130,6 +130,8 @@ func update_mirror_brush() -> void:
|
|||
|
||||
|
||||
func update_mask() -> void:
|
||||
if Global.pressure_sensitivity_mode == Global.PressureSensitivity.NONE:
|
||||
return
|
||||
var size := _get_draw_image().get_size()
|
||||
# Faster than zeroing PoolByteArray directly. See: https://github.com/Orama-Interactive/Pixelorama/pull/439
|
||||
var nulled_array := []
|
||||
|
@ -345,8 +347,11 @@ func _set_pixel(position : Vector2) -> void:
|
|||
|
||||
var image := _get_draw_image()
|
||||
var i := int(position.x + position.y * image.get_size().x)
|
||||
if _mask[i] < Tools.pen_pressure:
|
||||
_mask[i] = Tools.pen_pressure
|
||||
if Global.pressure_sensitivity_mode != Global.PressureSensitivity.NONE:
|
||||
if _mask[i] < Tools.pen_pressure:
|
||||
_mask[i] = Tools.pen_pressure
|
||||
_drawer.set_pixel(image, position, tool_slot.color)
|
||||
else:
|
||||
_drawer.set_pixel(image, position, tool_slot.color)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue