| OLD | NEW |
| 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 <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
| 18 #include "ui/gfx/vsync_provider.h" | 18 #include "ui/gfx/vsync_provider.h" |
| 19 #include "ui/gl/gl_bindings.h" | 19 #include "ui/gl/gl_bindings.h" |
| 20 #include "ui/gl/gl_surface.h" | 20 #include "ui/gl/gl_surface.h" |
| 21 #include "ui/gl/gl_surface_overlay.h" |
| 21 | 22 |
| 22 namespace gfx { | 23 namespace gfx { |
| 23 | 24 |
| 24 // Get default EGL display for GLSurfaceEGL (differs by platform). | 25 // Get default EGL display for GLSurfaceEGL (differs by platform). |
| 25 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay(); | 26 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay(); |
| 26 | 27 |
| 27 // If adding a new type, also add it to EGLDisplayType in | 28 // If adding a new type, also add it to EGLDisplayType in |
| 28 // tools/metrics/histograms/histograms.xml. Don't remove or reorder entries. | 29 // tools/metrics/histograms/histograms.xml. Don't remove or reorder entries. |
| 29 enum DisplayType { | 30 enum DisplayType { |
| 30 DEFAULT = 0, | 31 DEFAULT = 0, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 bool Initialize() override; | 81 bool Initialize() override; |
| 81 void Destroy() override; | 82 void Destroy() override; |
| 82 bool Resize(const gfx::Size& size, float scale_factor) override; | 83 bool Resize(const gfx::Size& size, float scale_factor) override; |
| 83 bool Recreate() override; | 84 bool Recreate() override; |
| 84 bool IsOffscreen() override; | 85 bool IsOffscreen() override; |
| 85 gfx::SwapResult SwapBuffers() override; | 86 gfx::SwapResult SwapBuffers() override; |
| 86 gfx::Size GetSize() override; | 87 gfx::Size GetSize() override; |
| 87 EGLSurface GetHandle() override; | 88 EGLSurface GetHandle() override; |
| 88 bool SupportsPostSubBuffer() override; | 89 bool SupportsPostSubBuffer() override; |
| 89 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; | 90 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; |
| 91 bool SupportsCommitOverlayPlanes() override; |
| 92 gfx::SwapResult CommitOverlayPlanes() override; |
| 90 VSyncProvider* GetVSyncProvider() override; | 93 VSyncProvider* GetVSyncProvider() override; |
| 91 bool ScheduleOverlayPlane(int z_order, | 94 bool ScheduleOverlayPlane(int z_order, |
| 92 OverlayTransform transform, | 95 OverlayTransform transform, |
| 93 gl::GLImage* image, | 96 gl::GLImage* image, |
| 94 const Rect& bounds_rect, | 97 const Rect& bounds_rect, |
| 95 const RectF& crop_rect) override; | 98 const RectF& crop_rect) override; |
| 96 | 99 |
| 97 // Create a NativeViewGLSurfaceEGL with an externally provided VSyncProvider. | 100 // Create a NativeViewGLSurfaceEGL with an externally provided VSyncProvider. |
| 98 // Takes ownership of the VSyncProvider. | 101 // Takes ownership of the VSyncProvider. |
| 99 virtual bool Initialize(scoped_ptr<VSyncProvider> sync_provider); | 102 virtual bool Initialize(scoped_ptr<VSyncProvider> sync_provider); |
| 100 | 103 |
| 101 protected: | 104 protected: |
| 102 ~NativeViewGLSurfaceEGL() override; | 105 ~NativeViewGLSurfaceEGL() override; |
| 103 | 106 |
| 104 EGLNativeWindowType window_; | 107 EGLNativeWindowType window_; |
| 105 | 108 |
| 106 void OnSetSwapInterval(int interval) override; | 109 void OnSetSwapInterval(int interval) override; |
| 107 | 110 |
| 108 private: | 111 private: |
| 112 // Commit the |pending_overlays_| and clear the vector. Returns false if any |
| 113 // fail to be committed. |
| 114 bool CommitAndClearPendingOverlays(); |
| 115 |
| 109 EGLSurface surface_; | 116 EGLSurface surface_; |
| 110 bool supports_post_sub_buffer_; | 117 bool supports_post_sub_buffer_; |
| 111 EGLConfig config_; | 118 EGLConfig config_; |
| 112 gfx::Size size_; | 119 gfx::Size size_; |
| 113 | 120 |
| 114 scoped_ptr<VSyncProvider> vsync_provider_; | 121 scoped_ptr<VSyncProvider> vsync_provider_; |
| 115 | 122 |
| 116 int swap_interval_; | 123 int swap_interval_; |
| 117 | 124 |
| 125 std::vector<GLSurfaceOverlay> pending_overlays_; |
| 126 |
| 118 #if defined(OS_WIN) | 127 #if defined(OS_WIN) |
| 119 bool vsync_override_; | 128 bool vsync_override_; |
| 120 | 129 |
| 121 unsigned int swap_generation_; | 130 unsigned int swap_generation_; |
| 122 static unsigned int current_swap_generation_; | 131 static unsigned int current_swap_generation_; |
| 123 static unsigned int swaps_this_generation_; | 132 static unsigned int swaps_this_generation_; |
| 124 static unsigned int last_multiswap_generation_; | 133 static unsigned int last_multiswap_generation_; |
| 125 #endif | 134 #endif |
| 126 | 135 |
| 127 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceEGL); | 136 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceEGL); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 ~SurfacelessEGL() override; | 185 ~SurfacelessEGL() override; |
| 177 | 186 |
| 178 private: | 187 private: |
| 179 gfx::Size size_; | 188 gfx::Size size_; |
| 180 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); | 189 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); |
| 181 }; | 190 }; |
| 182 | 191 |
| 183 } // namespace gfx | 192 } // namespace gfx |
| 184 | 193 |
| 185 #endif // UI_GL_GL_SURFACE_EGL_H_ | 194 #endif // UI_GL_GL_SURFACE_EGL_H_ |
| OLD | NEW |