return -1;
}
+string get_declaration_point(lua_State *L)
+{
+ lua_Debug ar;
+ lua_getstack(L, 1, &ar);
+ lua_getinfo(L, "nSl", &ar);
+ char buf[256];
+ snprintf(buf, sizeof(buf), "%s:%d", ar.source, ar.currentline);
+ return buf;
+}
+
Scene::Scene(Theme *theme, float aspect_nom, float aspect_denom)
: theme(theme), aspect_nom(aspect_nom), aspect_denom(aspect_denom), resource_pool(theme->get_resource_pool()) {}
Scene *scene = (Scene *)luaL_checkudata(L, 1, "Scene");
Block *block = new Block;
+ block->declaration_point = get_declaration_point(L);
block->idx = scene->blocks.size();
if (lua_gettop(L) == 1) {
// No parameter given, so a flexible input.
Scene *scene = (Scene *)luaL_checkudata(L, 1, "Scene");
Block *block = new Block;
+ block->declaration_point = get_declaration_point(L);
block->idx = scene->blocks.size();
if (lua_istable(L, 2)) {
Scene *scene = (Scene *)luaL_checkudata(L, 1, "Scene");
Block *block = new Block;
+ block->declaration_point = get_declaration_point(L);
block->idx = scene->blocks.size();
EffectBlueprint *blueprint = *(EffectBlueprint **)luaL_checkudata(L, 2, "EffectBlueprint");
Block *block = blocks[index_and_effect.first];
Effect *effect = index_and_effect.second;
+ bool missing_width = (current_type(block) == RESIZE_EFFECT ||
+ current_type(block) == RESAMPLE_EFFECT ||
+ current_type(block) == PADDING_EFFECT);
+ bool missing_height = missing_width;
+
// Get the effects currently set on the block.
if (current_type(block) != IDENTITY_EFFECT) { // Ignore settings on optional effects.
+ if (block->int_parameters.count("width") && block->int_parameters["width"] > 0) {
+ missing_width = false;
+ }
+ if (block->int_parameters.count("height") && block->int_parameters["height"] > 0) {
+ missing_height = false;
+ }
for (const auto &key_and_tuple : block->int_parameters) {
int_to_set.emplace(make_pair(effect, key_and_tuple.first), key_and_tuple.second);
}
// so they are set afterwards.
if (!block->alternatives.empty()) {
EffectBlueprint *blueprint = block->alternatives[block->currently_chosen_alternative];
+ if (blueprint->int_parameters.count("width") && blueprint->int_parameters["width"] > 0) {
+ missing_width = false;
+ }
+ if (blueprint->int_parameters.count("height") && blueprint->int_parameters["height"] > 0) {
+ missing_height = false;
+ }
for (const auto &key_and_tuple : blueprint->int_parameters) {
int_to_set[make_pair(effect, key_and_tuple.first)] = key_and_tuple.second;
}
vec4_to_set[make_pair(effect, key_and_tuple.first)] = key_and_tuple.second;
}
}
+
+ if (missing_width || missing_height) {
+ fprintf(stderr, "WARNING: Unset or nonpositive width/height for effect declared at %s "
+ "when getting scene for signal %u; setting to 1x1 to avoid crash.\n",
+ block->declaration_point.c_str(), num);
+ int_to_set[make_pair(effect, "width")] = 1;
+ int_to_set[make_pair(effect, "height")] = 1;
+ }
}
lua_pop(L, 1);