Skip to content

Commit

Permalink
(core+lua) reset image transform skipped scale
Browse files Browse the repository at this point in the history
  • Loading branch information
letoram committed Aug 20, 2018
1 parent 1a4e6fc commit c3653d3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion doc/reset_image_transform.lua
@@ -1,7 +1,7 @@
-- reset_image_transform
-- @short: Drop all ongoing transformations.
-- @inargs: vid
-- @outargs: left_blend, left_move, left_rotate
-- @outargs: left_blend, left_move, left_rotate, left_scale
-- @longdescr: At times there may be queued events that should be
-- cancelled out due to unforeseen changes, this is especially typical
-- when transformations are initated as part as some input or client event
Expand Down
5 changes: 3 additions & 2 deletions src/engine/arcan_lua.c
Expand Up @@ -1921,12 +1921,13 @@ static int resettransform(lua_State* ctx)
{
LUA_TRACE("reset_image_transform");
arcan_vobj_id id = luaL_checkvid(ctx, 1, NULL);
unsigned left[3];
unsigned left[4];
arcan_video_zaptransform(id, left);
lua_pushnumber(ctx, left[0]);
lua_pushnumber(ctx, left[1]);
lua_pushnumber(ctx, left[2]);
LUA_ETRACE("reset_image_transform", NULL, 3);
lua_pushnumber(ctx, left[3]);
LUA_ETRACE("reset_image_transform", NULL, 4);
}

static int instanttransform(lua_State* ctx)
Expand Down
5 changes: 3 additions & 2 deletions src/engine/arcan_video.c
Expand Up @@ -2780,7 +2780,7 @@ arcan_errc arcan_video_setlife(arcan_vobj_id id, unsigned lifetime)
return rv;
}

arcan_errc arcan_video_zaptransform(arcan_vobj_id id, unsigned left[3])
arcan_errc arcan_video_zaptransform(arcan_vobj_id id, unsigned left[4])
{
arcan_vobject* vobj = arcan_video_getobject(id);

Expand All @@ -2796,9 +2796,10 @@ arcan_errc arcan_video_zaptransform(arcan_vobj_id id, unsigned left[3])
left[0] = ct > current->blend.endt ? 0 : current->blend.endt - ct;
left[1] = ct > current->move.endt ? 0 : current->move.endt - ct;
left[2] = ct > current->rotate.endt ? 0 : current->rotate.endt - ct;
left[3] = ct > current->scale.endt ? 0 : current->scale.endt - ct;
}
else{
left[0] = left[1] = left[2] = 0;
left[0] = left[1] = left[2] = left[3] = 4;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/engine/arcan_video.h
Expand Up @@ -1051,9 +1051,9 @@ arcan_errc arcan_video_transformcycle(arcan_vobj_id, bool active);
* Immediately cancel all pending transforms, leaving the surface in its
* current state. The left array will be populated with the remaining on
* the next transform in the chain, ordered as:
* [blend, move, rotate], 0 if no transform is chained in that slot.
* [blend, move, rotate, scale], 0 if no transform is chained in that slot.
*/
arcan_errc arcan_video_zaptransform(arcan_vobj_id id, unsigned left[3]);
arcan_errc arcan_video_zaptransform(arcan_vobj_id id, unsigned left[4]);

/*
* Associate a tag with the specified transform, and a mask of
Expand Down

0 comments on commit c3653d3

Please sign in to comment.