Skip to content

Commit

Permalink
Ensure crop is not 0x0
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAMM committed Nov 13, 2017
1 parent e53b294 commit 33aac74
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function get_output_path(size)
return output_path, output_path_full
end


function script_crop_toggle()
if asscropper.active then
asscropper:stop_crop(true)
Expand All @@ -66,15 +67,23 @@ function script_crop_toggle()
end
end


function on_tick_listener()
if asscropper.active and display_state:recalculate_bounds() then
mp.set_osd_ass(display_state.screen.width, display_state.screen.height, asscropper:get_render_ass())
end
end


function screenshot(crop)
local size = round_dec(crop.w) .. "x" .. round_dec(crop.h)

-- Bail on bad crop sizes
if not (crop.w > 0 and crop.h > 0) then
mp.osd_message("Bad crop (" .. size .. ")!")
return
end

local output_path, fullsize_output_path = get_output_path(size)
local out = mp.commandv("no-osd", "screenshot-to-file", fullsize_output_path)

Expand Down

0 comments on commit 33aac74

Please sign in to comment.