lib/middleware/scaler.rb in tracksperanto-2.0.1 vs lib/middleware/scaler.rb in tracksperanto-2.0.2
- old
+ new
@@ -6,11 +6,12 @@
cast_to_float :x_factor, :y_factor
# Called on export start
def start_export( img_width, img_height)
set_residual_factor
- super( (img_width * x_factor).to_i, (img_height * y_factor).to_i)
+ @w, @h = (img_width * x_factor).to_i.abs, (img_height * y_factor).to_i.abs
+ super(@w, @h)
end
def y_factor
@y_factor || DEFAULT_FACTOR
end
@@ -18,12 +19,14 @@
def x_factor
@x_factor || DEFAULT_FACTOR
end
def export_point(frame, float_x, float_y, float_residual)
- super(frame,
- (float_x * x_factor),
- (float_y * y_factor),
+ return super if @y_factor == DEFAULT_FACTOR && @x_factor == DEFAULT_FACTOR
+
+ super(frame,
+ x_factor < 0 ? (@w + (float_x * x_factor)) : (float_x * x_factor),
+ y_factor < 0 ? (@h + (float_y * y_factor)) : (float_y * y_factor),
(float_residual * @residual_factor)
)
end
private
\ No newline at end of file