[host] all: make the downsample rule matching common
This commit is contained in:
1 parent
6c7f3c4197
commit
30c577beeb
6 files changed
+37
-120
No files matched your search
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user