Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // A class to emulate GLES2 over command buffers. | 5 // A class to emulate GLES2 over command buffers. |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 2819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2830 sub_buffer.height()); | 2830 sub_buffer.height()); |
| 2831 gpu_control_->Echo(base::Bind(&GLES2Implementation::OnSwapBuffersComplete, | 2831 gpu_control_->Echo(base::Bind(&GLES2Implementation::OnSwapBuffersComplete, |
| 2832 weak_ptr_factory_.GetWeakPtr())); | 2832 weak_ptr_factory_.GetWeakPtr())); |
| 2833 } | 2833 } |
| 2834 | 2834 |
| 2835 void GLES2Implementation::SetSwapBuffersCompleteCallback( | 2835 void GLES2Implementation::SetSwapBuffersCompleteCallback( |
| 2836 const base::Closure& swap_buffers_complete_callback) { | 2836 const base::Closure& swap_buffers_complete_callback) { |
| 2837 swap_buffers_complete_callback_ = swap_buffers_complete_callback; | 2837 swap_buffers_complete_callback_ = swap_buffers_complete_callback; |
| 2838 } | 2838 } |
| 2839 | 2839 |
| 2840 static GLenum GetGLESOverlayTransform(gfx::OverlayTransform plane_transform) { | |
| 2841 switch (plane_transform) { | |
| 2842 case gfx::OVERLAY_TRANSFORM_INVALID: | |
|
piman
2014/04/08 21:30:54
nit: case should be indented to. (git cl format is
alexst (slow to review)
2014/04/09 14:19:22
Thanks for catching, I always run it, just forgot
| |
| 2843 break; | |
| 2844 case gfx::OVERLAY_TRANSFORM_NONE: | |
| 2845 return GL_OVERLAY_TRANSFORM_NONE_CHROMIUM; | |
| 2846 case gfx::OVERLAY_TRANSFORM_FLIP_HORIZONTAL: | |
| 2847 return GL_OVERLAY_TRANSFORM_FLIP_HORIZONTAL_CHROMIUM; | |
| 2848 case gfx::OVERLAY_TRANSFORM_FLIP_VERTICAL: | |
| 2849 return GL_OVERLAY_TRANSFORM_FLIP_VERTICAL_CHROMIUM; | |
| 2850 case gfx::OVERLAY_TRANSFORM_ROTATE_90: | |
| 2851 return GL_OVERLAY_TRANSFORM_ROTATE_90_CHROMIUM; | |
| 2852 case gfx::OVERLAY_TRANSFORM_ROTATE_180: | |
| 2853 return GL_OVERLAY_TRANSFORM_ROTATE_180_CHROMIUM; | |
| 2854 case gfx::OVERLAY_TRANSFORM_ROTATE_270: | |
| 2855 return GL_OVERLAY_TRANSFORM_ROTATE_270_CHROMIUM; | |
| 2856 } | |
| 2857 NOTREACHED(); | |
| 2858 return GL_OVERLAY_TRANSFORM_NONE_CHROMIUM; | |
| 2859 } | |
| 2860 | |
| 2840 void GLES2Implementation::ScheduleOverlayPlane( | 2861 void GLES2Implementation::ScheduleOverlayPlane( |
| 2841 int plane_z_order, | 2862 int plane_z_order, |
| 2842 gfx::OverlayTransform plane_transform, | 2863 gfx::OverlayTransform plane_transform, |
| 2843 unsigned overlay_texture_id, | 2864 unsigned overlay_texture_id, |
| 2844 const gfx::Rect& display_bounds, | 2865 const gfx::Rect& display_bounds, |
| 2845 const gfx::RectF& uv_rect) { | 2866 const gfx::RectF& uv_rect) { |
| 2846 NOTREACHED() << "Overlay supported isn't finished."; | 2867 ScheduleOverlayPlaneCHROMIUM(plane_z_order, |
| 2868 GetGLESOverlayTransform(plane_transform), | |
| 2869 overlay_texture_id, | |
| 2870 display_bounds.x(), | |
| 2871 display_bounds.y(), | |
| 2872 display_bounds.width(), | |
| 2873 display_bounds.height(), | |
| 2874 uv_rect.x(), | |
| 2875 uv_rect.y(), | |
| 2876 uv_rect.width(), | |
| 2877 uv_rect.height()); | |
| 2847 } | 2878 } |
| 2848 | 2879 |
| 2849 void GLES2Implementation::OnSwapBuffersComplete() { | 2880 void GLES2Implementation::OnSwapBuffersComplete() { |
| 2850 if (!swap_buffers_complete_callback_.is_null()) | 2881 if (!swap_buffers_complete_callback_.is_null()) |
| 2851 swap_buffers_complete_callback_.Run(); | 2882 swap_buffers_complete_callback_.Run(); |
| 2852 } | 2883 } |
| 2853 | 2884 |
| 2854 GLboolean GLES2Implementation::EnableFeatureCHROMIUM( | 2885 GLboolean GLES2Implementation::EnableFeatureCHROMIUM( |
| 2855 const char* feature) { | 2886 const char* feature) { |
| 2856 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 2887 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| (...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4066 CheckGLError(); | 4097 CheckGLError(); |
| 4067 } | 4098 } |
| 4068 | 4099 |
| 4069 // Include the auto-generated part of this file. We split this because it means | 4100 // Include the auto-generated part of this file. We split this because it means |
| 4070 // we can easily edit the non-auto generated parts right here in this file | 4101 // we can easily edit the non-auto generated parts right here in this file |
| 4071 // instead of having to edit some template or the code generator. | 4102 // instead of having to edit some template or the code generator. |
| 4072 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 4103 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 4073 | 4104 |
| 4074 } // namespace gles2 | 4105 } // namespace gles2 |
| 4075 } // namespace gpu | 4106 } // namespace gpu |
| OLD | NEW |