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

Side by Side Diff: ui/gl/gl_surface_egl.h

Issue 1998723002: Move code in ui/gl/* from gfx:: to gl:: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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 | « ui/gl/gl_surface_android.cc ('k') | ui/gl/gl_surface_egl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_GL_GL_SURFACE_EGL_H_ 5 #ifndef UI_GL_GL_SURFACE_EGL_H_
6 #define UI_GL_GL_SURFACE_EGL_H_ 6 #define UI_GL_GL_SURFACE_EGL_H_
7 7
8 #if defined(OS_WIN) 8 #if defined(OS_WIN)
9 #include <windows.h> 9 #include <windows.h>
10 #endif 10 #endif
11 11
12 #include <memory> 12 #include <memory>
13 #include <string> 13 #include <string>
14 14
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "ui/gfx/geometry/size.h" 20 #include "ui/gfx/geometry/size.h"
21 #include "ui/gfx/vsync_provider.h" 21 #include "ui/gfx/vsync_provider.h"
22 #include "ui/gl/gl_bindings.h" 22 #include "ui/gl/gl_bindings.h"
23 #include "ui/gl/gl_export.h" 23 #include "ui/gl/gl_export.h"
24 #include "ui/gl/gl_surface.h" 24 #include "ui/gl/gl_surface.h"
25 #include "ui/gl/gl_surface_overlay.h" 25 #include "ui/gl/gl_surface_overlay.h"
26 26
27 namespace gfx { 27 namespace gl {
28 28
29 // Get default EGL display for GLSurfaceEGL (differs by platform). 29 // Get default EGL display for GLSurfaceEGL (differs by platform).
30 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay(); 30 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay();
31 31
32 // If adding a new type, also add it to EGLDisplayType in 32 // If adding a new type, also add it to EGLDisplayType in
33 // tools/metrics/histograms/histograms.xml. Don't remove or reorder entries. 33 // tools/metrics/histograms/histograms.xml. Don't remove or reorder entries.
34 enum DisplayType { 34 enum DisplayType {
35 DEFAULT = 0, 35 DEFAULT = 0,
36 SWIFT_SHADER = 1, 36 SWIFT_SHADER = 1,
37 ANGLE_WARP = 2, 37 ANGLE_WARP = 2,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 bool has_alpha) override; 95 bool has_alpha) override;
96 bool Recreate() override; 96 bool Recreate() override;
97 bool IsOffscreen() override; 97 bool IsOffscreen() override;
98 gfx::SwapResult SwapBuffers() override; 98 gfx::SwapResult SwapBuffers() override;
99 gfx::Size GetSize() override; 99 gfx::Size GetSize() override;
100 EGLSurface GetHandle() override; 100 EGLSurface GetHandle() override;
101 bool SupportsPostSubBuffer() override; 101 bool SupportsPostSubBuffer() override;
102 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; 102 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override;
103 bool SupportsCommitOverlayPlanes() override; 103 bool SupportsCommitOverlayPlanes() override;
104 gfx::SwapResult CommitOverlayPlanes() override; 104 gfx::SwapResult CommitOverlayPlanes() override;
105 VSyncProvider* GetVSyncProvider() override; 105 gfx::VSyncProvider* GetVSyncProvider() override;
106 bool ScheduleOverlayPlane(int z_order, 106 bool ScheduleOverlayPlane(int z_order,
107 OverlayTransform transform, 107 gfx::OverlayTransform transform,
108 gl::GLImage* image, 108 gl::GLImage* image,
109 const Rect& bounds_rect, 109 const gfx::Rect& bounds_rect,
110 const RectF& crop_rect) override; 110 const gfx::RectF& crop_rect) override;
111 bool FlipsVertically() const override; 111 bool FlipsVertically() const override;
112 bool BuffersFlipped() const override; 112 bool BuffersFlipped() const override;
113 113
114 // Create a NativeViewGLSurfaceEGL with an externally provided VSyncProvider. 114 // Create a NativeViewGLSurfaceEGL with an externally provided
115 // Takes ownership of the VSyncProvider. 115 // gfx::VSyncProvider.
116 virtual bool Initialize(std::unique_ptr<VSyncProvider> sync_provider); 116 // Takes ownership of the gfx::VSyncProvider.
117 virtual bool Initialize(std::unique_ptr<gfx::VSyncProvider> sync_provider);
117 118
118 // Takes care of the platform dependant bits, of any, for creating the window. 119 // Takes care of the platform dependant bits, of any, for creating the window.
119 virtual bool InitializeNativeWindow(); 120 virtual bool InitializeNativeWindow();
120 121
121 protected: 122 protected:
122 ~NativeViewGLSurfaceEGL() override; 123 ~NativeViewGLSurfaceEGL() override;
123 124
124 EGLNativeWindowType window_; 125 EGLNativeWindowType window_;
125 gfx::Size size_; 126 gfx::Size size_;
126 bool enable_fixed_size_angle_; 127 bool enable_fixed_size_angle_;
127 128
128 void OnSetSwapInterval(int interval) override; 129 void OnSetSwapInterval(int interval) override;
129 130
130 private: 131 private:
131 // Commit the |pending_overlays_| and clear the vector. Returns false if any 132 // Commit the |pending_overlays_| and clear the vector. Returns false if any
132 // fail to be committed. 133 // fail to be committed.
133 bool CommitAndClearPendingOverlays(); 134 bool CommitAndClearPendingOverlays();
134 135
135 EGLSurface surface_; 136 EGLSurface surface_;
136 bool supports_post_sub_buffer_; 137 bool supports_post_sub_buffer_;
137 bool flips_vertically_; 138 bool flips_vertically_;
138 139
139 std::unique_ptr<VSyncProvider> vsync_provider_; 140 std::unique_ptr<gfx::VSyncProvider> vsync_provider_;
140 141
141 int swap_interval_; 142 int swap_interval_;
142 143
143 std::vector<GLSurfaceOverlay> pending_overlays_; 144 std::vector<GLSurfaceOverlay> pending_overlays_;
144 145
145 #if defined(OS_WIN) 146 #if defined(OS_WIN)
146 bool vsync_override_; 147 bool vsync_override_;
147 148
148 unsigned int swap_generation_; 149 unsigned int swap_generation_;
149 static unsigned int current_swap_generation_; 150 static unsigned int current_swap_generation_;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 void* GetShareHandle() override; 205 void* GetShareHandle() override;
205 206
206 protected: 207 protected:
207 ~SurfacelessEGL() override; 208 ~SurfacelessEGL() override;
208 209
209 private: 210 private:
210 gfx::Size size_; 211 gfx::Size size_;
211 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); 212 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL);
212 }; 213 };
213 214
214 } // namespace gfx 215 } // namespace gl
215 216
216 #endif // UI_GL_GL_SURFACE_EGL_H_ 217 #endif // UI_GL_GL_SURFACE_EGL_H_
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_android.cc ('k') | ui/gl/gl_surface_egl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698