summaryrefslogtreecommitdiffstats
path: root/libass
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2020-07-08 03:32:42 +0300
committerOleg Oshmyan <chortos@inbox.lv>2020-07-08 03:32:42 +0300
commit75b1e54634a1d7e0c3204b09e27a4f887a03e4f4 (patch)
treeea2c2ba638781a05d66eca339a7a0ae43254afad /libass
parent5575d2f727750966cb08502a3381e3441938f38f (diff)
downloadlibass-75b1e54634a1d7e0c3204b09e27a4f887a03e4f4.tar.bz2
libass-75b1e54634a1d7e0c3204b09e27a4f887a03e4f4.tar.xz
Perform 3D transforms relative to shadow position
Fixes https://github.com/libass/libass/issues/141. Fixes https://github.com/libass/libass/issues/300. VSFilter's original intention with this seems to have been to transform the event as a whole, including the shadows as an integral part, as opposed to transforming the shadows separately: imagine the event being rasterized into a single image including the shadows, and then that image being transformed. Unfortunately, due to a caching bug, what actually ends up happening is that the shadow is transformed the intended way, but the main body is then simply shifted back by \shad from the transformed & rasterized shadow, instead of being transformed & rasterized on its own. The result seems sensible if you look at the shadow only but incomprehensible if you look at the main body. Transforms with \shad are actually used and this behavior is relied upon, as evidenced by https://github.com/libass/libass/issues/300 (in which the main body is made invisible and the shadow is used instead of it due to having \t-animatable position and full-area blur despite \bord).
Diffstat (limited to 'libass')
-rw-r--r--libass/ass_render.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c
index c26b95b..40ee3d1 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -2196,8 +2196,11 @@ static void calculate_rotation_params(ASS_Renderer *render_priv, ASS_DRect *bbox
for (int i = 0; i < text_info->length; i++) {
GlyphInfo *info = text_info->glyphs + i;
while (info) {
- info->shift.x = info->pos.x + double_to_d6(device_x - center.x);
- info->shift.y = info->pos.y + double_to_d6(device_y - center.y);
+ info->shift.x = info->pos.x + double_to_d6(device_x - center.x +
+ info->shadow_x * render_priv->border_scale /
+ render_priv->font_scale_x);
+ info->shift.y = info->pos.y + double_to_d6(device_y - center.y +
+ info->shadow_y * render_priv->border_scale);
info = info->next;
}
}