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> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 bool ScheduleOverlayPlane(int z_order, | 43 bool ScheduleOverlayPlane(int z_order, |
44 gfx::OverlayTransform transform, | 44 gfx::OverlayTransform transform, |
45 gl::GLImage* image, | 45 gl::GLImage* image, |
46 const gfx::Rect& bounds_rect, | 46 const gfx::Rect& bounds_rect, |
47 const gfx::RectF& crop_rect) override; | 47 const gfx::RectF& crop_rect) override; |
48 bool FlipsVertically() const override; | 48 bool FlipsVertically() const override; |
49 bool SupportsPostSubBuffer() override; | 49 bool SupportsPostSubBuffer() override; |
50 bool OnMakeCurrent(gl::GLContext* context) override; | 50 bool OnMakeCurrent(gl::GLContext* context) override; |
51 bool SupportsSetDrawRectangle() const override; | 51 bool SupportsSetDrawRectangle() const override; |
52 bool SetDrawRectangle(const gfx::Rect& rect) override; | 52 bool SetDrawRectangle(const gfx::Rect& rect) override; |
| 53 gfx::Vector2d GetDrawOffset() const override; |
53 | 54 |
54 bool Initialize(std::unique_ptr<gfx::VSyncProvider> vsync_provider); | 55 bool Initialize(std::unique_ptr<gfx::VSyncProvider> vsync_provider); |
55 | 56 |
56 scoped_refptr<base::TaskRunner> GetWindowTaskRunnerForTesting(); | 57 scoped_refptr<base::TaskRunner> GetWindowTaskRunnerForTesting(); |
57 | 58 |
58 protected: | 59 protected: |
59 ~DirectCompositionSurfaceWin() override; | 60 ~DirectCompositionSurfaceWin() override; |
60 | 61 |
61 private: | 62 private: |
62 struct Overlay { | 63 struct Overlay { |
(...skipping 25 matching lines...) Expand all Loading... |
88 EGLSurface default_surface_ = 0; | 89 EGLSurface default_surface_ = 0; |
89 | 90 |
90 // This is the real surface representing the backbuffer. It may be null | 91 // This is the real surface representing the backbuffer. It may be null |
91 // outside of a BeginDraw/EndDraw pair. | 92 // outside of a BeginDraw/EndDraw pair. |
92 EGLSurface real_surface_ = 0; | 93 EGLSurface real_surface_ = 0; |
93 gfx::Size size_ = gfx::Size(1, 1); | 94 gfx::Size size_ = gfx::Size(1, 1); |
94 bool first_swap_ = true; | 95 bool first_swap_ = true; |
95 std::unique_ptr<gfx::VSyncProvider> vsync_provider_; | 96 std::unique_ptr<gfx::VSyncProvider> vsync_provider_; |
96 std::vector<Overlay> pending_overlays_; | 97 std::vector<Overlay> pending_overlays_; |
97 | 98 |
| 99 gfx::Vector2d draw_offset_; |
| 100 |
98 base::win::ScopedComPtr<ID3D11Device> d3d11_device_; | 101 base::win::ScopedComPtr<ID3D11Device> d3d11_device_; |
99 base::win::ScopedComPtr<IDCompositionDevice2> dcomp_device_; | 102 base::win::ScopedComPtr<IDCompositionDevice2> dcomp_device_; |
100 base::win::ScopedComPtr<IDCompositionTarget> dcomp_target_; | 103 base::win::ScopedComPtr<IDCompositionTarget> dcomp_target_; |
101 base::win::ScopedComPtr<IDCompositionVisual2> visual_; | 104 base::win::ScopedComPtr<IDCompositionVisual2> visual_; |
102 base::win::ScopedComPtr<IDCompositionSurface> dcomp_surface_; | 105 base::win::ScopedComPtr<IDCompositionSurface> dcomp_surface_; |
103 base::win::ScopedComPtr<ID3D11Texture2D> draw_texture_; | 106 base::win::ScopedComPtr<ID3D11Texture2D> draw_texture_; |
104 | 107 |
105 // Keep track of whether the texture has been rendered to, as the first draw | 108 // Keep track of whether the texture has been rendered to, as the first draw |
106 // to it must overwrite the entire thing. | 109 // to it must overwrite the entire thing. |
107 bool has_been_rendered_to_ = false; | 110 bool has_been_rendered_to_ = false; |
108 | 111 |
109 DISALLOW_COPY_AND_ASSIGN(DirectCompositionSurfaceWin); | 112 DISALLOW_COPY_AND_ASSIGN(DirectCompositionSurfaceWin); |
110 }; | 113 }; |
111 | 114 |
112 } // namespace gpu | 115 } // namespace gpu |
113 | 116 |
114 #endif // GPU_IPC_SERVICE_DIRECT_COMPOSITION_SURFACE_WIN_H_ | 117 #endif // GPU_IPC_SERVICE_DIRECT_COMPOSITION_SURFACE_WIN_H_ |
OLD | NEW |