| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/gl_renderer.h" | 7 #include "cc/gl_renderer.h" |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 ResourceProvider::ScopedReadLockGL vPlaneLock(m_resourceProvider, vPlane.res
ourceId); | 860 ResourceProvider::ScopedReadLockGL vPlaneLock(m_resourceProvider, vPlane.res
ourceId); |
| 861 GLC(context(), context()->activeTexture(GL_TEXTURE1)); | 861 GLC(context(), context()->activeTexture(GL_TEXTURE1)); |
| 862 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, yPlaneLock.textureId())
); | 862 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, yPlaneLock.textureId())
); |
| 863 GLC(context(), context()->activeTexture(GL_TEXTURE2)); | 863 GLC(context(), context()->activeTexture(GL_TEXTURE2)); |
| 864 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, uPlaneLock.textureId())
); | 864 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, uPlaneLock.textureId())
); |
| 865 GLC(context(), context()->activeTexture(GL_TEXTURE3)); | 865 GLC(context(), context()->activeTexture(GL_TEXTURE3)); |
| 866 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, vPlaneLock.textureId())
); | 866 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, vPlaneLock.textureId())
); |
| 867 | 867 |
| 868 GLC(context(), context()->useProgram(program->program())); | 868 GLC(context(), context()->useProgram(program->program())); |
| 869 | 869 |
| 870 float yWidthScaleFactor = static_cast<float>(yPlane.visibleSize.width()) / y
Plane.size.width(); | 870 GLC(context(), context()->uniform2f(program->vertexShader().texScaleLocation
(), quad->texScale().width(), quad->texScale().height())); |
| 871 // Arbitrarily take the u sizes because u and v dimensions are identical. | |
| 872 float uvWidthScaleFactor = static_cast<float>(uPlane.visibleSize.width()) /
uPlane.size.width(); | |
| 873 GLC(context(), context()->uniform1f(program->vertexShader().yWidthScaleFacto
rLocation(), yWidthScaleFactor)); | |
| 874 GLC(context(), context()->uniform1f(program->vertexShader().uvWidthScaleFact
orLocation(), uvWidthScaleFactor)); | |
| 875 | |
| 876 GLC(context(), context()->uniform1i(program->fragmentShader().yTextureLocati
on(), 1)); | 871 GLC(context(), context()->uniform1i(program->fragmentShader().yTextureLocati
on(), 1)); |
| 877 GLC(context(), context()->uniform1i(program->fragmentShader().uTextureLocati
on(), 2)); | 872 GLC(context(), context()->uniform1i(program->fragmentShader().uTextureLocati
on(), 2)); |
| 878 GLC(context(), context()->uniform1i(program->fragmentShader().vTextureLocati
on(), 3)); | 873 GLC(context(), context()->uniform1i(program->fragmentShader().vTextureLocati
on(), 3)); |
| 879 | 874 |
| 880 // These values are magic numbers that are used in the transformation from Y
UV to RGB color values. | 875 // These values are magic numbers that are used in the transformation from Y
UV to RGB color values. |
| 881 // They are taken from the following webpage: http://www.fourcc.org/fccyvrgb
.php | 876 // They are taken from the following webpage: http://www.fourcc.org/fccyvrgb
.php |
| 882 float yuv2RGB[9] = { | 877 float yuv2RGB[9] = { |
| 883 1.164f, 1.164f, 1.164f, | 878 1.164f, 1.164f, 1.164f, |
| 884 0.f, -.391f, 2.018f, | 879 0.f, -.391f, 2.018f, |
| 885 1.596f, -.813f, 0.f, | 880 1.596f, -.813f, 0.f, |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1625 | 1620 |
| 1626 releaseRenderPassTextures(); | 1621 releaseRenderPassTextures(); |
| 1627 } | 1622 } |
| 1628 | 1623 |
| 1629 bool GLRenderer::isContextLost() | 1624 bool GLRenderer::isContextLost() |
| 1630 { | 1625 { |
| 1631 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); | 1626 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
| 1632 } | 1627 } |
| 1633 | 1628 |
| 1634 } // namespace cc | 1629 } // namespace cc |
| OLD | NEW |