| 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 "ppapi/shared_impl/ppb_graphics_3d_shared.h" | 5 #include "ppapi/shared_impl/ppb_graphics_3d_shared.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 "gpu/command_buffer/client/shared_memory_limits.h" | 10 #include "gpu/command_buffer/client/shared_memory_limits.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 int32_t PPB_Graphics3D_Shared::GetError() { | 44 int32_t PPB_Graphics3D_Shared::GetError() { |
| 45 // TODO(alokp): Implement me. | 45 // TODO(alokp): Implement me. |
| 46 return PP_ERROR_FAILED; | 46 return PP_ERROR_FAILED; |
| 47 } | 47 } |
| 48 | 48 |
| 49 int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) { | 49 int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) { |
| 50 if ((width < 0) || (height < 0)) | 50 if ((width < 0) || (height < 0)) |
| 51 return PP_ERROR_BADARGUMENT; | 51 return PP_ERROR_BADARGUMENT; |
| 52 | 52 |
| 53 gles2_impl()->ResizeCHROMIUM(width, height, 1.f, true); | 53 gles2_impl()->ResizeCHROMIUM(width, height, 1.f, true); |
| 54 SetSize(width, height); |
| 54 // TODO(alokp): Check if resize succeeded and return appropriate error code. | 55 // TODO(alokp): Check if resize succeeded and return appropriate error code. |
| 55 return PP_OK; | 56 return PP_OK; |
| 56 } | 57 } |
| 57 | 58 |
| 58 int32_t PPB_Graphics3D_Shared::SwapBuffers( | 59 int32_t PPB_Graphics3D_Shared::SwapBuffers( |
| 59 scoped_refptr<TrackedCallback> callback) { | 60 scoped_refptr<TrackedCallback> callback) { |
| 60 return SwapBuffersWithSyncToken(callback, gpu::SyncToken()); | 61 return SwapBuffersWithSyncToken(callback, gpu::SyncToken()); |
| 61 } | 62 } |
| 62 | 63 |
| 63 int32_t PPB_Graphics3D_Shared::SwapBuffersWithSyncToken( | 64 int32_t PPB_Graphics3D_Shared::SwapBuffersWithSyncToken( |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 155 |
| 155 return true; | 156 return true; |
| 156 } | 157 } |
| 157 | 158 |
| 158 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { | 159 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { |
| 159 gles2_impl_.reset(); | 160 gles2_impl_.reset(); |
| 160 transfer_buffer_.reset(); | 161 transfer_buffer_.reset(); |
| 161 gles2_helper_.reset(); | 162 gles2_helper_.reset(); |
| 162 } | 163 } |
| 163 | 164 |
| 165 void PPB_Graphics3D_Shared::SetSize(int32_t width, int32_t height) { |
| 166 width_ = width; |
| 167 height_ = height; |
| 168 } |
| 169 |
| 164 } // namespace ppapi | 170 } // namespace ppapi |
| OLD | NEW |