summaryrefslogtreecommitdiffstats
path: root/libass/ass_render.c
diff options
context:
space:
mode:
authoreugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-04-20 22:56:42 +0000
committereugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-04-20 22:56:42 +0000
commit5a51a3af5e0d1c59afd3382224b85c8d3dff7174 (patch)
tree517230c06508a5aa187ba97c96354c3eac64410e /libass/ass_render.c
parent4932c91ce6c5cdb31418dfc3a1c78f65e19f890c (diff)
downloadlibass-5a51a3af5e0d1c59afd3382224b85c8d3dff7174.tar.bz2
libass-5a51a3af5e0d1c59afd3382224b85c8d3dff7174.tar.xz
Add perspective projection.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23032 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libass/ass_render.c')
-rw-r--r--libass/ass_render.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c
index 279a40c4..0884f58c 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -1589,6 +1589,18 @@ static inline void transform_vector_3d(FT_Vector* v, double *m) {
a[2] = 0.;
a[3] = 1.;
transform_point_3d(a, m, b);
+ /* Apply perspective projection with the following matrix:
+ 2500 0 0 0
+ 0 2500 0 0
+ 0 0 0 0
+ 0 0 8 2500
+ where 2500 is camera distance, 8 - z-axis scale.
+ Camera is always located in (org_x, org_y, -2500). This means
+ that different subtitle events can be displayed at the same time
+ using different cameras. */
+ b[0] *= 2500;
+ b[1] *= 2500;
+ b[3] = 8 * b[2] + 2500;
if (b[3] < 0.001 && b[3] > -0.001)
b[3] = b[3] < 0. ? -0.001 : 0.001;
v->x = double_to_d6(b[0] / b[3]);