| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 GPU_IPC_SERVICE_DIRECT_COMPOSITION_SURFACE_WIN_H_ | 5 #ifndef GPU_IPC_SERVICE_DIRECT_COMPOSITION_SURFACE_WIN_H_ |
| 6 #define GPU_IPC_SERVICE_DIRECT_COMPOSITION_SURFACE_WIN_H_ | 6 #define GPU_IPC_SERVICE_DIRECT_COMPOSITION_SURFACE_WIN_H_ |
| 7 | 7 |
| 8 #include <d3d11.h> | 8 #include <d3d11.h> |
| 9 #include <dcomp.h> | 9 #include <dcomp.h> |
| 10 #include <windows.h> | 10 #include <windows.h> |
| 11 | 11 |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/win/scoped_comptr.h" | 13 #include "base/win/scoped_comptr.h" |
| 14 #include "gpu/gpu_export.h" | 14 #include "gpu/gpu_export.h" |
| 15 #include "gpu/ipc/service/child_window_win.h" | 15 #include "gpu/ipc/service/child_window_win.h" |
| 16 #include "gpu/ipc/service/image_transport_surface_delegate.h" | 16 #include "gpu/ipc/service/image_transport_surface_delegate.h" |
| 17 #include "ui/gl/gl_image.h" | 17 #include "ui/gl/gl_image.h" |
| 18 #include "ui/gl/gl_surface_egl.h" | 18 #include "ui/gl/gl_surface_egl.h" |
| 19 | 19 |
| 20 namespace gpu { | 20 namespace gpu { |
| 21 | 21 |
| 22 class DCLayerTree; | 22 class DCLayerTree; |
| 23 | 23 |
| 24 class GPU_EXPORT DirectCompositionSurfaceWin : public gl::GLSurfaceEGL { | 24 class GPU_EXPORT DirectCompositionSurfaceWin : public gl::GLSurfaceEGL { |
| 25 public: | 25 public: |
| 26 DirectCompositionSurfaceWin( | 26 DirectCompositionSurfaceWin( |
| 27 std::unique_ptr<gfx::VSyncProvider> vsync_provider, |
| 27 base::WeakPtr<ImageTransportSurfaceDelegate> delegate, | 28 base::WeakPtr<ImageTransportSurfaceDelegate> delegate, |
| 28 HWND parent_window); | 29 HWND parent_window); |
| 29 | 30 |
| 30 // Returns true if there's an output on the current adapter that can | 31 // Returns true if there's an output on the current adapter that can |
| 31 // use overlays. | 32 // use overlays. |
| 32 static bool AreOverlaysSupported(); | 33 static bool AreOverlaysSupported(); |
| 33 | 34 |
| 34 bool InitializeNativeWindow(); | 35 bool InitializeNativeWindow(); |
| 35 | 36 |
| 36 // GLSurfaceEGL implementation. | 37 // GLSurfaceEGL implementation. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 54 bool SetDrawRectangle(const gfx::Rect& rect) override; | 55 bool SetDrawRectangle(const gfx::Rect& rect) override; |
| 55 gfx::Vector2d GetDrawOffset() const override; | 56 gfx::Vector2d GetDrawOffset() const override; |
| 56 | 57 |
| 57 // This schedules an overlay plane to be displayed on the next SwapBuffers | 58 // This schedules an overlay plane to be displayed on the next SwapBuffers |
| 58 // or PostSubBuffer call. Overlay planes must be scheduled before every swap | 59 // or PostSubBuffer call. Overlay planes must be scheduled before every swap |
| 59 // to remain in the layer tree. This surface's backbuffer doesn't have to be | 60 // to remain in the layer tree. This surface's backbuffer doesn't have to be |
| 60 // scheduled with ScheduleDCLayer, as it's automatically placed in the layer | 61 // scheduled with ScheduleDCLayer, as it's automatically placed in the layer |
| 61 // tree at z-order 0. | 62 // tree at z-order 0. |
| 62 bool ScheduleDCLayer(const ui::DCRendererLayerParams& params) override; | 63 bool ScheduleDCLayer(const ui::DCRendererLayerParams& params) override; |
| 63 | 64 |
| 64 bool Initialize(std::unique_ptr<gfx::VSyncProvider> vsync_provider); | |
| 65 | |
| 66 const base::win::ScopedComPtr<IDCompositionSurface>& dcomp_surface() const { | 65 const base::win::ScopedComPtr<IDCompositionSurface>& dcomp_surface() const { |
| 67 return dcomp_surface_; | 66 return dcomp_surface_; |
| 68 } | 67 } |
| 69 | 68 |
| 70 scoped_refptr<base::TaskRunner> GetWindowTaskRunnerForTesting(); | 69 scoped_refptr<base::TaskRunner> GetWindowTaskRunnerForTesting(); |
| 71 const base::win::ScopedComPtr<IDXGISwapChain1>& swap_chain() const { | 70 const base::win::ScopedComPtr<IDXGISwapChain1>& swap_chain() const { |
| 72 return swap_chain_; | 71 return swap_chain_; |
| 73 } | 72 } |
| 74 | 73 |
| 75 base::win::ScopedComPtr<IDXGISwapChain1> GetLayerSwapChainForTesting( | 74 base::win::ScopedComPtr<IDXGISwapChain1> GetLayerSwapChainForTesting( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // Keep track of whether the texture has been rendered to, as the first draw | 113 // Keep track of whether the texture has been rendered to, as the first draw |
| 115 // to it must overwrite the entire thing. | 114 // to it must overwrite the entire thing. |
| 116 bool has_been_rendered_to_ = false; | 115 bool has_been_rendered_to_ = false; |
| 117 | 116 |
| 118 DISALLOW_COPY_AND_ASSIGN(DirectCompositionSurfaceWin); | 117 DISALLOW_COPY_AND_ASSIGN(DirectCompositionSurfaceWin); |
| 119 }; | 118 }; |
| 120 | 119 |
| 121 } // namespace gpu | 120 } // namespace gpu |
| 122 | 121 |
| 123 #endif // GPU_IPC_SERVICE_DIRECT_COMPOSITION_SURFACE_WIN_H_ | 122 #endif // GPU_IPC_SERVICE_DIRECT_COMPOSITION_SURFACE_WIN_H_ |
| OLD | NEW |