From b207ebde35e072144144937a79f6ae5001011650 Mon Sep 17 00:00:00 2001 From: Konrad Date: Mon, 30 Sep 2024 15:51:48 +0200 Subject: [PATCH] refactor: remove the obsolete argument from image operations --- lib/morandi/image_processor.rb | 7 +++---- lib/morandi/operation/colourify.rb | 2 +- lib/morandi/operation/image_border.rb | 2 +- lib/morandi/operation/straighten.rb | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/morandi/image_processor.rb b/lib/morandi/image_processor.rb index d6ffbbe..aed3730 100644 --- a/lib/morandi/image_processor.rb +++ b/lib/morandi/image_processor.rb @@ -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 @@ -210,7 +209,7 @@ def apply_filters! else return end - @pb = op.call(nil, @pb) + @pb = op.call(@pb) end def apply_decorations! @@ -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 diff --git a/lib/morandi/operation/colourify.rb b/lib/morandi/operation/colourify.rb index c6cdf10..47e6ee4 100644 --- a/lib/morandi/operation/colourify.rb +++ b/lib/morandi/operation/colourify.rb @@ -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 diff --git a/lib/morandi/operation/image_border.rb b/lib/morandi/operation/image_border.rb index 0257040..8a9aff7 100644 --- a/lib/morandi/operation/image_border.rb +++ b/lib/morandi/operation/image_border.rb @@ -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| diff --git a/lib/morandi/operation/straighten.rb b/lib/morandi/operation/straighten.rb index 0b53637..dae20ee 100644 --- a/lib/morandi/operation/straighten.rb +++ b/lib/morandi/operation/straighten.rb @@ -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)