| 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 "cc/gl_renderer.h" | 5 #include "cc/gl_renderer.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 // Map device space quad to local space. deviceTransform has no 3d compo
nent since it was flattened, so we don't need to project. | 866 // Map device space quad to local space. deviceTransform has no 3d compo
nent since it was flattened, so we don't need to project. |
| 867 // We should have already checked that the transform was uninvertible ab
ove. | 867 // We should have already checked that the transform was uninvertible ab
ove. |
| 868 gfx::Transform inverseDeviceTransform(gfx::Transform::kSkipInitializatio
n); | 868 gfx::Transform inverseDeviceTransform(gfx::Transform::kSkipInitializatio
n); |
| 869 bool didInvert = deviceTransform.GetInverse(&inverseDeviceTransform); | 869 bool didInvert = deviceTransform.GetInverse(&inverseDeviceTransform); |
| 870 DCHECK(didInvert); | 870 DCHECK(didInvert); |
| 871 localQuad = MathUtil::mapQuad(inverseDeviceTransform, deviceQuad.ToQuadF
(), clipped); | 871 localQuad = MathUtil::mapQuad(inverseDeviceTransform, deviceQuad.ToQuadF
(), clipped); |
| 872 | 872 |
| 873 // We should not DCHECK(!clipped) here, because anti-aliasing inflation
may cause deviceQuad to become | 873 // We should not DCHECK(!clipped) here, because anti-aliasing inflation
may cause deviceQuad to become |
| 874 // clipped. To our knowledge this scenario does not need to be handled d
ifferently than the unclipped case. | 874 // clipped. To our knowledge this scenario does not need to be handled d
ifferently than the unclipped case. |
| 875 } else { | 875 } else { |
| 876 // Move fragment shader transform to vertex shader. We can do this while | |
| 877 // still producing correct results as fragmentTexTransformLocation | |
| 878 // should always be non-negative when tiles are transformed in a way | |
| 879 // that could result in sampling outside the layer. | |
| 880 vertexTexScaleX *= fragmentTexScaleX; | |
| 881 vertexTexScaleY *= fragmentTexScaleY; | |
| 882 vertexTexTranslateX *= fragmentTexScaleX; | |
| 883 vertexTexTranslateY *= fragmentTexScaleY; | |
| 884 vertexTexTranslateX += fragmentTexTranslateX; | |
| 885 vertexTexTranslateY += fragmentTexTranslateY; | |
| 886 | |
| 887 GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation,
vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY)); | 876 GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation,
vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY)); |
| 877 GLC(context(), context()->uniform4f(uniforms.fragmentTexTransformLocatio
n, fragmentTexTranslateX, fragmentTexTranslateY, fragmentTexScaleX, fragmentTexS
caleY)); |
| 888 | 878 |
| 889 localQuad = gfx::RectF(tileRect); | 879 localQuad = gfx::RectF(tileRect); |
| 890 } | 880 } |
| 891 | 881 |
| 892 // Normalize to tileRect. | 882 // Normalize to tileRect. |
| 893 localQuad.Scale(1.0f / tileRect.width(), 1.0f / tileRect.height()); | 883 localQuad.Scale(1.0f / tileRect.width(), 1.0f / tileRect.height()); |
| 894 | 884 |
| 895 setShaderOpacity(quad->opacity(), uniforms.alphaLocation); | 885 setShaderOpacity(quad->opacity(), uniforms.alphaLocation); |
| 896 setShaderQuadF(localQuad, uniforms.pointLocation); | 886 setShaderQuadF(localQuad, uniforms.pointLocation); |
| 897 | 887 |
| (...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1799 | 1789 |
| 1800 releaseRenderPassTextures(); | 1790 releaseRenderPassTextures(); |
| 1801 } | 1791 } |
| 1802 | 1792 |
| 1803 bool GLRenderer::isContextLost() | 1793 bool GLRenderer::isContextLost() |
| 1804 { | 1794 { |
| 1805 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); | 1795 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
| 1806 } | 1796 } |
| 1807 | 1797 |
| 1808 } // namespace cc | 1798 } // namespace cc |
| OLD | NEW |