mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 04:40:07 +01:00
libweston: Move transform string code into libweston
Pull this out of the frontend. Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
parent
628e860ffa
commit
cfaa19a292
2 changed files with 38 additions and 38 deletions
|
|
@ -1251,44 +1251,6 @@ weston_choose_default_backend(void)
|
|||
return backend;
|
||||
}
|
||||
|
||||
static const struct weston_enum_map transforms[] = {
|
||||
{ "normal", WL_OUTPUT_TRANSFORM_NORMAL },
|
||||
{ "rotate-90", WL_OUTPUT_TRANSFORM_90 },
|
||||
{ "rotate-180", WL_OUTPUT_TRANSFORM_180 },
|
||||
{ "rotate-270", WL_OUTPUT_TRANSFORM_270 },
|
||||
{ "flipped", WL_OUTPUT_TRANSFORM_FLIPPED },
|
||||
{ "flipped-rotate-90", WL_OUTPUT_TRANSFORM_FLIPPED_90 },
|
||||
{ "flipped-rotate-180", WL_OUTPUT_TRANSFORM_FLIPPED_180 },
|
||||
{ "flipped-rotate-270", WL_OUTPUT_TRANSFORM_FLIPPED_270 },
|
||||
};
|
||||
|
||||
WL_EXPORT int
|
||||
weston_parse_transform(const char *transform, uint32_t *out)
|
||||
{
|
||||
const struct weston_enum_map *entry;
|
||||
|
||||
entry = weston_enum_map_find_name(transforms, transform);
|
||||
if (entry) {
|
||||
*out = entry->value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
WL_EXPORT const char *
|
||||
weston_transform_to_string(uint32_t output_transform)
|
||||
{
|
||||
const struct weston_enum_map *entry;
|
||||
|
||||
entry = weston_enum_map_find_value(transforms, output_transform);
|
||||
if (entry)
|
||||
return entry->name;
|
||||
|
||||
return "<illegal value>";
|
||||
}
|
||||
|
||||
static int
|
||||
load_configuration(struct weston_config **config, int32_t noconfig,
|
||||
const char *config_file)
|
||||
|
|
|
|||
|
|
@ -8888,6 +8888,44 @@ debug_scene_view_print_buffer(FILE *fp, struct weston_view *view)
|
|||
fprintf(fp, "\t\t\tdirect-display buffer (no renderer access)\n");
|
||||
}
|
||||
|
||||
static const struct weston_enum_map transforms[] = {
|
||||
{ "normal", WL_OUTPUT_TRANSFORM_NORMAL },
|
||||
{ "rotate-90", WL_OUTPUT_TRANSFORM_90 },
|
||||
{ "rotate-180", WL_OUTPUT_TRANSFORM_180 },
|
||||
{ "rotate-270", WL_OUTPUT_TRANSFORM_270 },
|
||||
{ "flipped", WL_OUTPUT_TRANSFORM_FLIPPED },
|
||||
{ "flipped-rotate-90", WL_OUTPUT_TRANSFORM_FLIPPED_90 },
|
||||
{ "flipped-rotate-180", WL_OUTPUT_TRANSFORM_FLIPPED_180 },
|
||||
{ "flipped-rotate-270", WL_OUTPUT_TRANSFORM_FLIPPED_270 },
|
||||
};
|
||||
|
||||
WL_EXPORT int
|
||||
weston_parse_transform(const char *transform, uint32_t *out)
|
||||
{
|
||||
const struct weston_enum_map *entry;
|
||||
|
||||
entry = weston_enum_map_find_name(transforms, transform);
|
||||
if (entry) {
|
||||
*out = entry->value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
WL_EXPORT const char *
|
||||
weston_transform_to_string(uint32_t output_transform)
|
||||
{
|
||||
const struct weston_enum_map *entry;
|
||||
|
||||
entry = weston_enum_map_find_value(transforms, output_transform);
|
||||
if (entry)
|
||||
return entry->name;
|
||||
|
||||
return "<illegal value>";
|
||||
}
|
||||
|
||||
WL_EXPORT const char *
|
||||
weston_plane_failure_reasons_to_str(enum try_view_on_plane_failure_reasons failure_reasons)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue