From 7b6b04aa6893ae02a5bd3076eaffea804a8c07dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Wed, 21 Feb 2024 14:54:23 +0100 Subject: [PATCH] text: remove Text.aspect_ratio --- CHANGELOG.md | 3 +++ libnopegl/nodes.specs | 7 ------- libnopegl/src/node_text.c | 8 +------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e4c23139..d31172177 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,9 @@ Versioning](https://semver.org/spec/v2.0.0.html) for `libnopegl`. `Text.box` parameter; if 3D positioning is required, traditional transform nodes can be used +### Removed +- `Text.aspect_ratio`, it now matches the viewport aspect ratio + ## [2024.0] [libnopegl 0.11.0] - 2024-02-02 ### Added - `ngl.SceneCfg` now includes the backend capabilities diff --git a/libnopegl/nodes.specs b/libnopegl/nodes.specs index 531c6e7fe..0e1c99e1d 100644 --- a/libnopegl/nodes.specs +++ b/libnopegl/nodes.specs @@ -3711,13 +3711,6 @@ "choices": "writing_mode", "flags": [], "desc": "direction flow per character and line" - }, - { - "name": "aspect_ratio", - "type": "rational", - "default": [0,0], - "flags": ["live"], - "desc": "box aspect ratio" } ] }, diff --git a/libnopegl/src/node_text.c b/libnopegl/src/node_text.c index 6be4bce8c..21f85f791 100644 --- a/libnopegl/src/node_text.c +++ b/libnopegl/src/node_text.c @@ -99,7 +99,6 @@ struct text_opts { size_t nb_effect_nodes; int valign, halign; int writing_mode; - int32_t aspect_ratio[2]; }; struct text_priv { @@ -224,10 +223,6 @@ static const struct node_param text_params[] = { {"writing_mode", NGLI_PARAM_TYPE_SELECT, OFFSET(writing_mode), {.i32=NGLI_TEXT_WRITING_MODE_HORIZONTAL_TB}, .choices=&writing_mode_choices, .desc=NGLI_DOCSTRING("direction flow per character and line")}, - {"aspect_ratio", NGLI_PARAM_TYPE_RATIONAL, OFFSET(aspect_ratio), - .flags=NGLI_PARAM_FLAG_ALLOW_LIVE_CHANGE, - .update_func=set_live_changed, - .desc=NGLI_DOCSTRING("box aspect ratio")}, {NULL} }; @@ -269,8 +264,7 @@ static int refresh_geometry(struct ngl_node *node) /* Text/Box ratio */ const struct ngli_box box = {NGLI_ARG_VEC4(o->box)}; const struct viewport viewport = ngli_gpu_ctx_get_viewport(ctx->gpu_ctx); - const int32_t default_ar[2] = {viewport.width, viewport.height}; - const int32_t *ar = o->aspect_ratio[1] ? o->aspect_ratio : default_ar; + const int32_t ar[] = {viewport.width, viewport.height}; const float box_ratio = (float)ar[0] * box.w / ((float)ar[1] * box.h); const float text_ratio = (float)text->width / (float)text->height;