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 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 DCHECK_NE(shader_mask_tex_coord_offset_location, 1); | 1004 DCHECK_NE(shader_mask_tex_coord_offset_location, 1); |
1005 GLC(Context(), Context()->uniform1i(shader_mask_sampler_location, 1)); | 1005 GLC(Context(), Context()->uniform1i(shader_mask_sampler_location, 1)); |
1006 | 1006 |
1007 float mask_tex_scale_x = quad->mask_uv_rect.width() / tex_scale_x; | 1007 float mask_tex_scale_x = quad->mask_uv_rect.width() / tex_scale_x; |
1008 float mask_tex_scale_y = quad->mask_uv_rect.height() / tex_scale_y; | 1008 float mask_tex_scale_y = quad->mask_uv_rect.height() / tex_scale_y; |
1009 | 1009 |
1010 // Mask textures are oriented vertically flipped relative to the framebuffer | 1010 // Mask textures are oriented vertically flipped relative to the framebuffer |
1011 // and the RenderPass contents texture, so we flip the tex coords from the | 1011 // and the RenderPass contents texture, so we flip the tex coords from the |
1012 // RenderPass texture to find the mask texture coords. | 1012 // RenderPass texture to find the mask texture coords. |
1013 GLC(Context(), | 1013 GLC(Context(), |
1014 Context()->uniform2f(shader_mask_tex_coord_offset_location, | 1014 Context()->uniform2f( |
1015 quad->mask_uv_rect.x(), | 1015 shader_mask_tex_coord_offset_location, |
1016 quad->mask_uv_rect.y() + mask_tex_scale_y)); | 1016 quad->mask_uv_rect.x(), |
| 1017 quad->mask_uv_rect.y() + quad->mask_uv_rect.height())); |
1017 GLC(Context(), | 1018 GLC(Context(), |
1018 Context()->uniform2f(shader_mask_tex_coord_scale_location, | 1019 Context()->uniform2f(shader_mask_tex_coord_scale_location, |
1019 mask_tex_scale_x, | 1020 mask_tex_scale_x, |
1020 -mask_tex_scale_y)); | 1021 -mask_tex_scale_y)); |
1021 shader_mask_sampler_lock = make_scoped_ptr( | 1022 shader_mask_sampler_lock = make_scoped_ptr( |
1022 new ResourceProvider::ScopedSamplerGL(resource_provider_, | 1023 new ResourceProvider::ScopedSamplerGL(resource_provider_, |
1023 quad->mask_resource_id, | 1024 quad->mask_resource_id, |
1024 GL_TEXTURE_2D, | 1025 GL_TEXTURE_2D, |
1025 GL_TEXTURE1, | 1026 GL_TEXTURE1, |
1026 GL_LINEAR)); | 1027 GL_LINEAR)); |
(...skipping 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3088 // The Skia GPU backend requires a stencil buffer. See ReinitializeGrCanvas | 3089 // The Skia GPU backend requires a stencil buffer. See ReinitializeGrCanvas |
3089 // implementation. | 3090 // implementation. |
3090 return gr_context_ && context_->getContextAttributes().stencil; | 3091 return gr_context_ && context_->getContextAttributes().stencil; |
3091 } | 3092 } |
3092 | 3093 |
3093 bool GLRenderer::IsContextLost() { | 3094 bool GLRenderer::IsContextLost() { |
3094 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); | 3095 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); |
3095 } | 3096 } |
3096 | 3097 |
3097 } // namespace cc | 3098 } // namespace cc |
OLD | NEW |