From 40059ab93a3f0db5e80e6dd4c13fc4d596c0fef1 Mon Sep 17 00:00:00 2001 From: nplourde Date: Wed, 15 Jun 2005 21:49:50 +0000 Subject: [PATCH] new texture frame git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15730 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_macosx.h | 1 + libvo/vo_macosx.m | 23 ++++++++--------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/libvo/vo_macosx.h b/libvo/vo_macosx.h index 4e5e5c3a2b..a91b6b0a87 100644 --- a/libvo/vo_macosx.h +++ b/libvo/vo_macosx.h @@ -23,6 +23,7 @@ CVPixelBufferRef currentFrameBuffer; CVOpenGLTextureCacheRef textureCache; CVOpenGLTextureRef texture; + NSRect textureFrame; GLfloat lowerLeft[2]; GLfloat lowerRight[2]; diff --git a/libvo/vo_macosx.m b/libvo/vo_macosx.m index 99fe6d6420..30447ca99b 100644 --- a/libvo/vo_macosx.m +++ b/libvo/vo_macosx.m @@ -41,7 +41,6 @@ static uint32_t image_height; static uint32_t image_depth; static uint32_t image_bytes; static uint32_t image_format; -static NSRect image_rec; //vo extern int vo_rootwin; @@ -532,7 +531,7 @@ static uint32_t control(uint32_t request, void *data, ...) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - //set image_rec + //set texture frame if(vo_keepaspect) { aspect( (int *)&d_width, (int *)&d_height, A_NOZOOM); @@ -544,23 +543,17 @@ static uint32_t control(uint32_t request, void *data, ...) if((d_height*aspectX)>(frame.size.height)) { padding = (frame.size.width - d_width*aspectY)/2; - image_rec.origin.x = padding; - image_rec.origin.y = 0; - image_rec.size.width = d_width*aspectY+padding; - image_rec.size.height = d_height*aspectY; + textureFrame = NSMakeRect(padding, 0, d_width*aspectY+padding, d_height*aspectY); } else { padding = ((frame.size.height) - d_height*aspectX)/2; - image_rec.origin.x = 0; - image_rec.origin.y = padding; - image_rec.size.width = d_width*aspectX; - image_rec.size.height = d_height*aspectX+padding; + textureFrame = NSMakeRect(0, padding, d_width*aspectX, d_height*aspectX+padding); } } else { - image_rec = frame; + textureFrame = frame; } } @@ -576,10 +569,10 @@ static uint32_t control(uint32_t request, void *data, ...) glColor3f(1,1,1); glBegin(GL_QUADS); - glTexCoord2f(upperLeft[0], upperLeft[1]); glVertex2i( image_rec.origin.x-(vo_panscan_x >> 1), image_rec.origin.y-(vo_panscan_y >> 1)); - glTexCoord2f(lowerLeft[0], lowerLeft[1]); glVertex2i( image_rec.origin.x-(vo_panscan_x >> 1), image_rec.size.height+(vo_panscan_y >> 1)); - glTexCoord2f(lowerRight[0], lowerRight[1]); glVertex2i( image_rec.size.width+(vo_panscan_x >> 1), image_rec.size.height+(vo_panscan_y >> 1)); - glTexCoord2f(upperRight[0], upperRight[1]); glVertex2i( image_rec.size.width+(vo_panscan_x >> 1), image_rec.origin.y-(vo_panscan_y >> 1)); + glTexCoord2f(upperLeft[0], upperLeft[1]); glVertex2i( textureFrame.origin.x-(vo_panscan_x >> 1), textureFrame.origin.y-(vo_panscan_y >> 1)); + glTexCoord2f(lowerLeft[0], lowerLeft[1]); glVertex2i( textureFrame.origin.x-(vo_panscan_x >> 1), textureFrame.size.height+(vo_panscan_y >> 1)); + glTexCoord2f(lowerRight[0], lowerRight[1]); glVertex2i( textureFrame.size.width+(vo_panscan_x >> 1), textureFrame.size.height+(vo_panscan_y >> 1)); + glTexCoord2f(upperRight[0], upperRight[1]); glVertex2i( textureFrame.size.width+(vo_panscan_x >> 1), textureFrame.origin.y-(vo_panscan_y >> 1)); glEnd(); glDisable(CVOpenGLTextureGetTarget(texture));