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

Side by Side Diff: ui/ozone/platform/cast/surface_factory_cast.h

Issue 2723583003: Convert Ozone cast to use GLOzone API. (Closed)
Patch Set: . Created 3 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 #ifndef UI_OZONE_PLATFORM_CAST_SURFACE_FACTORY_CAST_H_ 5 #ifndef UI_OZONE_PLATFORM_CAST_SURFACE_FACTORY_CAST_H_
6 #define UI_OZONE_PLATFORM_CAST_SURFACE_FACTORY_CAST_H_ 6 #define UI_OZONE_PLATFORM_CAST_SURFACE_FACTORY_CAST_H_
7 7
8 #include <stdint.h>
9
10 #include <memory> 8 #include <memory>
9 #include <vector>
11 10
12 #include "base/macros.h" 11 #include "base/macros.h"
13 #include "ui/gfx/geometry/rect.h"
14 #include "ui/gfx/geometry/size.h" 12 #include "ui/gfx/geometry/size.h"
15 #include "ui/gl/gl_surface.h" 13 #include "ui/ozone/platform/cast/gl_ozone_egl_cast.h"
14 #include "ui/ozone/public/gl_ozone.h"
16 #include "ui/ozone/public/surface_factory_ozone.h" 15 #include "ui/ozone/public/surface_factory_ozone.h"
17 16
18 namespace chromecast { 17 namespace chromecast {
19 class CastEglPlatform; 18 class CastEglPlatform;
20 } 19 }
21 20
22 namespace ui { 21 namespace ui {
23 22
24 // SurfaceFactoryOzone implementation for OzonePlatformCast. 23 // SurfaceFactoryOzone implementation for OzonePlatformCast.
25 class SurfaceFactoryCast : public SurfaceFactoryOzone { 24 class SurfaceFactoryCast : public SurfaceFactoryOzone {
26 public: 25 public:
27 SurfaceFactoryCast(); 26 SurfaceFactoryCast();
28 explicit SurfaceFactoryCast( 27 explicit SurfaceFactoryCast(
29 std::unique_ptr<chromecast::CastEglPlatform> egl_platform); 28 std::unique_ptr<chromecast::CastEglPlatform> egl_platform);
30 ~SurfaceFactoryCast() override; 29 ~SurfaceFactoryCast() override;
31 30
32 // SurfaceFactoryOzone implementation: 31 // SurfaceFactoryOzone implementation:
33 scoped_refptr<gl::GLSurface> CreateViewGLSurface( 32 std::vector<gl::GLImplementation> GetAllowedGLImplementations() override;
34 gl::GLImplementation implementation, 33 GLOzone* GetGLOzone(gl::GLImplementation implementation) override;
35 gfx::AcceleratedWidget widget) override;
36 scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface(
37 gl::GLImplementation implementation,
38 const gfx::Size& size) override;
39 std::unique_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( 34 std::unique_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget(
40 gfx::AcceleratedWidget widget) override; 35 gfx::AcceleratedWidget widget) override;
41 intptr_t GetNativeDisplay() override;
42 scoped_refptr<NativePixmap> CreateNativePixmap( 36 scoped_refptr<NativePixmap> CreateNativePixmap(
43 gfx::AcceleratedWidget widget, 37 gfx::AcceleratedWidget widget,
44 gfx::Size size, 38 gfx::Size size,
45 gfx::BufferFormat format, 39 gfx::BufferFormat format,
46 gfx::BufferUsage usage) override; 40 gfx::BufferUsage usage) override;
47 bool LoadEGLGLES2Bindings() override;
48
49 intptr_t GetNativeWindow();
50 bool ResizeDisplay(gfx::Size viewport_size);
51 void ChildDestroyed();
52 void TerminateDisplay();
53 void ShutdownHardware();
54
55 // API for keeping track of overlays per frame for logging purposes
56 void OnSwapBuffers();
57 void OnOverlayScheduled(const gfx::Rect& display_bounds);
58 41
59 private: 42 private:
60 enum HardwareState { kUninitialized, kInitialized, kFailed }; 43 std::unique_ptr<GLOzoneEglCast> egl_implementation_;
61
62 void CreateDisplayTypeAndWindowIfNeeded();
63 void DestroyDisplayTypeAndWindow();
64 void DestroyWindow();
65 void InitializeHardware();
66
67 HardwareState state_;
68 void* display_type_;
69 bool have_display_type_;
70 void* window_;
71 gfx::Size display_size_;
72 std::unique_ptr<chromecast::CastEglPlatform> egl_platform_;
73
74 // Overlays scheduled in current and previous frames:
75 int overlay_count_;
76 gfx::Rect overlay_bounds_;
77 int previous_frame_overlay_count_;
78 gfx::Rect previous_frame_overlay_bounds_;
79 44
80 DISALLOW_COPY_AND_ASSIGN(SurfaceFactoryCast); 45 DISALLOW_COPY_AND_ASSIGN(SurfaceFactoryCast);
81 }; 46 };
82 47
83 } // namespace ui 48 } // namespace ui
84 49
85 #endif // UI_OZONE_PLATFORM_CAST_SURFACE_FACTORY_CAST_H_ 50 #endif // UI_OZONE_PLATFORM_CAST_SURFACE_FACTORY_CAST_H_
OLDNEW
« no previous file with comments | « ui/ozone/platform/cast/gl_surface_cast.cc ('k') | ui/ozone/platform/cast/surface_factory_cast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698