fixed CENTER_CLAMPED to center images bigger than view, added CENTER_SCALED background image layout option

This commit is contained in:
Konstantin Borisov
2023-07-13 12:26:49 +07:00
committed by Kovid Goyal
parent da8330253a
commit ee4a9c6ed8
5 changed files with 29 additions and 14 deletions

View File

@@ -77,7 +77,7 @@ class Parser:
raise ValueError(f"The value {val} is not a valid choice for background_image_layout")
ans["background_image_layout"] = val
choices_for_background_image_layout = frozenset(('mirror-tiled', 'scaled', 'tiled', 'clamped', 'centered'))
choices_for_background_image_layout = frozenset(('mirror-tiled', 'scaled', 'tiled', 'clamped', 'centered', 'cscaled'))
def background_image_linear(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
ans['background_image_linear'] = to_bool(val)

View File

@@ -65,7 +65,7 @@ bglayout(PyObject *layout_name) {
case 'm': return MIRRORED;
case 's': return SCALED;
case 'c': {
return name[1] == 'l' ? CLAMPED : CENTER_CLAMPED;
return name[1] == 'l' ? CLAMPED : (name[1] == 's' ? CENTER_SCALED : CENTER_CLAMPED);
}
default: break;
}