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 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 // Map device space quad to local space. deviceTransform has no 3d compo
nent since it was flattened, so we don't need to project. | 885 // Map device space quad to local space. deviceTransform has no 3d compo
nent since it was flattened, so we don't need to project. |
886 // We should have already checked that the transform was uninvertible ab
ove. | 886 // We should have already checked that the transform was uninvertible ab
ove. |
887 gfx::Transform inverseDeviceTransform(gfx::Transform::kSkipInitializatio
n); | 887 gfx::Transform inverseDeviceTransform(gfx::Transform::kSkipInitializatio
n); |
888 bool didInvert = deviceTransform.GetInverse(&inverseDeviceTransform); | 888 bool didInvert = deviceTransform.GetInverse(&inverseDeviceTransform); |
889 DCHECK(didInvert); | 889 DCHECK(didInvert); |
890 localQuad = MathUtil::mapQuad(inverseDeviceTransform, deviceQuad.ToQuadF
(), clipped); | 890 localQuad = MathUtil::mapQuad(inverseDeviceTransform, deviceQuad.ToQuadF
(), clipped); |
891 | 891 |
892 // We should not DCHECK(!clipped) here, because anti-aliasing inflation
may cause deviceQuad to become | 892 // We should not DCHECK(!clipped) here, because anti-aliasing inflation
may cause deviceQuad to become |
893 // clipped. To our knowledge this scenario does not need to be handled d
ifferently than the unclipped case. | 893 // clipped. To our knowledge this scenario does not need to be handled d
ifferently than the unclipped case. |
894 } else { | 894 } else { |
| 895 // Move fragment shader transform to vertex shader. We can do this while |
| 896 // still producing correct results as fragmentTexTransformLocation |
| 897 // should always be non-negative when tiles are transformed in a way |
| 898 // that could result in sampling outside the layer. |
| 899 vertexTexScaleX *= fragmentTexScaleX; |
| 900 vertexTexScaleY *= fragmentTexScaleY; |
| 901 vertexTexTranslateX *= fragmentTexScaleX; |
| 902 vertexTexTranslateY *= fragmentTexScaleY; |
| 903 vertexTexTranslateX += fragmentTexTranslateX; |
| 904 vertexTexTranslateY += fragmentTexTranslateY; |
| 905 |
895 GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation,
vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY)); | 906 GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation,
vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY)); |
896 GLC(context(), context()->uniform4f(uniforms.fragmentTexTransformLocatio
n, fragmentTexTranslateX, fragmentTexTranslateY, fragmentTexScaleX, fragmentTexS
caleY)); | |
897 | 907 |
898 localQuad = gfx::RectF(tileRect); | 908 localQuad = gfx::RectF(tileRect); |
899 } | 909 } |
900 | 910 |
901 // Normalize to tileRect. | 911 // Normalize to tileRect. |
902 localQuad.Scale(1.0f / tileRect.width(), 1.0f / tileRect.height()); | 912 localQuad.Scale(1.0f / tileRect.width(), 1.0f / tileRect.height()); |
903 | 913 |
904 setShaderOpacity(quad->opacity(), uniforms.alphaLocation); | 914 setShaderOpacity(quad->opacity(), uniforms.alphaLocation); |
905 setShaderQuadF(localQuad, uniforms.pointLocation); | 915 setShaderQuadF(localQuad, uniforms.pointLocation); |
906 | 916 |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1813 | 1823 |
1814 releaseRenderPassTextures(); | 1824 releaseRenderPassTextures(); |
1815 } | 1825 } |
1816 | 1826 |
1817 bool GLRenderer::isContextLost() | 1827 bool GLRenderer::isContextLost() |
1818 { | 1828 { |
1819 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); | 1829 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
1820 } | 1830 } |
1821 | 1831 |
1822 } // namespace cc | 1832 } // namespace cc |
OLD | NEW |