[host] all: make the downsample rule matching common

This commit is contained in:
Geoffrey McRae committed 2023-11-10 06:28:05 +11:00
1 parent 6c7f3c4197
commit 30c577beeb
6 files changed
+37 -120

No files matched your search

+19
View File
@@ -84,3 +84,22 @@ bool downsampleParser(struct Option * opt, const char * str)
return true;
}
DownsampleRule * downsampleRule_match(int x, int y)
{
DownsampleRule * rule, * match = NULL;
vector_forEachRef(rule, &downsampleRules)
{
if (
( rule->greater && (x > rule->x || y > rule->y)) ||
(!rule->greater && (x == rule->x && y == rule->y)))
{
match = rule;
}
}
if (match)
DEBUG_INFO("Matched downsample rule %d", rule->id);
return match;
}