mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-19 01:29:49 +00:00
Slightly optimize the start of transformations with selections
This commit is contained in:
parent
4707fd5da7
commit
39bac838c5
|
@ -935,19 +935,16 @@ func _get_preview_image() -> void:
|
||||||
blended_image.create(project.size.x, project.size.y, false, Image.FORMAT_RGBA8)
|
blended_image.create(project.size.x, project.size.y, false, Image.FORMAT_RGBA8)
|
||||||
Export.blend_selected_cels(blended_image, project.frames[project.current_frame])
|
Export.blend_selected_cels(blended_image, project.frames[project.current_frame])
|
||||||
if original_preview_image.is_empty():
|
if original_preview_image.is_empty():
|
||||||
original_preview_image = blended_image.get_rect(big_bounding_rectangle)
|
original_preview_image.create(
|
||||||
original_preview_image.lock()
|
big_bounding_rectangle.size.x, big_bounding_rectangle.size.y, false, Image.FORMAT_RGBA8
|
||||||
# For non-rectangular selections
|
)
|
||||||
for x in range(0, big_bounding_rectangle.size.x):
|
original_preview_image.blit_rect_mask(
|
||||||
for y in range(0, big_bounding_rectangle.size.y):
|
blended_image, project.selection_map, big_bounding_rectangle, Vector2.ZERO
|
||||||
var pos := Vector2(x, y)
|
)
|
||||||
if !project.can_pixel_get_drawn(pos + big_bounding_rectangle.position):
|
|
||||||
original_preview_image.set_pixelv(pos, Color(0, 0, 0, 0))
|
|
||||||
|
|
||||||
original_preview_image.unlock()
|
|
||||||
if original_preview_image.is_invisible():
|
if original_preview_image.is_invisible():
|
||||||
original_preview_image = Image.new()
|
original_preview_image = Image.new()
|
||||||
return
|
return
|
||||||
|
|
||||||
preview_image.copy_from(original_preview_image)
|
preview_image.copy_from(original_preview_image)
|
||||||
preview_image_texture.create_from_image(preview_image, 0)
|
preview_image_texture.create_from_image(preview_image, 0)
|
||||||
|
|
||||||
|
@ -974,14 +971,8 @@ func _get_preview_image() -> void:
|
||||||
func _get_selected_image(cel_image: Image) -> Image:
|
func _get_selected_image(cel_image: Image) -> Image:
|
||||||
var project: Project = Global.current_project
|
var project: Project = Global.current_project
|
||||||
var image := Image.new()
|
var image := Image.new()
|
||||||
image = cel_image.get_rect(big_bounding_rectangle)
|
image.create(
|
||||||
image.lock()
|
big_bounding_rectangle.size.x, big_bounding_rectangle.size.y, false, Image.FORMAT_RGBA8
|
||||||
# For non-rectangular selections
|
)
|
||||||
for x in range(0, big_bounding_rectangle.size.x):
|
image.blit_rect_mask(cel_image, project.selection_map, big_bounding_rectangle, Vector2.ZERO)
|
||||||
for y in range(0, big_bounding_rectangle.size.y):
|
|
||||||
var pos := Vector2(x, y)
|
|
||||||
if !project.can_pixel_get_drawn(pos + big_bounding_rectangle.position):
|
|
||||||
image.set_pixelv(pos, Color(0, 0, 0, 0))
|
|
||||||
|
|
||||||
image.unlock()
|
|
||||||
return image
|
return image
|
||||||
|
|
Loading…
Reference in a new issue