| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 CC_OUTPUT_OUTPUT_SURFACE_H_ | 5 #ifndef CC_OUTPUT_OUTPUT_SURFACE_H_ |
| 6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ | 6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 return software_device_.get(); | 92 return software_device_.get(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 virtual void EnsureBackbuffer() = 0; | 95 virtual void EnsureBackbuffer() = 0; |
| 96 virtual void DiscardBackbuffer() = 0; | 96 virtual void DiscardBackbuffer() = 0; |
| 97 | 97 |
| 98 // Bind the default framebuffer for drawing to, only valid for GL backed | 98 // Bind the default framebuffer for drawing to, only valid for GL backed |
| 99 // OutputSurfaces. | 99 // OutputSurfaces. |
| 100 virtual void BindFramebuffer() = 0; | 100 virtual void BindFramebuffer() = 0; |
| 101 | 101 |
| 102 const gfx::ColorSpace& device_color_space() const { | |
| 103 return device_color_space_; | |
| 104 } | |
| 105 | |
| 106 // Get the class capable of informing cc of hardware overlay capability. | 102 // Get the class capable of informing cc of hardware overlay capability. |
| 107 virtual OverlayCandidateValidator* GetOverlayCandidateValidator() const = 0; | 103 virtual OverlayCandidateValidator* GetOverlayCandidateValidator() const = 0; |
| 108 | 104 |
| 109 // Returns true if a main image overlay plane should be scheduled. | 105 // Returns true if a main image overlay plane should be scheduled. |
| 110 virtual bool IsDisplayedAsOverlayPlane() const = 0; | 106 virtual bool IsDisplayedAsOverlayPlane() const = 0; |
| 111 | 107 |
| 112 // Get the texture for the main image's overlay. | 108 // Get the texture for the main image's overlay. |
| 113 virtual unsigned GetOverlayTextureId() const = 0; | 109 virtual unsigned GetOverlayTextureId() const = 0; |
| 114 | 110 |
| 115 // If this returns true, then the surface will not attempt to draw. | 111 // If this returns true, then the surface will not attempt to draw. |
| 116 virtual bool SurfaceIsSuspendForRecycle() const = 0; | 112 virtual bool SurfaceIsSuspendForRecycle() const = 0; |
| 117 | 113 |
| 118 virtual void Reshape(const gfx::Size& size, | 114 virtual void Reshape(const gfx::Size& size, |
| 119 float scale_factor, | 115 float device_scale_factor, |
| 120 const gfx::ColorSpace& color_space, | 116 const gfx::ColorSpace& color_space, |
| 121 bool alpha); | 117 bool has_alpha) = 0; |
| 122 | 118 |
| 123 virtual bool HasExternalStencilTest() const = 0; | 119 virtual bool HasExternalStencilTest() const = 0; |
| 124 virtual void ApplyExternalStencil() = 0; | 120 virtual void ApplyExternalStencil() = 0; |
| 125 | 121 |
| 126 // Gives the GL internal format that should be used for calling CopyTexImage2D | 122 // Gives the GL internal format that should be used for calling CopyTexImage2D |
| 127 // when the framebuffer is bound via BindFramebuffer(). | 123 // when the framebuffer is bound via BindFramebuffer(). |
| 128 virtual uint32_t GetFramebufferCopyTextureFormat() = 0; | 124 virtual uint32_t GetFramebufferCopyTextureFormat() = 0; |
| 129 | 125 |
| 130 // The implementation may destroy or steal the contents of the CompositorFrame | 126 // The implementation may destroy or steal the contents of the CompositorFrame |
| 131 // passed in (though it will not take ownership of the CompositorFrame | 127 // passed in (though it will not take ownership of the CompositorFrame |
| (...skipping 11 matching lines...) Expand all Loading... |
| 143 // Used internally for the context provider to inform the client about loss, | 139 // Used internally for the context provider to inform the client about loss, |
| 144 // and can be overridden to change behaviour instead of informing the client. | 140 // and can be overridden to change behaviour instead of informing the client. |
| 145 virtual void DidLoseOutputSurface(); | 141 virtual void DidLoseOutputSurface(); |
| 146 | 142 |
| 147 OutputSurfaceClient* client_ = nullptr; | 143 OutputSurfaceClient* client_ = nullptr; |
| 148 | 144 |
| 149 struct OutputSurface::Capabilities capabilities_; | 145 struct OutputSurface::Capabilities capabilities_; |
| 150 scoped_refptr<ContextProvider> context_provider_; | 146 scoped_refptr<ContextProvider> context_provider_; |
| 151 scoped_refptr<VulkanContextProvider> vulkan_context_provider_; | 147 scoped_refptr<VulkanContextProvider> vulkan_context_provider_; |
| 152 std::unique_ptr<SoftwareOutputDevice> software_device_; | 148 std::unique_ptr<SoftwareOutputDevice> software_device_; |
| 153 gfx::Size surface_size_; | |
| 154 float device_scale_factor_ = -1; | |
| 155 gfx::ColorSpace device_color_space_; | |
| 156 bool has_alpha_ = true; | |
| 157 gfx::ColorSpace color_space_; | |
| 158 base::ThreadChecker thread_checker_; | 149 base::ThreadChecker thread_checker_; |
| 159 | 150 |
| 160 private: | 151 private: |
| 161 void OnSwapBuffersComplete(); | 152 void OnSwapBuffersComplete(); |
| 162 | 153 |
| 163 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; | 154 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; |
| 164 | 155 |
| 165 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 156 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
| 166 }; | 157 }; |
| 167 | 158 |
| 168 } // namespace cc | 159 } // namespace cc |
| 169 | 160 |
| 170 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 161 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
| OLD | NEW |