OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/gl/gl_surface.h" | 5 #include "ui/gl/gl_surface.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 #include "ui/gl/gl_context.h" | 10 #include "ui/gl/gl_context.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 GLImage* image, | 53 GLImage* image, |
54 const Rect& bounds_rect, | 54 const Rect& bounds_rect, |
55 const RectF& crop_rect) override { | 55 const RectF& crop_rect) override { |
56 return image->ScheduleOverlayPlane( | 56 return image->ScheduleOverlayPlane( |
57 widget_, z_order, transform, bounds_rect, crop_rect); | 57 widget_, z_order, transform, bounds_rect, crop_rect); |
58 } | 58 } |
59 | 59 |
60 private: | 60 private: |
61 using NativeViewGLSurfaceEGL::Initialize; | 61 using NativeViewGLSurfaceEGL::Initialize; |
62 | 62 |
63 virtual ~GLSurfaceOzoneEGL() { | 63 ~GLSurfaceOzoneEGL() override { |
64 Destroy(); // EGL surface must be destroyed before SurfaceOzone | 64 Destroy(); // EGL surface must be destroyed before SurfaceOzone |
65 } | 65 } |
66 | 66 |
67 bool ReinitializeNativeSurface() { | 67 bool ReinitializeNativeSurface() { |
68 scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current; | 68 scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current; |
69 GLContext* current_context = GLContext::GetCurrent(); | 69 GLContext* current_context = GLContext::GetCurrent(); |
70 bool was_current = | 70 bool was_current = |
71 current_context && current_context->IsCurrent(this); | 71 current_context && current_context->IsCurrent(this); |
72 if (was_current) { | 72 if (was_current) { |
73 scoped_make_current.reset( | 73 scoped_make_current.reset( |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 bool IsOffscreen() override { return false; } | 137 bool IsOffscreen() override { return false; } |
138 VSyncProvider* GetVSyncProvider() override { return vsync_provider_.get(); } | 138 VSyncProvider* GetVSyncProvider() override { return vsync_provider_.get(); } |
139 bool SupportsPostSubBuffer() override { return true; } | 139 bool SupportsPostSubBuffer() override { return true; } |
140 bool PostSubBuffer(int x, int y, int width, int height) override { | 140 bool PostSubBuffer(int x, int y, int width, int height) override { |
141 // The actual sub buffer handling is handled at higher layers. | 141 // The actual sub buffer handling is handled at higher layers. |
142 SwapBuffers(); | 142 SwapBuffers(); |
143 return true; | 143 return true; |
144 } | 144 } |
145 | 145 |
146 private: | 146 private: |
147 virtual ~GLSurfaceOzoneSurfaceless() { | 147 ~GLSurfaceOzoneSurfaceless() override { |
148 Destroy(); // EGL surface must be destroyed before SurfaceOzone | 148 Destroy(); // EGL surface must be destroyed before SurfaceOzone |
149 } | 149 } |
150 | 150 |
151 // The native surface. Deleting this is allowed to free the EGLNativeWindow. | 151 // The native surface. Deleting this is allowed to free the EGLNativeWindow. |
152 scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface_; | 152 scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface_; |
153 AcceleratedWidget widget_; | 153 AcceleratedWidget widget_; |
154 scoped_ptr<VSyncProvider> vsync_provider_; | 154 scoped_ptr<VSyncProvider> vsync_provider_; |
155 | 155 |
156 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneSurfaceless); | 156 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneSurfaceless); |
157 }; | 157 }; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 NOTREACHED(); | 245 NOTREACHED(); |
246 return NULL; | 246 return NULL; |
247 } | 247 } |
248 } | 248 } |
249 | 249 |
250 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 250 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
251 return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); | 251 return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); |
252 } | 252 } |
253 | 253 |
254 } // namespace gfx | 254 } // namespace gfx |
OLD | NEW |