OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/shared_impl/graphics_3d_impl.h" | 5 #include "ppapi/shared_impl/graphics_3d_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 8 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
9 #include "gpu/command_buffer/client/gles2_implementation.h" | 9 #include "gpu/command_buffer/client/gles2_implementation.h" |
10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 int32_t Graphics3DImpl::GetAttribs(int32_t* attrib_list) { | 26 int32_t Graphics3DImpl::GetAttribs(int32_t* attrib_list) { |
27 // TODO(alokp): Implement me. | 27 // TODO(alokp): Implement me. |
28 return PP_ERROR_FAILED; | 28 return PP_ERROR_FAILED; |
29 } | 29 } |
30 | 30 |
31 int32_t Graphics3DImpl::SetAttribs(int32_t* attrib_list) { | 31 int32_t Graphics3DImpl::SetAttribs(int32_t* attrib_list) { |
32 // TODO(alokp): Implement me. | 32 // TODO(alokp): Implement me. |
33 return PP_ERROR_FAILED; | 33 return PP_ERROR_FAILED; |
34 } | 34 } |
35 | 35 |
| 36 int32_t Graphics3DImpl::ResizeBuffers(int32_t width, int32_t height) { |
| 37 if ((width < 0) || (height < 0)) |
| 38 return PP_ERROR_BADARGUMENT; |
| 39 |
| 40 gles2_impl()->ResizeCHROMIUM(width, height); |
| 41 // TODO(alokp): Check if resize succeeded and return appropriate error code. |
| 42 return PP_OK; |
| 43 } |
| 44 |
36 int32_t Graphics3DImpl::SwapBuffers(PP_CompletionCallback callback) { | 45 int32_t Graphics3DImpl::SwapBuffers(PP_CompletionCallback callback) { |
37 if (!callback.func) { | 46 if (!callback.func) { |
38 // Blocking SwapBuffers isn't supported (since we have to be on the main | 47 // Blocking SwapBuffers isn't supported (since we have to be on the main |
39 // thread). | 48 // thread). |
40 return PP_ERROR_BADARGUMENT; | 49 return PP_ERROR_BADARGUMENT; |
41 } | 50 } |
42 | 51 |
43 if (HasPendingSwap()) { | 52 if (HasPendingSwap()) { |
44 // Already a pending SwapBuffers that hasn't returned yet. | 53 // Already a pending SwapBuffers that hasn't returned yet. |
45 return PP_ERROR_INPROGRESS; | 54 return PP_ERROR_INPROGRESS; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 DCHECK(command_buffer); | 105 DCHECK(command_buffer); |
97 command_buffer->DestroyTransferBuffer(transfer_buffer_id_); | 106 command_buffer->DestroyTransferBuffer(transfer_buffer_id_); |
98 transfer_buffer_id_ = -1; | 107 transfer_buffer_id_ = -1; |
99 } | 108 } |
100 | 109 |
101 gles2_helper_.reset(); | 110 gles2_helper_.reset(); |
102 } | 111 } |
103 | 112 |
104 } // namespace ppapi | 113 } // namespace ppapi |
105 | 114 |
OLD | NEW |