Skip to content

Commit

Permalink
refactor: remove the obsolete argument from image operations
Browse files Browse the repository at this point in the history
  • Loading branch information
knarewski committed Sep 30, 2024
1 parent d0c17a3 commit b207ebd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions lib/morandi/image_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ def apply_rotate!
@pb = @pb.rotate(a) unless (a % 360).zero?

unless options['straighten'].to_f.zero?
@pb = Morandi::Operation::Straighten.new_from_hash(angle: options['straighten'].to_f).call(nil,
@pb)
@pb = Morandi::Operation::Straighten.new_from_hash(angle: options['straighten'].to_f).call(@pb)
end

@image_width = @pb.width
Expand Down Expand Up @@ -210,7 +209,7 @@ def apply_filters!
else
return
end
@pb = op.call(nil, @pb)
@pb = op.call(@pb)
end

def apply_decorations!
Expand All @@ -235,7 +234,7 @@ def apply_decorations!
'border_size' => @scale * config_for('border-size-mm').to_i * 300 / 25.4 # 5mm at 300dpi
)

@pb = op.call(nil, @pb)
@pb = op.call(@pb)
end

private
Expand Down
2 changes: 1 addition & 1 deletion lib/morandi/operation/colourify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def greyscale(pixbuf)
end
alias bw greyscale # WebKiosk

def call(_image, pixbuf)
def call(pixbuf)
if @filter && respond_to?(@filter)
__send__(@filter, pixbuf)
else
Expand Down
2 changes: 1 addition & 1 deletion lib/morandi/operation/image_border.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Operation
class ImageBorder < ImageOperation
attr_accessor :style, :colour, :crop, :size, :print_size, :shrink, :border_size

def call(_image, pixbuf)
def call(pixbuf)
return pixbuf unless %w[square retro].include? @style

create_pixbuf_from_image_surface(:rgb24, pixbuf.width, pixbuf.height) do |cr|
Expand Down
2 changes: 1 addition & 1 deletion lib/morandi/operation/straighten.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Operation
class Straighten < ImageOperation
attr_accessor :angle

def call(_image, pixbuf)
def call(pixbuf)
return pixbuf if angle.zero?

rotation_value_rad = angle * (Math::PI / 180)
Expand Down

0 comments on commit b207ebd

Please sign in to comment.