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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 return gfx::OVERLAY_TRANSFORM_ROTATE_90; | 167 return gfx::OVERLAY_TRANSFORM_ROTATE_90; |
168 case GL_OVERLAY_TRANSFORM_ROTATE_180_CHROMIUM: | 168 case GL_OVERLAY_TRANSFORM_ROTATE_180_CHROMIUM: |
169 return gfx::OVERLAY_TRANSFORM_ROTATE_180; | 169 return gfx::OVERLAY_TRANSFORM_ROTATE_180; |
170 case GL_OVERLAY_TRANSFORM_ROTATE_270_CHROMIUM: | 170 case GL_OVERLAY_TRANSFORM_ROTATE_270_CHROMIUM: |
171 return gfx::OVERLAY_TRANSFORM_ROTATE_270; | 171 return gfx::OVERLAY_TRANSFORM_ROTATE_270; |
172 default: | 172 default: |
173 return gfx::OVERLAY_TRANSFORM_INVALID; | 173 return gfx::OVERLAY_TRANSFORM_INVALID; |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
| 177 gfx::BufferFormat GetGFXOverlayStorageFormat(GLuint storage_format) { |
| 178 switch (storage_format) { |
| 179 case GL_BGR: |
| 180 return gfx::BufferFormat::BGRX_8888; |
| 181 case GL_BGRA_EXT: |
| 182 return gfx::BufferFormat::BGRA_8888; |
| 183 case GL_RGB_YCBCR_422_CHROMIUM: |
| 184 return gfx::BufferFormat::UYVY_422; |
| 185 default: |
| 186 NOTREACHED(); |
| 187 return gfx::BufferFormat::BGRX_8888; |
| 188 } |
| 189 } |
| 190 |
177 template <typename MANAGER_TYPE, typename OBJECT_TYPE> | 191 template <typename MANAGER_TYPE, typename OBJECT_TYPE> |
178 GLuint GetClientId(const MANAGER_TYPE* manager, const OBJECT_TYPE* object) { | 192 GLuint GetClientId(const MANAGER_TYPE* manager, const OBJECT_TYPE* object) { |
179 DCHECK(manager); | 193 DCHECK(manager); |
180 GLuint client_id = 0; | 194 GLuint client_id = 0; |
181 if (object) { | 195 if (object) { |
182 manager->GetClientId(object->service_id(), &client_id); | 196 manager->GetClientId(object->service_id(), &client_id); |
183 } | 197 } |
184 return client_id; | 198 return client_id; |
185 } | 199 } |
186 | 200 |
(...skipping 9390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9577 gfx::OverlayTransform transform = GetGFXOverlayTransform(c.plane_transform); | 9591 gfx::OverlayTransform transform = GetGFXOverlayTransform(c.plane_transform); |
9578 if (transform == gfx::OVERLAY_TRANSFORM_INVALID) { | 9592 if (transform == gfx::OVERLAY_TRANSFORM_INVALID) { |
9579 LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, | 9593 LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, |
9580 "glScheduleOverlayPlaneCHROMIUM", | 9594 "glScheduleOverlayPlaneCHROMIUM", |
9581 "invalid transform enum"); | 9595 "invalid transform enum"); |
9582 return error::kNoError; | 9596 return error::kNoError; |
9583 } | 9597 } |
9584 if (!surface_->ScheduleOverlayPlane( | 9598 if (!surface_->ScheduleOverlayPlane( |
9585 c.plane_z_order, | 9599 c.plane_z_order, |
9586 transform, | 9600 transform, |
| 9601 GetGFXOverlayStorageFormat(c.storage_format), |
9587 image, | 9602 image, |
9588 gfx::Rect(c.bounds_x, c.bounds_y, c.bounds_width, c.bounds_height), | 9603 gfx::Rect(c.bounds_x, c.bounds_y, c.bounds_width, c.bounds_height), |
9589 gfx::RectF(c.uv_x, c.uv_y, c.uv_width, c.uv_height))) { | 9604 gfx::RectF(c.uv_x, c.uv_y, c.uv_width, c.uv_height), |
| 9605 static_cast<GLboolean>(c.handle_scaling))) { |
9590 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, | 9606 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
9591 "glScheduleOverlayPlaneCHROMIUM", | 9607 "glScheduleOverlayPlaneCHROMIUM", |
9592 "failed to schedule overlay"); | 9608 "failed to schedule overlay"); |
9593 } | 9609 } |
9594 return error::kNoError; | 9610 return error::kNoError; |
9595 } | 9611 } |
9596 | 9612 |
9597 error::Error GLES2DecoderImpl::HandleScheduleCALayerCHROMIUM( | 9613 error::Error GLES2DecoderImpl::HandleScheduleCALayerCHROMIUM( |
9598 uint32 immediate_data_size, | 9614 uint32 immediate_data_size, |
9599 const void* cmd_data) { | 9615 const void* cmd_data) { |
(...skipping 6185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15785 return error::kNoError; | 15801 return error::kNoError; |
15786 } | 15802 } |
15787 | 15803 |
15788 // Include the auto-generated part of this file. We split this because it means | 15804 // Include the auto-generated part of this file. We split this because it means |
15789 // we can easily edit the non-auto generated parts right here in this file | 15805 // we can easily edit the non-auto generated parts right here in this file |
15790 // instead of having to edit some template or the code generator. | 15806 // instead of having to edit some template or the code generator. |
15791 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15807 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
15792 | 15808 |
15793 } // namespace gles2 | 15809 } // namespace gles2 |
15794 } // namespace gpu | 15810 } // namespace gpu |
OLD | NEW |