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_DIRECT_RENDERER_H_ | 5 #ifndef CC_OUTPUT_DIRECT_RENDERER_H_ |
6 #define CC_OUTPUT_DIRECT_RENDERER_H_ | 6 #define CC_OUTPUT_DIRECT_RENDERER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <unordered_map> | 9 #include <unordered_map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // a render pass (e.g. applying a filter directly to the tile quad) | 159 // a render pass (e.g. applying a filter directly to the tile quad) |
160 // return that quad, otherwise return null. | 160 // return that quad, otherwise return null. |
161 virtual const TileDrawQuad* CanPassBeDrawnDirectly(const RenderPass* pass); | 161 virtual const TileDrawQuad* CanPassBeDrawnDirectly(const RenderPass* pass); |
162 virtual void FinishDrawingQuadList() {} | 162 virtual void FinishDrawingQuadList() {} |
163 virtual bool FlippedFramebuffer() const = 0; | 163 virtual bool FlippedFramebuffer() const = 0; |
164 virtual void EnsureScissorTestEnabled() = 0; | 164 virtual void EnsureScissorTestEnabled() = 0; |
165 virtual void EnsureScissorTestDisabled() = 0; | 165 virtual void EnsureScissorTestDisabled() = 0; |
166 virtual void DidChangeVisibility() = 0; | 166 virtual void DidChangeVisibility() = 0; |
167 virtual void CopyCurrentRenderPassToBitmap( | 167 virtual void CopyCurrentRenderPassToBitmap( |
168 std::unique_ptr<CopyOutputRequest> request) = 0; | 168 std::unique_ptr<CopyOutputRequest> request) = 0; |
| 169 virtual void SetEnableDCLayers(bool enable) = 0; |
169 | 170 |
170 gfx::Size surface_size_for_swap_buffers() const { | 171 gfx::Size surface_size_for_swap_buffers() const { |
171 return reshape_surface_size_; | 172 return reshape_surface_size_; |
172 } | 173 } |
173 | 174 |
174 const RendererSettings* const settings_; | 175 const RendererSettings* const settings_; |
175 OutputSurface* const output_surface_; | 176 OutputSurface* const output_surface_; |
176 ResourceProvider* const resource_provider_; | 177 ResourceProvider* const resource_provider_; |
177 // This can be replaced by test implementations. | 178 // This can be replaced by test implementations. |
178 std::unique_ptr<OverlayProcessor> overlay_processor_; | 179 std::unique_ptr<OverlayProcessor> overlay_processor_; |
179 | 180 |
180 // Whether it's valid to SwapBuffers with an empty rect. Trivially true when | 181 // Whether it's valid to SwapBuffers with an empty rect. Trivially true when |
181 // using partial swap. | 182 // using partial swap. |
182 bool allow_empty_swap_ = false; | 183 bool allow_empty_swap_ = false; |
183 // Whether partial swap can be used. | 184 // Whether partial swap can be used. |
184 bool use_partial_swap_ = false; | 185 bool use_partial_swap_ = false; |
185 // Whether overdraw feedback is enabled and can be used. | 186 // Whether overdraw feedback is enabled and can be used. |
186 bool overdraw_feedback_ = false; | 187 bool overdraw_feedback_ = false; |
187 // Whether the SetDrawRectangle command is in use. | 188 // Whether the SetDrawRectangle and EnableDCLayers commands are in |
188 bool use_set_draw_rectangle_ = false; | 189 // use. |
| 190 bool supports_dc_layers_ = false; |
| 191 // Whether the output surface is actually using DirectComposition. |
| 192 bool using_dc_layers_ = false; |
| 193 // This counts the number of draws since the last time |
| 194 // DirectComposition layers needed to be used. |
| 195 int frames_since_using_dc_layers_ = 0; |
189 | 196 |
190 // TODO(danakj): Just use a vector of pairs here? Hash map is way overkill. | 197 // TODO(danakj): Just use a vector of pairs here? Hash map is way overkill. |
191 std::unordered_map<int, std::unique_ptr<ScopedResource>> | 198 std::unordered_map<int, std::unique_ptr<ScopedResource>> |
192 render_pass_textures_; | 199 render_pass_textures_; |
193 std::unordered_map<int, TileDrawQuad> render_pass_bypass_quads_; | 200 std::unordered_map<int, TileDrawQuad> render_pass_bypass_quads_; |
194 | 201 |
195 RenderPassFilterList render_pass_filters_; | 202 RenderPassFilterList render_pass_filters_; |
196 RenderPassFilterList render_pass_background_filters_; | 203 RenderPassFilterList render_pass_background_filters_; |
197 | 204 |
198 bool visible_ = false; | 205 bool visible_ = false; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 gfx::ColorSpace reshape_device_color_space_; | 244 gfx::ColorSpace reshape_device_color_space_; |
238 bool reshape_has_alpha_ = false; | 245 bool reshape_has_alpha_ = false; |
239 bool reshape_use_stencil_ = false; | 246 bool reshape_use_stencil_ = false; |
240 | 247 |
241 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); | 248 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); |
242 }; | 249 }; |
243 | 250 |
244 } // namespace cc | 251 } // namespace cc |
245 | 252 |
246 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ | 253 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ |
OLD | NEW |