Index: ui/gl/gl_surface_ozone.cc |
diff --git a/ui/gl/gl_surface_ozone.cc b/ui/gl/gl_surface_ozone.cc |
index d71867cf53e48091efd5d18fa6d5ae694840a0a9..7ca5ab1f4b30b937f3f92059b327e2282b52ddac 100644 |
--- a/ui/gl/gl_surface_ozone.cc |
+++ b/ui/gl/gl_surface_ozone.cc |
@@ -89,7 +89,6 @@ class GL_EXPORT GLSurfaceOzoneEGL : public NativeViewGLSurfaceEGL { |
return true; |
} |
- |
// The native surface. Deleting this is allowed to free the EGLNativeWindow. |
scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface_; |
AcceleratedWidget widget_; |
@@ -97,6 +96,42 @@ class GL_EXPORT GLSurfaceOzoneEGL : public NativeViewGLSurfaceEGL { |
DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneEGL); |
}; |
+class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL { |
+ public: |
+ GLSurfaceOzoneSurfaceless(scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface, |
+ AcceleratedWidget widget, |
+ const gfx::Size& size) |
dnicoara
2014/08/26 00:59:15
Drop the size arg and pass in the default value in
|
+ : SurfacelessEGL(size), |
+ ozone_surface_(ozone_surface.Pass()), |
+ widget_(widget) {} |
+ |
+ virtual bool Resize(const gfx::Size& size) OVERRIDE { |
+ if (!ozone_surface_->ResizeNativeWindow(size)) |
+ return false; |
+ |
+ return SurfacelessEGL::Resize(size); |
+ } |
+ virtual bool SwapBuffers() OVERRIDE { |
+ return ozone_surface_->OnSwapBuffers(); |
+ } |
+ virtual bool ScheduleOverlayPlane(int z_order, |
+ OverlayTransform transform, |
+ GLImage* image, |
+ const Rect& bounds_rect, |
+ const RectF& crop_rect) OVERRIDE { |
+ return image->ScheduleOverlayPlane( |
+ widget_, z_order, transform, bounds_rect, crop_rect); |
+ } |
+ virtual bool IsOffscreen() OVERRIDE { return false; } |
+ |
+ private: |
+ // The native surface. Deleting this is allowed to free the EGLNativeWindow. |
+ scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface_; |
+ AcceleratedWidget widget_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneSurfaceless); |
+}; |
+ |
} // namespace |
// static |
@@ -128,6 +163,21 @@ scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( |
} |
DCHECK(GetGLImplementation() == kGLImplementationEGLGLES2); |
if (window != kNullAcceleratedWidget) { |
+ if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() && |
+ ui::SurfaceFactoryOzone::GetInstance() |
+ ->CanShowPrimaryPlaneAsOverlay()) { |
+ scoped_ptr<ui::SurfaceOzoneEGL> surface_ozone = |
+ ui::SurfaceFactoryOzone::GetInstance() |
+ ->CreateSurfacelessEGLSurfaceForWidget(window); |
+ if (!surface_ozone) |
+ return NULL; |
+ scoped_refptr<GLSurfaceOzoneSurfaceless> surface = |
+ new GLSurfaceOzoneSurfaceless( |
+ surface_ozone.Pass(), window, gfx::Size()); |
+ if (!surface->Initialize()) |
dnicoara
2014/08/26 00:59:15
You forgot the VSyncProvider
|
+ return NULL; |
+ return surface; |
+ } |
scoped_ptr<ui::SurfaceOzoneEGL> surface_ozone = |
ui::SurfaceFactoryOzone::GetInstance()->CreateEGLSurfaceForWidget( |
window); |