summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2021-11-19 12:10:25 +0100
committerNiklas Haas <git@haasn.dev>2021-11-19 12:10:25 +0100
commit17df53519f6359881462da0251e85f99fefd884d (patch)
treea8202afc8f87b0a7f1aa0505c95e0b8093a938fc
parentb89d3f205b22377fe7862cb9f345afd927646df7 (diff)
downloadmpv-17df53519f6359881462da0251e85f99fefd884d.tar.bz2
mpv-17df53519f6359881462da0251e85f99fefd884d.tar.xz
vo_gpu_next: fix panning on rotated videos
Closes #9454
-rw-r--r--video/out/vo_gpu_next.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c
index 4b3abf060e..fbc9474a67 100644
--- a/video/out/vo_gpu_next.c
+++ b/video/out/vo_gpu_next.c
@@ -729,10 +729,16 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
p->src.x0, p->src.y0, p->src.x1, p->src.y1,
};
- // mpv gives us transposed rects, libplacebo expects untransposed
- if (img->rotation % PL_ROTATION_180) {
- MPSWAP(float, img->crop.x0, img->crop.y0);
- MPSWAP(float, img->crop.x1, img->crop.y1);
+ // mpv gives us rotated/flipped rects, libplacebo expects unrotated
+ pl_rect2df_rotate(&img->crop, -img->rotation);
+ if (img->crop.x1 < img->crop.x0) {
+ img->crop.x0 = vo->params->w - img->crop.x0;
+ img->crop.x1 = vo->params->w - img->crop.x1;
+ }
+
+ if (img->crop.y1 < img->crop.y0) {
+ img->crop.y0 = vo->params->h - img->crop.y0;
+ img->crop.y1 = vo->params->h - img->crop.y1;
}
}
}