Skip to content

Commit

Permalink
Use getters to lazy-load cleanEdge and OmniScale shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
OverloadedOrama committed Feb 19, 2024
1 parent 66ea1fc commit 22ddc96
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 10 additions & 2 deletions src/Autoload/DrawingAlgos.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ enum GradientDirection { TOP, BOTTOM, LEFT, RIGHT }
## Continuation from Image.Interpolation
enum Interpolation { SCALE3X = 5, CLEANEDGE = 6, OMNISCALE = 7 }
var blend_layers_shader := preload("res://src/Shaders/BlendLayers.gdshader")
var clean_edge_shader: Shader
var omniscale_shader := preload("res://src/Shaders/Effects/Rotation/OmniScale.gdshader")
var clean_edge_shader: Shader:
get:
if clean_edge_shader == null:
clean_edge_shader = load("res://src/Shaders/Effects/Rotation/cleanEdge.gdshader")
return clean_edge_shader
var omniscale_shader: Shader:
get:
if omniscale_shader == null:
omniscale_shader = load("res://src/Shaders/Effects/Rotation/OmniScale.gdshader")
return omniscale_shader


## Blends canvas layers into passed image starting from the origin position
Expand Down
4 changes: 0 additions & 4 deletions src/UI/Dialogs/ImageEffects/RotateImage.gd
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ func _ready() -> void:


func _about_to_popup() -> void:
if DrawingAlgos.clean_edge_shader == null:
DrawingAlgos.clean_edge_shader = load(
"res://src/Shaders/Effects/Rotation/cleanEdge.gdshader"
)
drag_pivot = false
if pivot == Vector2.INF:
_calculate_pivot()
Expand Down
4 changes: 0 additions & 4 deletions src/UI/Dialogs/ImageEffects/ScaleImage.gd
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ func _ready() -> void:


func _on_ScaleImage_about_to_show() -> void:
if DrawingAlgos.clean_edge_shader == null:
DrawingAlgos.clean_edge_shader = load(
"res://src/Shaders/Effects/Rotation/cleanEdge.gdshader"
)
Global.canvas.selection.transform_content_confirm()
aspect_ratio = float(Global.current_project.size.x) / float(Global.current_project.size.y)
width_value.value = Global.current_project.size.x
Expand Down

0 comments on commit 22ddc96

Please sign in to comment.