mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-21 05:33:45 -04:00
config: simplify parsing of "scaling-filter" values slightly
This commit is contained in:
parent
df6c6f5bd6
commit
db4b206409
1 changed files with 9 additions and 12 deletions
21
config.c
21
config.c
|
|
@ -1816,21 +1816,18 @@ parse_section_tweak(
|
||||||
const char *path, unsigned lineno)
|
const char *path, unsigned lineno)
|
||||||
{
|
{
|
||||||
if (strcmp(key, "scaling-filter") == 0) {
|
if (strcmp(key, "scaling-filter") == 0) {
|
||||||
static const struct {
|
static const char filters[][12] = {
|
||||||
const char *name;
|
[FCFT_SCALING_FILTER_NONE] = "none",
|
||||||
enum fcft_scaling_filter filter;
|
[FCFT_SCALING_FILTER_NEAREST] = "nearest",
|
||||||
} filters[] = {
|
[FCFT_SCALING_FILTER_BILINEAR] = "bilinear",
|
||||||
{"none", FCFT_SCALING_FILTER_NONE},
|
[FCFT_SCALING_FILTER_CUBIC] = "cubic",
|
||||||
{"nearest", FCFT_SCALING_FILTER_NEAREST},
|
[FCFT_SCALING_FILTER_LANCZOS3] = "lanczos3",
|
||||||
{"bilinear", FCFT_SCALING_FILTER_BILINEAR},
|
|
||||||
{"cubic", FCFT_SCALING_FILTER_CUBIC},
|
|
||||||
{"lanczos3", FCFT_SCALING_FILTER_LANCZOS3},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (size_t i = 0; i < ALEN(filters); i++) {
|
for (size_t i = 0; i < ALEN(filters); i++) {
|
||||||
if (strcmp(value, filters[i].name) == 0) {
|
if (strcmp(value, filters[i]) == 0) {
|
||||||
conf->tweak.fcft_filter = filters[i].filter;
|
conf->tweak.fcft_filter = i;
|
||||||
LOG_WARN("tweak: scaling-filter=%s", filters[i].name);
|
LOG_WARN("tweak: scaling-filter=%s", filters[i]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue