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 <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
(...skipping 4397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4408 return GL_OVERLAY_TRANSFORM_ROTATE_90_CHROMIUM; | 4408 return GL_OVERLAY_TRANSFORM_ROTATE_90_CHROMIUM; |
4409 case gfx::OVERLAY_TRANSFORM_ROTATE_180: | 4409 case gfx::OVERLAY_TRANSFORM_ROTATE_180: |
4410 return GL_OVERLAY_TRANSFORM_ROTATE_180_CHROMIUM; | 4410 return GL_OVERLAY_TRANSFORM_ROTATE_180_CHROMIUM; |
4411 case gfx::OVERLAY_TRANSFORM_ROTATE_270: | 4411 case gfx::OVERLAY_TRANSFORM_ROTATE_270: |
4412 return GL_OVERLAY_TRANSFORM_ROTATE_270_CHROMIUM; | 4412 return GL_OVERLAY_TRANSFORM_ROTATE_270_CHROMIUM; |
4413 } | 4413 } |
4414 NOTREACHED(); | 4414 NOTREACHED(); |
4415 return GL_OVERLAY_TRANSFORM_NONE_CHROMIUM; | 4415 return GL_OVERLAY_TRANSFORM_NONE_CHROMIUM; |
4416 } | 4416 } |
4417 | 4417 |
| 4418 static GLuint GetGLESOverlayFormat(gfx::BufferFormat storage_format) { |
| 4419 switch (storage_format) { |
| 4420 case gfx::BufferFormat::BGRX_8888: |
| 4421 return GL_BGR; |
| 4422 case gfx::BufferFormat::BGRA_8888: |
| 4423 return GL_BGRA_EXT; |
| 4424 case gfx::BufferFormat::UYVY_422: |
| 4425 return GL_RGB_YCBCR_422_CHROMIUM; |
| 4426 default: |
| 4427 NOTREACHED(); |
| 4428 return GL_BGRA_EXT; |
| 4429 } |
| 4430 } |
| 4431 |
4418 void GLES2Implementation::ScheduleOverlayPlane( | 4432 void GLES2Implementation::ScheduleOverlayPlane( |
4419 int plane_z_order, | 4433 int plane_z_order, |
4420 gfx::OverlayTransform plane_transform, | 4434 gfx::OverlayTransform plane_transform, |
| 4435 gfx::BufferFormat optimal_storage_format, |
4421 unsigned overlay_texture_id, | 4436 unsigned overlay_texture_id, |
4422 const gfx::Rect& display_bounds, | 4437 const gfx::Rect& display_bounds, |
4423 const gfx::RectF& uv_rect) { | 4438 const gfx::RectF& uv_rect, |
| 4439 bool handle_scaling) { |
4424 ScheduleOverlayPlaneCHROMIUM(plane_z_order, | 4440 ScheduleOverlayPlaneCHROMIUM(plane_z_order, |
4425 GetGLESOverlayTransform(plane_transform), | 4441 GetGLESOverlayTransform(plane_transform), |
| 4442 GetGLESOverlayFormat(optimal_storage_format), |
4426 overlay_texture_id, | 4443 overlay_texture_id, |
4427 display_bounds.x(), | 4444 display_bounds.x(), |
4428 display_bounds.y(), | 4445 display_bounds.y(), |
4429 display_bounds.width(), | 4446 display_bounds.width(), |
4430 display_bounds.height(), | 4447 display_bounds.height(), |
4431 uv_rect.x(), | 4448 uv_rect.x(), |
4432 uv_rect.y(), | 4449 uv_rect.y(), |
4433 uv_rect.width(), | 4450 uv_rect.width(), |
4434 uv_rect.height()); | 4451 uv_rect.height(), |
| 4452 handle_scaling); |
4435 } | 4453 } |
4436 | 4454 |
4437 void GLES2Implementation::ScheduleCALayerCHROMIUM(GLuint contents_texture_id, | 4455 void GLES2Implementation::ScheduleCALayerCHROMIUM(GLuint contents_texture_id, |
4438 const GLfloat* contents_rect, | 4456 const GLfloat* contents_rect, |
4439 GLfloat opacity, | 4457 GLfloat opacity, |
4440 GLuint background_color, | 4458 GLuint background_color, |
4441 const GLfloat* bounds_size, | 4459 const GLfloat* bounds_size, |
4442 const GLfloat* transform) { | 4460 const GLfloat* transform) { |
4443 size_t shm_size = 22 * sizeof(GLfloat); | 4461 size_t shm_size = 22 * sizeof(GLfloat); |
4444 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_); | 4462 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_); |
(...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6539 CheckGLError(); | 6557 CheckGLError(); |
6540 } | 6558 } |
6541 | 6559 |
6542 // Include the auto-generated part of this file. We split this because it means | 6560 // Include the auto-generated part of this file. We split this because it means |
6543 // we can easily edit the non-auto generated parts right here in this file | 6561 // we can easily edit the non-auto generated parts right here in this file |
6544 // instead of having to edit some template or the code generator. | 6562 // instead of having to edit some template or the code generator. |
6545 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6563 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
6546 | 6564 |
6547 } // namespace gles2 | 6565 } // namespace gles2 |
6548 } // namespace gpu | 6566 } // namespace gpu |
OLD | NEW |