From 2839159e454d18d2536facaf47ad57eff529f303 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 16 Jun 2019 00:31:20 +0200 Subject: [PATCH] Rename choose_alternative() to choose(). --- nageru/scene.cpp | 6 +++--- nageru/scene.h | 2 +- nageru/theme.cpp | 2 +- nageru/theme.lua | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/nageru/scene.cpp b/nageru/scene.cpp index bebaa56..3892738 100644 --- a/nageru/scene.cpp +++ b/nageru/scene.cpp @@ -491,7 +491,7 @@ int Block_display(lua_State* L) return 0; } -int Block_choose_alternative(lua_State* L) +int Block_choose(lua_State* L) { assert(lua_gettop(L) == 2); Block *block = *(Block **)luaL_checkudata(L, 1, "Block"); @@ -499,7 +499,7 @@ int Block_choose_alternative(lua_State* L) if (lua_isnumber(L, 2)) { alternative_idx = luaL_checknumber(L, 2); } else if (lua_istable(L, 2)) { - // See if it's an Effect metatable (e.g. foo:choose_alternative(ResampleEffect)) + // See if it's an Effect metatable (e.g. foo:choose(ResampleEffect)) lua_getfield(L, 2, "__effect_type_id"); if (lua_isnumber(L, -1)) { EffectType effect_type = EffectType(luaL_checknumber(L, -1)); @@ -509,7 +509,7 @@ int Block_choose_alternative(lua_State* L) } if (alternative_idx == -1) { - luaL_error(L, "choose_alternative() called with something that was not an index or an effect type (e.g. ResampleEffect) that was part of the alternatives"); + luaL_error(L, "choose() called with something that was not an index or an effect type (e.g. ResampleEffect) that was part of the alternatives"); } assert(alternative_idx >= 0); diff --git a/nageru/scene.h b/nageru/scene.h index 5d5d783..fc36963 100644 --- a/nageru/scene.h +++ b/nageru/scene.h @@ -103,7 +103,7 @@ struct Block { }; int Block_display(lua_State* L); -int Block_choose_alternative(lua_State* L); +int Block_choose(lua_State* L); int Block_enable(lua_State *L); int Block_disable(lua_State *L); int Block_set_int(lua_State *L); diff --git a/nageru/theme.cpp b/nageru/theme.cpp index bf7cdee..53b7543 100644 --- a/nageru/theme.cpp +++ b/nageru/theme.cpp @@ -791,7 +791,7 @@ const luaL_Reg Scene_funcs[] = { const luaL_Reg Block_funcs[] = { { "display", Block_display }, - { "choose_alternative", Block_choose_alternative }, + { "choose", Block_choose }, { "enable", Block_enable }, { "disable", Block_disable }, { "set_int", Block_set_int }, diff --git a/nageru/theme.lua b/nageru/theme.lua index 596108d..172b91d 100644 --- a/nageru/theme.lua +++ b/nageru/theme.lua @@ -401,9 +401,9 @@ function setup_simple_input(state, signals, signal_num, width, height, hq) simple_scene.input:display(signal_num) if needs_scale(signals, signal_num, width, height) then if hq then - simple_scene.resample_effect:choose_alternative(ResampleEffect) -- High-quality resampling. + simple_scene.resample_effect:choose(ResampleEffect) -- High-quality resampling. else - simple_scene.resample_effect:choose_alternative(ResizeEffect) -- Low-quality resampling. + simple_scene.resample_effect:choose(ResizeEffect) -- Low-quality resampling. end simple_scene.resample_effect:set_int("width", width) simple_scene.resample_effect:set_int("height", height) @@ -509,7 +509,7 @@ function place_rectangle(input, x0, y0, x1, y1, screen_width, screen_height, inp -- Cull. if x0 > screen_width or x1 < 0.0 or y0 > screen_height or y1 < 0.0 then - input.resample_switcher:choose_alternative(ResizeEffect) -- Low-quality resizing. + input.resample_switcher:choose(ResizeEffect) -- Low-quality resizing. input.resize_effect:set_int("width", 1) input.resize_effect:set_int("height", 1) input.padding_effect:set_int("left", screen_width + 100) @@ -542,7 +542,7 @@ function place_rectangle(input, x0, y0, x1, y1, screen_width, screen_height, inp if hq then -- High-quality resampling. - input.resample_switcher:choose_alternative(ResampleEffect) + input.resample_switcher:choose(ResampleEffect) local x_subpixel_offset = x0 - math.floor(x0) local y_subpixel_offset = y0 - math.floor(y0) @@ -578,7 +578,7 @@ function place_rectangle(input, x0, y0, x1, y1, screen_width, screen_height, inp input.padding_effect:set_float("border_offset_bottom", y1 - (math.floor(y0) + height)) else -- Lower-quality simple resizing. - input.resample_switcher:choose_alternative(ResizeEffect) + input.resample_switcher:choose(ResizeEffect) local width = round(x1 - x0) local height = round(y1 - y0) -- 2.39.2