Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2259 from elupus/studio

Limited color range for usage over HDMI
  • Loading branch information...
commit f65e61c8e8b075fec71ed28841b374299d1cbe4f 2 parents 79d9923 + 51ac78a
Joakim Plate elupus authored
5 language/English/strings.po
View
@@ -12008,3 +12008,8 @@ msgstr ""
msgctxt "#36041"
msgid "* Item folder"
msgstr ""
+
+#: xbmc/settings/GUISettings.cpp
+msgctxt "#36042"
+msgid "Use limited color range (16-235)"
+msgstr ""
4 xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
View
@@ -3187,7 +3187,7 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature)
{
if(feature == RENDERFEATURE_BRIGHTNESS)
{
- if ((m_renderMethod & RENDER_VDPAU) && !g_guiSettings.GetBool("videoplayer.vdpaustudiolevel"))
+ if ((m_renderMethod & RENDER_VDPAU) && !g_guiSettings.GetBool("videoscreen.limitedrange"))
return true;
if (m_renderMethod & RENDER_VAAPI)
@@ -3200,7 +3200,7 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature)
if(feature == RENDERFEATURE_CONTRAST)
{
- if ((m_renderMethod & RENDER_VDPAU) && !g_guiSettings.GetBool("videoplayer.vdpaustudiolevel"))
+ if ((m_renderMethod & RENDER_VDPAU) && !g_guiSettings.GetBool("videoscreen.limitedrange"))
return true;
if (m_renderMethod & RENDER_VAAPI)
13 xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.cpp
View
@@ -24,6 +24,7 @@
#include "YUV2RGBShader.h"
#include "settings/AdvancedSettings.h"
#include "guilib/TransformMatrix.h"
+#include "windowing/WindowingFactory.h"
#include "utils/log.h"
#if defined(HAS_GL) || defined(HAS_GLES)
#include "utils/GLUtils.h"
@@ -106,8 +107,20 @@ void CalculateYUVMatrix(TransformMatrix &matrix
coef.m[row][col] = conv[col][row];
coef.identity = false;
+
+ if(g_Windowing.UseLimitedColor())
+ {
+ matrix *= TransformMatrix::CreateTranslation(+ 16.0f / 255
+ , + 16.0f / 255
+ , + 16.0f / 255);
+ matrix *= TransformMatrix::CreateScaler((235 - 16) / 255.0f
+ , (235 - 16) / 255.0f
+ , (235 - 16) / 255.0f);
+ }
+
matrix *= coef;
matrix *= TransformMatrix::CreateTranslation(0.0, -0.5, -0.5);
+
if (!(flags & CONF_FLAGS_YUV_FULLRANGE))
{
matrix *= TransformMatrix::CreateScaler(255.0f / (235 - 16)
5 xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp
View
@@ -1571,7 +1571,10 @@ bool CProcessor::Render(CRect src, CRect dst, IDirect3DSurface9* target, REFEREN
blt.DestFormat.VideoTransferFunction = DXVA2_VideoTransFunc_sRGB;
blt.DestFormat.SampleFormat = DXVA2_SampleProgressiveFrame;
- blt.DestFormat.NominalRange = DXVA2_NominalRange_0_255;
+ if(g_Windowing.UseLimitedColor())
+ blt.DestFormat.NominalRange = DXVA2_NominalRange_16_235;
+ else
+ blt.DestFormat.NominalRange = DXVA2_NominalRange_0_255;
blt.Alpha = DXVA2_Fixed32OpaqueAlpha();
blt.ProcAmpValues.Brightness = ConvertRange( m_brightness, g_settings.m_currentVideoSettings.m_Brightness
2  xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
View
@@ -591,7 +591,7 @@ void CVDPAU::SetColor()
vdp_st = vdp_generate_csc_matrix(&m_Procamp, VDP_COLOR_STANDARD_ITUR_BT_601, &m_CSCMatrix);
VdpVideoMixerAttribute attributes[] = { VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX };
- if (g_guiSettings.GetBool("videoplayer.vdpaustudiolevel"))
+ if (g_guiSettings.GetBool("videoscreen.limitedrange"))
{
void const * pm_CSCMatix[] = { &studioCSC };
vdp_st = vdp_video_mixer_set_attribute_values(videoMixer, ARSIZE(attributes), attributes, pm_CSCMatix);
21 xbmc/guilib/GUIFontTTF.cpp
View
@@ -27,6 +27,7 @@
#include "utils/MathUtils.h"
#include "utils/log.h"
#include "windowing/WindowingFactory.h"
+#include "settings/GUISettings.h"
#include <math.h>
@@ -735,12 +736,24 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c
m_color = color;
SVertex* v = m_vertex + m_vertex_count;
+ unsigned char r = GET_R(color)
+ , g = GET_G(color)
+ , b = GET_B(color)
+ , a = GET_A(color);
+
+ if(g_Windowing.UseLimitedColor())
+ {
+ r = (235 - 16) * r / 255;
+ g = (235 - 16) * g / 255;
+ b = (235 - 16) * b / 255;
+ }
+
for(int i = 0; i < 4; i++)
{
- v[i].r = GET_R(color);
- v[i].g = GET_G(color);
- v[i].b = GET_B(color);
- v[i].a = GET_A(color);
+ v[i].r = r;
+ v[i].g = g;
+ v[i].b = b;
+ v[i].a = a;
}
#if defined(HAS_GL) || defined(HAS_DX)
32 xbmc/guilib/GUIFontTTFDX.cpp
View
@@ -57,17 +57,33 @@ void CGUIFontTTFDX::Begin()
if (m_nestedBeginCount == 0)
{
+ int unit = 0;
// just have to blit from our texture.
- m_texture->BindToUnit(0);
- pD3DDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 ); // only use diffuse
- pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
- pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
- pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
- pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
+ m_texture->BindToUnit(unit);
+ pD3DDevice->SetTextureStageState( unit, D3DTSS_COLOROP, D3DTOP_SELECTARG1 ); // only use diffuse
+ pD3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
+ pD3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
+ pD3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
+ pD3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
+ unit++;
+
+ if(g_Windowing.UseLimitedColor())
+ {
+ pD3DDevice->SetTextureStageState( unit, D3DTSS_COLOROP , D3DTOP_ADD );
+ pD3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG1, D3DTA_CURRENT) ;
+#if(1)
+ pD3DDevice->SetRenderState( D3DRS_TEXTUREFACTOR, D3DCOLOR_RGBA(16,16,16,0) );
+ pD3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG2, D3DTA_TFACTOR );
+#else
+ pD3DDevice->SetTextureStageState( unit, D3DTSS_CONSTANT , D3DCOLOR_RGBA(16,16,16,0) );
+ pD3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG2, D3DTA_CONSTANT );
+#endif
+ unit++;
+ }
// no other texture stages needed
- pD3DDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
- pD3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
+ pD3DDevice->SetTextureStageState( unit, D3DTSS_COLOROP, D3DTOP_DISABLE);
+ pD3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
pD3DDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
pD3DDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
25 xbmc/guilib/GUIFontTTFGL.cpp
View
@@ -28,9 +28,7 @@
#include "gui3d.h"
#include "utils/log.h"
#include "utils/GLUtils.h"
-#if HAS_GLES == 2
#include "windowing/WindowingFactory.h"
-#endif
// stuff for freetype
#include <ft2build.h>
@@ -98,6 +96,26 @@ void CGUIFontTTFGL::Begin()
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
VerifyGLState();
+
+ if(g_Windowing.UseLimitedColor())
+ {
+ glActiveTexture(GL_TEXTURE1);
+ glBindTexture(GL_TEXTURE_2D, m_nTexture); // dummy bind
+ glEnable(GL_TEXTURE_2D);
+
+ const GLfloat rgba[4] = {16.0f / 255.0f, 16.0f / 255.0f, 16.0f / 255.0f, 0.0f};
+ glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE , GL_COMBINE);
+ glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, rgba);
+ glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB , GL_ADD);
+ glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB , GL_PREVIOUS);
+ glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE1_RGB , GL_CONSTANT);
+ glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB , GL_SRC_COLOR);
+ glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_RGB , GL_SRC_COLOR);
+ glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA , GL_REPLACE);
+ glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA , GL_PREVIOUS);
+ VerifyGLState();
+ }
+
#else
g_Windowing.EnableGUIShader(SM_FONTS);
#endif
@@ -127,6 +145,9 @@ void CGUIFontTTFGL::End()
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glDrawArrays(GL_QUADS, 0, m_vertex_count);
glPopClientAttrib();
+
+ glBindTexture(GL_TEXTURE_2D, 0);
+ glActiveTexture(GL_TEXTURE0);
#else
// GLES 2.0 version. Cannot draw quads. Convert to triangles.
GLint posLoc = g_Windowing.GUIShaderGetPos();
58 xbmc/guilib/GUITextureD3D.cpp
View
@@ -31,6 +31,7 @@ CGUITextureD3D::CGUITextureD3D(float posX, float posY, float width, float height
void CGUITextureD3D::Begin(color_t color)
{
+ int unit = 0;
CBaseTexture* texture = m_texture.m_textures[m_currentFrame];
LPDIRECT3DDEVICE9 p3DDevice = g_Windowing.Get3DDevice();
@@ -38,30 +39,50 @@ void CGUITextureD3D::Begin(color_t color)
if (m_diffuse.size())
m_diffuse.m_textures[0]->LoadToGPU();
// Set state to render the image
- texture->BindToUnit(0);
- p3DDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
- p3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
- p3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
- p3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
- p3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
- p3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
+ texture->BindToUnit(unit);
+ p3DDevice->SetTextureStageState( unit, D3DTSS_COLOROP , D3DTOP_MODULATE );
+ p3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG1, D3DTA_TEXTURE );
+ p3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
+ p3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAOP , D3DTOP_MODULATE );
+ p3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
+ p3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
+ unit++;
+
if (m_diffuse.size())
{
m_diffuse.m_textures[0]->BindToUnit(1);
- p3DDevice->SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_TEXTURE );
- p3DDevice->SetTextureStageState( 1, D3DTSS_COLORARG2, D3DTA_CURRENT );
- p3DDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_MODULATE );
- p3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
- p3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAARG2, D3DTA_CURRENT );
- p3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
- p3DDevice->SetTextureStageState( 2, D3DTSS_COLOROP, D3DTOP_DISABLE);
- p3DDevice->SetTextureStageState( 2, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
+ p3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG1, D3DTA_TEXTURE );
+ p3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG2, D3DTA_CURRENT );
+ p3DDevice->SetTextureStageState( unit, D3DTSS_COLOROP , D3DTOP_MODULATE );
+ p3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
+ p3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAARG2, D3DTA_CURRENT );
+ p3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAOP , D3DTOP_MODULATE );
+ unit++;
}
- else
+
+ if(g_Windowing.UseLimitedColor())
{
- p3DDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
- p3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
+ m_col = D3DCOLOR_RGBA(GET_R(color) * (235 - 16) / 255
+ , GET_G(color) * (235 - 16) / 255
+ , GET_B(color) * (235 - 16) / 255
+ , GET_A(color));
+ p3DDevice->SetTextureStageState( unit, D3DTSS_COLOROP , D3DTOP_ADD );
+ p3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG1, D3DTA_CURRENT) ;
+#if(1)
+ p3DDevice->SetRenderState( D3DRS_TEXTUREFACTOR, D3DCOLOR_RGBA(16,16,16, 0) );
+ p3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG2, D3DTA_TFACTOR );
+#else
+ p3DDevice->SetTextureStageState( unit, D3DTSS_CONSTANT , D3DCOLOR_RGBA(16,16,16, 0) );
+ p3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG2, D3DTA_CONSTANT );
+#endif
+ unit++;
}
+ else
+ m_col = color;
+
+ p3DDevice->SetTextureStageState( unit, D3DTSS_COLOROP, D3DTOP_DISABLE);
+ p3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
+
p3DDevice->SetRenderState( D3DRS_ALPHATESTENABLE, TRUE );
p3DDevice->SetRenderState( D3DRS_ALPHAREF, 0 );
p3DDevice->SetRenderState( D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL );
@@ -76,7 +97,6 @@ void CGUITextureD3D::Begin(color_t color)
p3DDevice->SetRenderState( D3DRS_LIGHTING, FALSE);
p3DDevice->SetFVF( D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX2 );
- m_col = color;
}
void CGUITextureD3D::End()
57 xbmc/guilib/GUITextureGL.cpp
View
@@ -26,6 +26,7 @@
#include "utils/log.h"
#include "utils/GLUtils.h"
#include "guilib/Geometry.h"
+#include "windowing/WindowingFactory.h"
#if defined(HAS_GL)
@@ -37,17 +38,23 @@ CGUITextureGL::CGUITextureGL(float posX, float posY, float width, float height,
void CGUITextureGL::Begin(color_t color)
{
- m_col[0] = (GLubyte)GET_R(color);
- m_col[1] = (GLubyte)GET_G(color);
- m_col[2] = (GLubyte)GET_B(color);
- m_col[3] = (GLubyte)GET_A(color);
+ int range, unit = 0;
+ if(g_Windowing.UseLimitedColor())
+ range = 235 - 16;
+ else
+ range = 255 - 0;
+
+ m_col[0] = GET_R(color) * range / 255;
+ m_col[1] = GET_G(color) * range / 255;
+ m_col[2] = GET_B(color) * range / 255;
+ m_col[3] = GET_A(color);
CBaseTexture* texture = m_texture.m_textures[m_currentFrame];
texture->LoadToGPU();
if (m_diffuse.size())
m_diffuse.m_textures[0]->LoadToGPU();
- texture->BindToUnit(0);
+ texture->BindToUnit(unit++);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND); // Turn Blending On
@@ -56,23 +63,53 @@ void CGUITextureGL::Begin(color_t color)
// diffuse coloring
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
- glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE0);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PRIMARY_COLOR);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
+
+ glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_PRIMARY_COLOR);
+ glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
+ glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
VerifyGLState();
if (m_diffuse.size())
{
- m_diffuse.m_textures[0]->BindToUnit(1);
+ m_diffuse.m_textures[0]->BindToUnit(unit++);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
- glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE1);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PREVIOUS);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
+
+ glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_PREVIOUS);
+ glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
+ glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
VerifyGLState();
}
+
+ if(g_Windowing.UseLimitedColor())
+ {
+ texture->BindToUnit(unit++); // dummy bind
+ const GLfloat rgba[4] = {16.0f / 255.0f, 16.0f / 255.0f, 16.0f / 255.0f, 0.0f};
+ glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE , GL_COMBINE);
+ glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, rgba);
+ glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB , GL_ADD);
+ glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB , GL_PREVIOUS);
+ glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE1_RGB , GL_CONSTANT);
+ glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB , GL_SRC_COLOR);
+ glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_RGB , GL_SRC_COLOR);
+
+ glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA , GL_REPLACE);
+ glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA , GL_PREVIOUS);
+ VerifyGLState();
+ }
+
//glDisable(GL_TEXTURE_2D); // uncomment these 2 lines to switch to wireframe rendering
//glBegin(GL_LINE_LOOP);
glBegin(GL_QUADS);
@@ -82,10 +119,8 @@ void CGUITextureGL::End()
{
glEnd();
if (m_diffuse.size())
- {
glDisable(GL_TEXTURE_2D);
- glActiveTextureARB(GL_TEXTURE0_ARB);
- }
+ glActiveTexture(GL_TEXTURE0_ARB);
glDisable(GL_TEXTURE_2D);
}
8 xbmc/guilib/TextureGL.cpp
View
@@ -185,14 +185,10 @@ void CGLTexture::LoadToGPU()
void CGLTexture::BindToUnit(unsigned int unit)
{
- // we support only 2 texture units at present
-#ifndef HAS_GLES
- glActiveTexture((unit == 1) ? GL_TEXTURE1_ARB : GL_TEXTURE0_ARB);
+ glActiveTexture(GL_TEXTURE0 + unit);
glBindTexture(GL_TEXTURE_2D, m_texture);
+#ifndef HAS_GLES
glEnable(GL_TEXTURE_2D);
-#else // GLES
- glActiveTexture((unit == 1) ? GL_TEXTURE1 : GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, m_texture);
#endif
}
16 xbmc/settings/GUISettings.cpp
View
@@ -433,6 +433,7 @@ void CGUISettings::Initialize()
#else
AddBool(vs, "videoscreen.blankdisplays", 13130, false);
#endif
+
AddSeparator(vs, "videoscreen.sep1");
#endif
@@ -451,6 +452,12 @@ void CGUISettings::Initialize()
AddString(vs, "videoscreen.testpattern",226,"", BUTTON_CONTROL_STANDARD);
#endif
+#if defined(HAS_GL) || defined(HAS_DX)
+ AddBool(vs , "videoscreen.limitedrange", 36042, false);
+#else
+ AddBool(NULL, "videoscreen.limitedrange", 36042, false);
+#endif
+
CSettingsCategory* ao = AddCategory(SETTINGS_SYSTEM, "audiooutput", 772);
map<int,int> audiomode;
@@ -768,7 +775,7 @@ void CGUISettings::Initialize()
AddSeparator(vp, "videoplayer.sep1.5");
#ifdef HAVE_LIBVDPAU
AddBool(NULL, "videoplayer.vdpauUpscalingLevel", 13121, false);
- AddBool(vp, "videoplayer.vdpaustudiolevel", 13122, false);
+ AddBool(NULL, "videoplayer.vdpaustudiolevel", 0, false); //depreciated
#endif
#endif
AddSeparator(vp, "videoplayer.sep5");
@@ -1411,6 +1418,13 @@ void CGUISettings::LoadXML(TiXmlElement *pRootElement, bool hideSettings /* = fa
SetInt("videoscreen.vsync", VSYNC_ALWAYS);
}
#endif
+
+ // map old vpdau color range, to now global setting
+ if (GetBool("videoplayer.vdpaustudiolevel"))
+ {
+ SetBool("videoscreen.limitedrange", true);
+ SetBool("videoplayer.vdpaustudiolevel", false);
+ }
// DXMERGE: This might have been useful?
// g_videoConfig.SetVSyncMode((VSYNC)GetInt("videoscreen.vsync"));
11 xbmc/windowing/WinSystem.cpp
View
@@ -20,6 +20,7 @@
#include "WinSystem.h"
#include "settings/Settings.h"
+#include "settings/GUISettings.h"
using namespace std;
@@ -200,3 +201,13 @@ REFRESHRATE CWinSystemBase::DefaultRefreshRate(int screen, vector<REFRESHRATE> r
}
return bestmatch;
}
+
+bool CWinSystemBase::UseLimitedColor()
+{
+#if defined(HAS_GL) || defined(HAS_DX)
+ static CSettingBool* setting = (CSettingBool*)g_guiSettings.GetSetting("videoscreen.limitedrange");
+ return setting->GetData();
+#else
+ return false;
+#endif
+}
3  xbmc/windowing/WinSystem.h
View
@@ -74,6 +74,9 @@ class CWinSystemBase
//some plattforms have api for gesture inertial scrolling - default to false and use the InertialScrollingHandler
virtual bool HasInertialGestures(){ return false; }
+ //does the output expect limited color range (ie 16-235)
+ virtual bool UseLimitedColor();
+
virtual bool Minimize() { return false; }
virtual bool Restore() { return false; }
virtual bool Hide() { return false; }
Please sign in to comment.
Something went wrong with that request. Please try again.