[MPlayer-cvslog] r38343 - trunk/libvo/vo_corevideo.m
reimar
subversion at mplayerhq.hu
Sat Feb 26 13:28:05 EET 2022
Author: reimar
Date: Sat Feb 26 13:28:05 2022
New Revision: 38343
Log:
vo_corevideo: work around issues when resizing.
Would result in completely wrong scaling.
Modified:
trunk/libvo/vo_corevideo.m
Modified: trunk/libvo/vo_corevideo.m
==============================================================================
--- trunk/libvo/vo_corevideo.m Sat Feb 26 12:08:30 2022 (r38342)
+++ trunk/libvo/vo_corevideo.m Sat Feb 26 13:28:05 2022 (r38343)
@@ -81,6 +81,8 @@ static uint32_t image_bytes;
static uint32_t image_stride;
static uint32_t image_format;
+static int pending_reshape;
+
static vo_info_t info =
{
"Mac OS X Core Video",
@@ -474,25 +476,8 @@ static int control(uint32_t request, voi
*/
- (void)reshape
{
- int d_width, d_height;
-
[super reshape];
-
- glViewport(0, 0, vo_dwidth, vo_dheight);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0, vo_dwidth, vo_dheight, 0, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- d_width = vo_dwidth;
- d_height = vo_dheight;
- //set texture frame
- if(aspect_scaling())
- {
- aspect(&d_width, &d_height, A_WINZOOM);
- }
- textureFrame = NSMakeRect((vo_dwidth - d_width) / 2, (vo_dheight - d_height) / 2, d_width, d_height);
+ pending_reshape = 1;
}
/*
@@ -500,6 +485,28 @@ static int control(uint32_t request, voi
*/
- (void) render
{
+ // setting Matrix does not work inside the reshape function, so do it here
+ // TODO: sometimes it still seems to end up with the wrong width/height when toggling fullscreen??
+ if (pending_reshape) {
+ int d_width = vo_dwidth, d_height = vo_dheight;
+
+ //set texture frame
+ if(aspect_scaling())
+ {
+ aspect(&d_width, &d_height, A_WINZOOM);
+ }
+ textureFrame = NSMakeRect((vo_dwidth - d_width) / 2, (vo_dheight - d_height) / 2, d_width, d_height);
+
+ glViewport(0, 0, vo_dwidth, vo_dheight);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, vo_dwidth, vo_dheight, 0, -1.0, 1.0);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+
+ pending_reshape = 0;
+ }
+
glClear(GL_COLOR_BUFFER_BIT);
glEnable(CVOpenGLTextureGetTarget(texture));
More information about the MPlayer-cvslog
mailing list