OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/ozone/platform/cast/gl_surface_cast.h" | 5 #include "ui/ozone/platform/cast/gl_surface_cast.h" |
6 | 6 |
7 #include "ui/ozone/common/egl_util.h" | 7 #include "ui/ozone/common/egl_util.h" |
8 #include "ui/ozone/platform/cast/surface_factory_cast.h" | 8 #include "ui/ozone/platform/cast/surface_factory_cast.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
11 | 11 |
12 GLSurfaceCast::GLSurfaceCast(gfx::AcceleratedWidget widget, | 12 GLSurfaceCast::GLSurfaceCast(gfx::AcceleratedWidget widget, |
13 SurfaceFactoryCast* parent) | 13 SurfaceFactoryCast* parent) |
14 : NativeViewGLSurfaceEGL(parent->GetNativeWindow()), | 14 : NativeViewGLSurfaceEGL(parent->GetNativeWindow()), |
15 widget_(widget), | 15 widget_(widget), |
16 parent_(parent) { | 16 parent_(parent) { |
17 DCHECK(parent_); | 17 DCHECK(parent_); |
18 } | 18 } |
19 | 19 |
20 gfx::SwapResult GLSurfaceCast::SwapBuffers() { | 20 gfx::SwapResult GLSurfaceCast::SwapBuffers() { |
21 gfx::SwapResult result = NativeViewGLSurfaceEGL::SwapBuffers(); | 21 gfx::SwapResult result = NativeViewGLSurfaceEGL::SwapBuffers(); |
22 if (result == gfx::SwapResult::SWAP_ACK) | 22 if (result == gfx::SwapResult::SWAP_ACK) |
23 parent_->OnSwapBuffers(); | 23 parent_->OnSwapBuffers(); |
24 | 24 |
25 return result; | 25 return result; |
26 } | 26 } |
27 | 27 |
| 28 gfx::SwapResult GLSurfaceCast::SwapBuffersWithDamage(int x, |
| 29 int y, |
| 30 int width, |
| 31 int height) { |
| 32 gfx::SwapResult result = |
| 33 NativeViewGLSurfaceEGL::SwapBuffersWithDamage(x, y, width, height); |
| 34 if (result == gfx::SwapResult::SWAP_ACK) |
| 35 parent_->OnSwapBuffers(); |
| 36 |
| 37 return result; |
| 38 } |
| 39 |
28 bool GLSurfaceCast::Resize(const gfx::Size& size, | 40 bool GLSurfaceCast::Resize(const gfx::Size& size, |
29 float scale_factor, | 41 float scale_factor, |
30 bool has_alpha) { | 42 bool has_alpha) { |
31 return parent_->ResizeDisplay(size) && | 43 return parent_->ResizeDisplay(size) && |
32 NativeViewGLSurfaceEGL::Resize(size, scale_factor, has_alpha); | 44 NativeViewGLSurfaceEGL::Resize(size, scale_factor, has_alpha); |
33 } | 45 } |
34 | 46 |
35 bool GLSurfaceCast::ScheduleOverlayPlane(int z_order, | 47 bool GLSurfaceCast::ScheduleOverlayPlane(int z_order, |
36 gfx::OverlayTransform transform, | 48 gfx::OverlayTransform transform, |
37 gl::GLImage* image, | 49 gl::GLImage* image, |
(...skipping 24 matching lines...) Expand all Loading... |
62 } | 74 } |
63 return config_; | 75 return config_; |
64 } | 76 } |
65 | 77 |
66 GLSurfaceCast::~GLSurfaceCast() { | 78 GLSurfaceCast::~GLSurfaceCast() { |
67 Destroy(); | 79 Destroy(); |
68 parent_->ChildDestroyed(); | 80 parent_->ChildDestroyed(); |
69 } | 81 } |
70 | 82 |
71 } // namespace ui | 83 } // namespace ui |
OLD | NEW |