mirror of
https://github.com/mpv-player/mpv
synced 2024-12-19 05:15:12 +00:00
new texture frame
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15730 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
1865cc057a
commit
40059ab93a
@ -23,6 +23,7 @@
|
|||||||
CVPixelBufferRef currentFrameBuffer;
|
CVPixelBufferRef currentFrameBuffer;
|
||||||
CVOpenGLTextureCacheRef textureCache;
|
CVOpenGLTextureCacheRef textureCache;
|
||||||
CVOpenGLTextureRef texture;
|
CVOpenGLTextureRef texture;
|
||||||
|
NSRect textureFrame;
|
||||||
|
|
||||||
GLfloat lowerLeft[2];
|
GLfloat lowerLeft[2];
|
||||||
GLfloat lowerRight[2];
|
GLfloat lowerRight[2];
|
||||||
|
@ -41,7 +41,6 @@ static uint32_t image_height;
|
|||||||
static uint32_t image_depth;
|
static uint32_t image_depth;
|
||||||
static uint32_t image_bytes;
|
static uint32_t image_bytes;
|
||||||
static uint32_t image_format;
|
static uint32_t image_format;
|
||||||
static NSRect image_rec;
|
|
||||||
|
|
||||||
//vo
|
//vo
|
||||||
extern int vo_rootwin;
|
extern int vo_rootwin;
|
||||||
@ -532,7 +531,7 @@ static uint32_t control(uint32_t request, void *data, ...)
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
//set image_rec
|
//set texture frame
|
||||||
if(vo_keepaspect)
|
if(vo_keepaspect)
|
||||||
{
|
{
|
||||||
aspect( (int *)&d_width, (int *)&d_height, A_NOZOOM);
|
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))
|
if((d_height*aspectX)>(frame.size.height))
|
||||||
{
|
{
|
||||||
padding = (frame.size.width - d_width*aspectY)/2;
|
padding = (frame.size.width - d_width*aspectY)/2;
|
||||||
image_rec.origin.x = padding;
|
textureFrame = NSMakeRect(padding, 0, d_width*aspectY+padding, d_height*aspectY);
|
||||||
image_rec.origin.y = 0;
|
|
||||||
image_rec.size.width = d_width*aspectY+padding;
|
|
||||||
image_rec.size.height = d_height*aspectY;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
padding = ((frame.size.height) - d_height*aspectX)/2;
|
padding = ((frame.size.height) - d_height*aspectX)/2;
|
||||||
image_rec.origin.x = 0;
|
textureFrame = NSMakeRect(0, padding, d_width*aspectX, d_height*aspectX+padding);
|
||||||
image_rec.origin.y = padding;
|
|
||||||
image_rec.size.width = d_width*aspectX;
|
|
||||||
image_rec.size.height = d_height*aspectX+padding;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
image_rec = frame;
|
textureFrame = frame;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -576,10 +569,10 @@ static uint32_t control(uint32_t request, void *data, ...)
|
|||||||
|
|
||||||
glColor3f(1,1,1);
|
glColor3f(1,1,1);
|
||||||
glBegin(GL_QUADS);
|
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(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( image_rec.origin.x-(vo_panscan_x >> 1), image_rec.size.height+(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( image_rec.size.width+(vo_panscan_x >> 1), image_rec.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( image_rec.size.width+(vo_panscan_x >> 1), image_rec.origin.y-(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();
|
glEnd();
|
||||||
glDisable(CVOpenGLTextureGetTarget(texture));
|
glDisable(CVOpenGLTextureGetTarget(texture));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user