diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-07-05 23:15:37 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-07-06 02:10:33 +0200 |
| commit | 23945f433d9cac2e8b8461a574baa70e1acaae1e (patch) | |
| tree | ea5d1782e5e7bb8c31e2e7a383c356c82d16f4d7 /src | |
| parent | 81a948af5550c3142cc52604f71ed9d0daabab1c (diff) | |
Fix pretty broken SSA alignment code.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ssa_reader.cc | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/src/ssa_reader.cc b/src/ssa_reader.cc index 39b99d2..0379803 100644 --- a/src/ssa_reader.cc +++ b/src/ssa_reader.cc @@ -125,28 +125,19 @@ public: effect = SHADOW; } } else if (keys[i] == "Alignment") { - /* These values from libass' source code */ - switch ((raw_convert<int> (style[i]) - 1) % 3) { - case 0: - horizontal_reference = LEFT_OF_SCREEN; - break; - case 1: - horizontal_reference = HORIZONTAL_CENTRE_OF_SCREEN; - break; - case 2: - horizontal_reference = RIGHT_OF_SCREEN; - break; - } - switch (raw_convert<int> (style[i]) & 12) { - case 4: + if (style[i] == "7" || style[i] == "8" || style[i] == "9") { vertical_reference = TOP_OF_SCREEN; - break; - case 8: + } else if (style[i] == "4" || style[i] == "5" || style[i] == "6") { vertical_reference = VERTICAL_CENTRE_OF_SCREEN; - break; - case 0: + } else { vertical_reference = BOTTOM_OF_SCREEN; - break; + } + if (style[i] == "1" || style[i] == "4" || style[i] == "7") { + horizontal_reference = LEFT_OF_SCREEN; + } else if (style[i] == "3" || style[i] == "6" || style[i] == "9") { + horizontal_reference = RIGHT_OF_SCREEN; + } else { + horizontal_reference = HORIZONTAL_CENTRE_OF_SCREEN; } } else if (keys[i] == "MarginV") { vertical_margin = raw_convert<int> (style[i]); |
