Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: ui/gl/gl_surface_ozone.cc

Issue 785323005: [ozone] Cleanup virtual/override style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12 matching lines...) Expand all
23 23
24 // A thin wrapper around GLSurfaceEGL that owns the EGLNativeWindow 24 // A thin wrapper around GLSurfaceEGL that owns the EGLNativeWindow
25 class GL_EXPORT GLSurfaceOzoneEGL : public NativeViewGLSurfaceEGL { 25 class GL_EXPORT GLSurfaceOzoneEGL : public NativeViewGLSurfaceEGL {
26 public: 26 public:
27 GLSurfaceOzoneEGL(scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface, 27 GLSurfaceOzoneEGL(scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface,
28 AcceleratedWidget widget) 28 AcceleratedWidget widget)
29 : NativeViewGLSurfaceEGL(ozone_surface->GetNativeWindow()), 29 : NativeViewGLSurfaceEGL(ozone_surface->GetNativeWindow()),
30 ozone_surface_(ozone_surface.Pass()), 30 ozone_surface_(ozone_surface.Pass()),
31 widget_(widget) {} 31 widget_(widget) {}
32 32
33 virtual bool Initialize() override { 33 bool Initialize() override {
34 return Initialize(ozone_surface_->CreateVSyncProvider()); 34 return Initialize(ozone_surface_->CreateVSyncProvider());
35 } 35 }
36 virtual bool Resize(const gfx::Size& size) override { 36 bool Resize(const gfx::Size& size) override {
37 if (!ozone_surface_->ResizeNativeWindow(size)) { 37 if (!ozone_surface_->ResizeNativeWindow(size)) {
38 if (!ReinitializeNativeSurface() || 38 if (!ReinitializeNativeSurface() ||
39 !ozone_surface_->ResizeNativeWindow(size)) 39 !ozone_surface_->ResizeNativeWindow(size))
40 return false; 40 return false;
41 } 41 }
42 42
43 return NativeViewGLSurfaceEGL::Resize(size); 43 return NativeViewGLSurfaceEGL::Resize(size);
44 } 44 }
45 virtual bool SwapBuffers() override { 45 bool SwapBuffers() override {
46 if (!NativeViewGLSurfaceEGL::SwapBuffers()) 46 if (!NativeViewGLSurfaceEGL::SwapBuffers())
47 return false; 47 return false;
48 48
49 return ozone_surface_->OnSwapBuffers(); 49 return ozone_surface_->OnSwapBuffers();
50 } 50 }
51 virtual bool ScheduleOverlayPlane(int z_order, 51 bool ScheduleOverlayPlane(int z_order,
52 OverlayTransform transform, 52 OverlayTransform transform,
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 virtual ~GLSurfaceOzoneEGL() {
64 Destroy(); // EGL surface must be destroyed before SurfaceOzone 64 Destroy(); // EGL surface must be destroyed before SurfaceOzone
65 } 65 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 }; 100 };
101 101
102 class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL { 102 class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL {
103 public: 103 public:
104 GLSurfaceOzoneSurfaceless(scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface, 104 GLSurfaceOzoneSurfaceless(scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface,
105 AcceleratedWidget widget) 105 AcceleratedWidget widget)
106 : SurfacelessEGL(gfx::Size()), 106 : SurfacelessEGL(gfx::Size()),
107 ozone_surface_(ozone_surface.Pass()), 107 ozone_surface_(ozone_surface.Pass()),
108 widget_(widget) {} 108 widget_(widget) {}
109 109
110 virtual bool Initialize() override { 110 bool Initialize() override {
111 if (!SurfacelessEGL::Initialize()) 111 if (!SurfacelessEGL::Initialize())
112 return false; 112 return false;
113 vsync_provider_ = ozone_surface_->CreateVSyncProvider(); 113 vsync_provider_ = ozone_surface_->CreateVSyncProvider();
114 if (!vsync_provider_) 114 if (!vsync_provider_)
115 return false; 115 return false;
116 return true; 116 return true;
117 } 117 }
118 virtual bool Resize(const gfx::Size& size) override { 118 bool Resize(const gfx::Size& size) override {
119 if (!ozone_surface_->ResizeNativeWindow(size)) 119 if (!ozone_surface_->ResizeNativeWindow(size))
120 return false; 120 return false;
121 121
122 return SurfacelessEGL::Resize(size); 122 return SurfacelessEGL::Resize(size);
123 } 123 }
124 virtual bool SwapBuffers() override { 124 bool SwapBuffers() override {
125 // TODO: this should be replaced by a fence when supported by the driver. 125 // TODO: this should be replaced by a fence when supported by the driver.
126 glFlush(); 126 glFlush();
127 return ozone_surface_->OnSwapBuffers(); 127 return ozone_surface_->OnSwapBuffers();
128 } 128 }
129 virtual bool ScheduleOverlayPlane(int z_order, 129 bool ScheduleOverlayPlane(int z_order,
130 OverlayTransform transform, 130 OverlayTransform transform,
131 GLImage* image, 131 GLImage* image,
132 const Rect& bounds_rect, 132 const Rect& bounds_rect,
133 const RectF& crop_rect) override { 133 const RectF& crop_rect) override {
134 return image->ScheduleOverlayPlane( 134 return image->ScheduleOverlayPlane(
135 widget_, z_order, transform, bounds_rect, crop_rect); 135 widget_, z_order, transform, bounds_rect, crop_rect);
136 } 136 }
137 virtual bool IsOffscreen() override { return false; } 137 bool IsOffscreen() override { return false; }
138 virtual VSyncProvider* GetVSyncProvider() override { 138 VSyncProvider* GetVSyncProvider() override { return vsync_provider_.get(); }
139 return vsync_provider_.get(); 139 bool SupportsPostSubBuffer() override { return true; }
140 } 140 bool PostSubBuffer(int x, int y, int width, int height) override {
141 virtual bool SupportsPostSubBuffer() override { return true; }
142 virtual bool PostSubBuffer(int x, int y, int width, int height) override {
143 // The actual sub buffer handling is handled at higher layers. 141 // The actual sub buffer handling is handled at higher layers.
144 SwapBuffers(); 142 SwapBuffers();
145 return true; 143 return true;
146 } 144 }
147 145
148 private: 146 private:
149 virtual ~GLSurfaceOzoneSurfaceless() { 147 virtual ~GLSurfaceOzoneSurfaceless() {
150 Destroy(); // EGL surface must be destroyed before SurfaceOzone 148 Destroy(); // EGL surface must be destroyed before SurfaceOzone
151 } 149 }
152 150
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 NOTREACHED(); 245 NOTREACHED();
248 return NULL; 246 return NULL;
249 } 247 }
250 } 248 }
251 249
252 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { 250 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() {
253 return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); 251 return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay();
254 } 252 }
255 253
256 } // namespace gfx 254 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698