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/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1811 // Generate the transform matrix | 1811 // Generate the transform matrix |
1812 gfx::Transform quad_rect_matrix; | 1812 gfx::Transform quad_rect_matrix; |
1813 QuadRectTransform(&quad_rect_matrix, quad->quadTransform(), quad->rect); | 1813 QuadRectTransform(&quad_rect_matrix, quad->quadTransform(), quad->rect); |
1814 quad_rect_matrix = frame->projection_matrix * quad_rect_matrix; | 1814 quad_rect_matrix = frame->projection_matrix * quad_rect_matrix; |
1815 | 1815 |
1816 Float16 m; | 1816 Float16 m; |
1817 quad_rect_matrix.matrix().asColMajorf(m.data); | 1817 quad_rect_matrix.matrix().asColMajorf(m.data); |
1818 draw_cache_.matrix_data.push_back(m); | 1818 draw_cache_.matrix_data.push_back(m); |
1819 } | 1819 } |
1820 | 1820 |
1821 void GLRenderer::DrawTextureQuad(const DrawingFrame* frame, | |
1822 const TextureDrawQuad* quad) { | |
1823 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | |
1824 context_, &highp_threshold_cache_, highp_threshold_min_, | |
1825 quad->shared_quad_state->visible_content_rect.bottom_right()); | |
1826 | |
1827 TexTransformTextureProgramBinding binding; | |
1828 if (quad->premultiplied_alpha) { | |
1829 binding.Set(GetTextureProgram(tex_coord_precision), Context()); | |
1830 } else { | |
1831 binding.Set(GetNonPremultipliedTextureProgram(tex_coord_precision), | |
1832 Context()); | |
1833 } | |
1834 SetUseProgram(binding.program_id); | |
1835 GLC(Context(), Context()->uniform1i(binding.sampler_location, 0)); | |
1836 Float4 uv_xform = UVTransform(quad); | |
1837 GLC(Context(), | |
1838 Context()->uniform4f(binding.tex_transform_location, | |
1839 uv_xform.data[0], | |
1840 uv_xform.data[1], | |
1841 uv_xform.data[2], | |
1842 uv_xform.data[3])); | |
1843 | |
1844 GLC(Context(), | |
1845 Context()->uniform1fv( | |
1846 binding.vertex_opacity_location, 4, quad->vertex_opacity)); | |
1847 | |
1848 ResourceProvider::ScopedSamplerGL quad_resource_lock( | |
1849 resource_provider_, quad->resource_id, GL_TEXTURE_2D, GL_LINEAR); | |
1850 | |
1851 DrawQuadGeometry( | |
1852 frame, quad->quadTransform(), quad->rect, binding.matrix_location); | |
1853 } | |
1854 | |
1855 void GLRenderer::DrawIOSurfaceQuad(const DrawingFrame* frame, | 1821 void GLRenderer::DrawIOSurfaceQuad(const DrawingFrame* frame, |
1856 const IOSurfaceDrawQuad* quad) { | 1822 const IOSurfaceDrawQuad* quad) { |
1857 SetBlendEnabled(quad->ShouldDrawWithBlending()); | 1823 SetBlendEnabled(quad->ShouldDrawWithBlending()); |
1858 | 1824 |
1859 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 1825 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
1860 context_, &highp_threshold_cache_, highp_threshold_min_, | 1826 context_, &highp_threshold_cache_, highp_threshold_min_, |
1861 quad->shared_quad_state->visible_content_rect.bottom_right()); | 1827 quad->shared_quad_state->visible_content_rect.bottom_right()); |
1862 | 1828 |
1863 TexTransformTextureProgramBinding binding; | 1829 TexTransformTextureProgramBinding binding; |
1864 binding.Set(GetTextureIOSurfaceProgram(tex_coord_precision), Context()); | 1830 binding.Set(GetTextureIOSurfaceProgram(tex_coord_precision), Context()); |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3046 std::string unique_context_name = base::StringPrintf( | 3012 std::string unique_context_name = base::StringPrintf( |
3047 "%s-Offscreen-%p", | 3013 "%s-Offscreen-%p", |
3048 Settings().compositor_name.c_str(), | 3014 Settings().compositor_name.c_str(), |
3049 context_); | 3015 context_); |
3050 resource_provider()->offscreen_context_provider()->Context3d()-> | 3016 resource_provider()->offscreen_context_provider()->Context3d()-> |
3051 pushGroupMarkerEXT(unique_context_name.c_str()); | 3017 pushGroupMarkerEXT(unique_context_name.c_str()); |
3052 } | 3018 } |
3053 | 3019 |
3054 | 3020 |
3055 } // namespace cc | 3021 } // namespace cc |
OLD | NEW |