OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/ozone/platform/cast/surface_ozone_egl_cast.h" | |
6 | |
7 #include "third_party/khronos/EGL/egl.h" | |
8 #include "ui/gfx/vsync_provider.h" | |
9 #include "ui/ozone/common/egl_util.h" | |
10 #include "ui/ozone/platform/cast/surface_factory_cast.h" | |
11 | |
12 namespace ui { | |
13 | |
14 SurfaceOzoneEglCast::~SurfaceOzoneEglCast() { | |
15 parent_->ChildDestroyed(); | |
16 } | |
17 | |
18 intptr_t SurfaceOzoneEglCast::GetNativeWindow() { | |
19 return reinterpret_cast<intptr_t>(parent_->GetNativeWindow()); | |
20 } | |
21 | |
22 bool SurfaceOzoneEglCast::OnSwapBuffers() { | |
23 parent_->OnSwapBuffers(); | |
24 return true; | |
25 } | |
26 | |
27 void SurfaceOzoneEglCast::OnSwapBuffersAsync( | |
28 const SwapCompletionCallback& callback) { | |
29 parent_->OnSwapBuffers(); | |
30 callback.Run(gfx::SwapResult::SWAP_ACK); | |
31 } | |
32 | |
33 bool SurfaceOzoneEglCast::ResizeNativeWindow(const gfx::Size& viewport_size) { | |
34 return parent_->ResizeDisplay(viewport_size); | |
35 } | |
36 | |
37 std::unique_ptr<gfx::VSyncProvider> SurfaceOzoneEglCast::CreateVSyncProvider() { | |
38 return nullptr; | |
39 } | |
40 | |
41 void* /* EGLConfig */ SurfaceOzoneEglCast::GetEGLSurfaceConfig( | |
42 const EglConfigCallbacks& egl) { | |
43 EGLint config_attribs[] = {EGL_BUFFER_SIZE, | |
44 32, | |
45 EGL_ALPHA_SIZE, | |
46 8, | |
47 EGL_BLUE_SIZE, | |
48 8, | |
49 EGL_GREEN_SIZE, | |
50 8, | |
51 EGL_RED_SIZE, | |
52 8, | |
53 EGL_RENDERABLE_TYPE, | |
54 EGL_OPENGL_ES2_BIT, | |
55 EGL_SURFACE_TYPE, | |
56 EGL_WINDOW_BIT, | |
57 EGL_NONE}; | |
58 return ChooseEGLConfig(egl, config_attribs); | |
59 } | |
60 | |
61 } // namespace ui | |
OLD | NEW |