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 <unordered_map> |
| 9 |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
9 #include "base/containers/scoped_ptr_hash_map.h" | |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
12 #include "cc/output/ca_layer_overlay.h" | 13 #include "cc/output/ca_layer_overlay.h" |
13 #include "cc/output/overlay_processor.h" | 14 #include "cc/output/overlay_processor.h" |
14 #include "cc/output/renderer.h" | 15 #include "cc/output/renderer.h" |
15 #include "cc/raster/task_graph_runner.h" | 16 #include "cc/raster/task_graph_runner.h" |
16 #include "cc/resources/resource_provider.h" | 17 #include "cc/resources/resource_provider.h" |
17 #include "cc/resources/scoped_resource.h" | 18 #include "cc/resources/scoped_resource.h" |
18 #include "ui/gfx/geometry/quad_f.h" | 19 #include "ui/gfx/geometry/quad_f.h" |
19 | 20 |
20 namespace cc { | 21 namespace cc { |
21 | |
22 class DrawPolygon; | 22 class DrawPolygon; |
23 class ResourceProvider; | 23 class ResourceProvider; |
24 | 24 |
25 // This is the base class for code shared between the GL and software | 25 // This is the base class for code shared between the GL and software |
26 // renderer implementations. "Direct" refers to the fact that it does not | 26 // renderer implementations. "Direct" refers to the fact that it does not |
27 // delegate rendering to another compositor. | 27 // delegate rendering to another compositor. |
28 class CC_EXPORT DirectRenderer : public Renderer { | 28 class CC_EXPORT DirectRenderer : public Renderer { |
29 public: | 29 public: |
30 ~DirectRenderer() override; | 30 ~DirectRenderer() override; |
31 | 31 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 virtual void EnsureScissorTestEnabled() = 0; | 134 virtual void EnsureScissorTestEnabled() = 0; |
135 virtual void EnsureScissorTestDisabled() = 0; | 135 virtual void EnsureScissorTestDisabled() = 0; |
136 virtual void DiscardBackbuffer() {} | 136 virtual void DiscardBackbuffer() {} |
137 virtual void EnsureBackbuffer() {} | 137 virtual void EnsureBackbuffer() {} |
138 | 138 |
139 virtual void CopyCurrentRenderPassToBitmap( | 139 virtual void CopyCurrentRenderPassToBitmap( |
140 DrawingFrame* frame, | 140 DrawingFrame* frame, |
141 scoped_ptr<CopyOutputRequest> request) = 0; | 141 scoped_ptr<CopyOutputRequest> request) = 0; |
142 | 142 |
143 // TODO(danakj): Just use a vector of pairs here? Hash map is way overkill. | 143 // TODO(danakj): Just use a vector of pairs here? Hash map is way overkill. |
144 base::ScopedPtrHashMap<RenderPassId, scoped_ptr<ScopedResource>> | 144 std::unordered_map<RenderPassId, scoped_ptr<ScopedResource>, RenderPassIdHash> |
145 render_pass_textures_; | 145 render_pass_textures_; |
146 OutputSurface* output_surface_; | 146 OutputSurface* output_surface_; |
147 ResourceProvider* resource_provider_; | 147 ResourceProvider* resource_provider_; |
148 scoped_ptr<OverlayProcessor> overlay_processor_; | 148 scoped_ptr<OverlayProcessor> overlay_processor_; |
149 | 149 |
150 // For use in coordinate conversion, this stores the output rect, viewport | 150 // For use in coordinate conversion, this stores the output rect, viewport |
151 // rect (= unflipped version of glViewport rect), the size of target | 151 // rect (= unflipped version of glViewport rect), the size of target |
152 // framebuffer, and the current window space viewport. During a draw, this | 152 // framebuffer, and the current window space viewport. During a draw, this |
153 // stores the values for the current render pass; in between draws, they | 153 // stores the values for the current render pass; in between draws, they |
154 // retain the values for the root render pass of the last draw. | 154 // retain the values for the root render pass of the last draw. |
155 gfx::Rect current_draw_rect_; | 155 gfx::Rect current_draw_rect_; |
156 gfx::Rect current_viewport_rect_; | 156 gfx::Rect current_viewport_rect_; |
157 gfx::Size current_surface_size_; | 157 gfx::Size current_surface_size_; |
158 gfx::Rect current_window_space_viewport_; | 158 gfx::Rect current_window_space_viewport_; |
159 | 159 |
160 private: | 160 private: |
161 gfx::Vector2d enlarge_pass_texture_amount_; | 161 gfx::Vector2d enlarge_pass_texture_amount_; |
162 | 162 |
163 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); | 163 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); |
164 }; | 164 }; |
165 | 165 |
166 } // namespace cc | 166 } // namespace cc |
167 | 167 |
168 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ | 168 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ |
OLD | NEW |