/*
-* XBMC Media Center
-* Linux OpenGL Renderer
-* Copyright (c) 2007 Frodo/jcmarshall/vulkanr/d4rk
-*
-* Based on XBoxRenderer by Frodo/jcmarshall
-* Portions Copyright (c) by the authors of ffmpeg / xvid /mplayer
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+ * Copyright (c) 2007 Frodo/jcmarshall/vulkanr/d4rk
+ * Based on XBoxRenderer by Frodo/jcmarshall
+ * Portions Copyright (c) by the authors of ffmpeg / xvid /mplayer
+ * Copyright (C) 2007-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
#include "system.h"
#if (defined HAVE_CONFIG_H) && (!defined TARGET_WINDOWS)
#include "config.h"
m_bImageReady = true;
}
+void CLinuxRendererGL::GetPlaneTextureSize(YUVPLANE& plane)
+{
+ /* texture is assumed to be bound */
+ GLint width = 0
+ , height = 0
+ , border = 0;
+ glGetTexLevelParameteriv(m_textureTarget, 0, GL_TEXTURE_WIDTH , &width);
+ glGetTexLevelParameteriv(m_textureTarget, 0, GL_TEXTURE_HEIGHT, &height);
+ glGetTexLevelParameteriv(m_textureTarget, 0, GL_TEXTURE_BORDER, &border);
+ plane.texwidth = width - 2 * border;
+ plane.texheight = height - 2 * border;
+ if(plane.texwidth <= 0 || plane.texheight <= 0)
+ {
+ CLog::Log(LOGDEBUG, "CLinuxRendererGL::GetPlaneTextureSize - invalid size %dx%d - %d", width, height, border);
+ /* to something that avoid division by zero */
+ plane.texwidth = 1;
+ plane.texheight = 1;
+ }
+
+}
+
void CLinuxRendererGL::CalculateTextureSourceRects(int source, int num_planes)
{
YUVBUFFER& buf = m_buffers[source];
//disable non-linear stretch when a dvd menu is shown, parts of the menu are rendered through the overlay renderer
//having non-linear stretch on breaks the alignment
- if (g_application.m_pPlayer && g_application.m_pPlayer->IsInMenu())
+ if (g_application.m_pPlayer->IsInMenu())
m_pYUVShader->SetNonLinStretch(1.0);
else
m_pYUVShader->SetNonLinStretch(pow(CDisplaySettings::Get().GetPixelRatio(), g_advancedSettings.m_videoNonLinStretchRatio));
//disable non-linear stretch when a dvd menu is shown, parts of the menu are rendered through the overlay renderer
//having non-linear stretch on breaks the alignment
- if (g_application.m_pPlayer && g_application.m_pPlayer->IsInMenu())
+ if (g_application.m_pPlayer->IsInMenu())
m_pVideoFilterShader->SetNonLinStretch(1.0);
else
m_pVideoFilterShader->SetNonLinStretch(pow(CDisplaySettings::Get().GetPixelRatio(), g_advancedSettings.m_videoNonLinStretchRatio));
vdpau->BindPixmap();
+ // make sure we know the correct texture size
+ GetPlaneTextureSize(plane);
+ CalculateTextureSourceRects(index, 1);
+
// Try some clamping or wrapping
glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
//disable non-linear stretch when a dvd menu is shown, parts of the menu are rendered through the overlay renderer
//having non-linear stretch on breaks the alignment
- if (g_application.m_pPlayer && g_application.m_pPlayer->IsInMenu())
+ if (g_application.m_pPlayer->IsInMenu())
m_pVideoFilterShader->SetNonLinStretch(1.0);
else
m_pVideoFilterShader->SetNonLinStretch(pow(CDisplaySettings::Get().GetPixelRatio(), g_advancedSettings.m_videoNonLinStretchRatio));
glBegin(GL_QUADS);
if (m_textureTarget==GL_TEXTURE_2D)
{
- glTexCoord2f(0.0, 0.0); glVertex2f(m_rotatedDestCoords[0].x, m_rotatedDestCoords[0].y);
- glTexCoord2f(1.0, 0.0); glVertex2f(m_rotatedDestCoords[1].x, m_rotatedDestCoords[1].y);
- glTexCoord2f(1.0, 1.0); glVertex2f(m_rotatedDestCoords[2].x, m_rotatedDestCoords[2].y);
- glTexCoord2f(0.0, 1.0); glVertex2f(m_rotatedDestCoords[3].x, m_rotatedDestCoords[3].y);
+ glTexCoord2f(plane.rect.x1, plane.rect.y1); glVertex2f(m_rotatedDestCoords[0].x, m_rotatedDestCoords[0].y);
+ glTexCoord2f(plane.rect.x2, plane.rect.y1); glVertex2f(m_rotatedDestCoords[1].x, m_rotatedDestCoords[1].y);
+ glTexCoord2f(plane.rect.x2, plane.rect.y2); glVertex2f(m_rotatedDestCoords[2].x, m_rotatedDestCoords[2].y);
+ glTexCoord2f(plane.rect.x1, plane.rect.y2); glVertex2f(m_rotatedDestCoords[3].x, m_rotatedDestCoords[3].y);
}
else
{
}
#endif
+ // make sure we know the correct texture size
+ GetPlaneTextureSize(plane);
+ CalculateTextureSourceRects(index, 1);
+
// Try some clamping or wrapping
glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
//disable non-linear stretch when a dvd menu is shown, parts of the menu are rendered through the overlay renderer
//having non-linear stretch on breaks the alignment
- if (g_application.m_pPlayer && g_application.m_pPlayer->IsInMenu())
+ if (g_application.m_pPlayer->IsInMenu())
m_pVideoFilterShader->SetNonLinStretch(1.0);
else
m_pVideoFilterShader->SetNonLinStretch(pow(CDisplaySettings::Get().GetPixelRatio(), g_advancedSettings.m_videoNonLinStretchRatio));
VerifyGLState();
glBegin(GL_QUADS);
- glTexCoord2f(0.0, 0.0); glVertex2f(m_rotatedDestCoords[0].x, m_rotatedDestCoords[0].y);
- glTexCoord2f(1.0, 0.0); glVertex2f(m_rotatedDestCoords[1].x, m_rotatedDestCoords[1].y);
- glTexCoord2f(1.0, 1.0); glVertex2f(m_rotatedDestCoords[2].x, m_rotatedDestCoords[2].y);
- glTexCoord2f(0.0, 1.0); glVertex2f(m_rotatedDestCoords[3].x, m_rotatedDestCoords[3].y);
+ glTexCoord2f(plane.rect.x1, plane.rect.y1); glVertex2f(m_rotatedDestCoords[0].x, m_rotatedDestCoords[0].y);
+ glTexCoord2f(plane.rect.x2, plane.rect.y1); glVertex2f(m_rotatedDestCoords[1].x, m_rotatedDestCoords[1].y);
+ glTexCoord2f(plane.rect.x2, plane.rect.y2); glVertex2f(m_rotatedDestCoords[2].x, m_rotatedDestCoords[2].y);
+ glTexCoord2f(plane.rect.x1, plane.rect.y2); glVertex2f(m_rotatedDestCoords[3].x, m_rotatedDestCoords[3].y);
glEnd();
VerifyGLState();