mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-09 20:24:14 +00:00
[host] all: make the downsample rule matching common
This commit is contained in:
@@ -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