mirror of https://github.com/mpv-player/mpv
vo_opengl: minor simplification
The extra gl_transform_trans() has no apparent use.
This commit is contained in:
parent
82231fd74d
commit
486b3ce6f8
|
@ -732,16 +732,15 @@ static int pass_bind(struct gl_video *p, struct img_tex tex)
|
||||||
static void get_transform(float w, float h, int rotate, bool flip,
|
static void get_transform(float w, float h, int rotate, bool flip,
|
||||||
struct gl_transform *out_tr)
|
struct gl_transform *out_tr)
|
||||||
{
|
{
|
||||||
struct gl_transform tr = identity_trans;
|
|
||||||
int a = rotate % 90 ? 0 : rotate / 90;
|
int a = rotate % 90 ? 0 : rotate / 90;
|
||||||
int sin90[4] = {0, 1, 0, -1}; // just to avoid rounding issues etc.
|
int sin90[4] = {0, 1, 0, -1}; // just to avoid rounding issues etc.
|
||||||
int cos90[4] = {1, 0, -1, 0};
|
int cos90[4] = {1, 0, -1, 0};
|
||||||
struct gl_transform rot = {{{cos90[a], sin90[a]}, {-sin90[a], cos90[a]}}};
|
struct gl_transform tr = {{{ cos90[a], sin90[a]},
|
||||||
gl_transform_trans(rot, &tr);
|
{-sin90[a], cos90[a]}}};
|
||||||
|
|
||||||
// basically, recenter to keep the whole image in view
|
// basically, recenter to keep the whole image in view
|
||||||
float b[2] = {1, 1};
|
float b[2] = {1, 1};
|
||||||
gl_transform_vec(rot, &b[0], &b[1]);
|
gl_transform_vec(tr, &b[0], &b[1]);
|
||||||
tr.t[0] += b[0] < 0 ? w : 0;
|
tr.t[0] += b[0] < 0 ? w : 0;
|
||||||
tr.t[1] += b[1] < 0 ? h : 0;
|
tr.t[1] += b[1] < 0 ? h : 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue