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 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 DrawingFrame(); | 74 DrawingFrame(); |
75 ~DrawingFrame(); | 75 ~DrawingFrame(); |
76 | 76 |
77 const RenderPassList* render_passes_in_draw_order = nullptr; | 77 const RenderPassList* render_passes_in_draw_order = nullptr; |
78 const RenderPass* root_render_pass = nullptr; | 78 const RenderPass* root_render_pass = nullptr; |
79 const RenderPass* current_render_pass = nullptr; | 79 const RenderPass* current_render_pass = nullptr; |
80 const ScopedResource* current_texture = nullptr; | 80 const ScopedResource* current_texture = nullptr; |
81 | 81 |
82 gfx::Rect root_damage_rect; | 82 gfx::Rect root_damage_rect; |
83 gfx::Size device_viewport_size; | 83 gfx::Size device_viewport_size; |
| 84 gfx::ColorSpace device_color_space; |
84 | 85 |
85 gfx::Transform projection_matrix; | 86 gfx::Transform projection_matrix; |
86 gfx::Transform window_matrix; | 87 gfx::Transform window_matrix; |
87 | 88 |
88 OverlayCandidateList overlay_list; | 89 OverlayCandidateList overlay_list; |
89 CALayerOverlayList ca_layer_overlay_list; | 90 CALayerOverlayList ca_layer_overlay_list; |
90 }; | 91 }; |
91 | 92 |
92 protected: | 93 protected: |
93 friend class BspWalkActionDrawPolygon; | 94 friend class BspWalkActionDrawPolygon; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 virtual const TileDrawQuad* CanPassBeDrawnDirectly(const RenderPass* pass); | 162 virtual const TileDrawQuad* CanPassBeDrawnDirectly(const RenderPass* pass); |
162 virtual void FinishDrawingQuadList() {} | 163 virtual void FinishDrawingQuadList() {} |
163 virtual bool FlippedFramebuffer(const DrawingFrame* frame) const = 0; | 164 virtual bool FlippedFramebuffer(const DrawingFrame* frame) const = 0; |
164 virtual void EnsureScissorTestEnabled() = 0; | 165 virtual void EnsureScissorTestEnabled() = 0; |
165 virtual void EnsureScissorTestDisabled() = 0; | 166 virtual void EnsureScissorTestDisabled() = 0; |
166 virtual void DidChangeVisibility() = 0; | 167 virtual void DidChangeVisibility() = 0; |
167 virtual void CopyCurrentRenderPassToBitmap( | 168 virtual void CopyCurrentRenderPassToBitmap( |
168 DrawingFrame* frame, | 169 DrawingFrame* frame, |
169 std::unique_ptr<CopyOutputRequest> request) = 0; | 170 std::unique_ptr<CopyOutputRequest> request) = 0; |
170 | 171 |
| 172 gfx::Size surface_size_for_swap_buffers() const { |
| 173 return reshape_surface_size_; |
| 174 } |
| 175 |
171 const RendererSettings* const settings_; | 176 const RendererSettings* const settings_; |
172 OutputSurface* const output_surface_; | 177 OutputSurface* const output_surface_; |
173 ResourceProvider* const resource_provider_; | 178 ResourceProvider* const resource_provider_; |
174 // This can be replaced by test implementations. | 179 // This can be replaced by test implementations. |
175 std::unique_ptr<OverlayProcessor> overlay_processor_; | 180 std::unique_ptr<OverlayProcessor> overlay_processor_; |
176 | 181 |
177 // Whether it's valid to SwapBuffers with an empty rect. Trivially true when | 182 // Whether it's valid to SwapBuffers with an empty rect. Trivially true when |
178 // using partial swap. | 183 // using partial swap. |
179 bool allow_empty_swap_; | 184 bool allow_empty_swap_; |
180 // Whether partial swap can be used. | 185 // Whether partial swap can be used. |
181 bool use_partial_swap_; | 186 bool use_partial_swap_; |
182 | 187 |
183 // TODO(danakj): Just use a vector of pairs here? Hash map is way overkill. | 188 // TODO(danakj): Just use a vector of pairs here? Hash map is way overkill. |
184 std::unordered_map<RenderPassId, | 189 std::unordered_map<RenderPassId, |
185 std::unique_ptr<ScopedResource>, | 190 std::unique_ptr<ScopedResource>, |
186 RenderPassIdHash> | 191 RenderPassIdHash> |
187 render_pass_textures_; | 192 render_pass_textures_; |
188 std::unordered_map<RenderPassId, TileDrawQuad, RenderPassIdHash> | 193 std::unordered_map<RenderPassId, TileDrawQuad, RenderPassIdHash> |
189 render_pass_bypass_quads_; | 194 render_pass_bypass_quads_; |
190 | 195 |
191 bool visible_ = false; | 196 bool visible_ = false; |
192 | 197 |
193 // The size of the surface produced by DrawFrame() for SwapBuffers() to use. | |
194 gfx::Size surface_size_for_swap_buffers_; | |
195 | |
196 // For use in coordinate conversion, this stores the output rect, viewport | 198 // For use in coordinate conversion, this stores the output rect, viewport |
197 // rect (= unflipped version of glViewport rect), the size of target | 199 // rect (= unflipped version of glViewport rect), the size of target |
198 // framebuffer, and the current window space viewport. During a draw, this | 200 // framebuffer, and the current window space viewport. During a draw, this |
199 // stores the values for the current render pass; in between draws, they | 201 // stores the values for the current render pass; in between draws, they |
200 // retain the values for the root render pass of the last draw. | 202 // retain the values for the root render pass of the last draw. |
201 gfx::Rect current_draw_rect_; | 203 gfx::Rect current_draw_rect_; |
202 gfx::Rect current_viewport_rect_; | 204 gfx::Rect current_viewport_rect_; |
203 gfx::Size current_surface_size_; | 205 gfx::Size current_surface_size_; |
204 gfx::Rect current_window_space_viewport_; | 206 gfx::Rect current_window_space_viewport_; |
205 | 207 |
206 private: | 208 private: |
207 bool initialized_ = false; | 209 bool initialized_ = false; |
208 gfx::Size enlarge_pass_texture_amount_; | 210 gfx::Size enlarge_pass_texture_amount_; |
209 | 211 |
| 212 // Cached values given to Reshape(). |
| 213 gfx::Size reshape_surface_size_; |
| 214 float reshape_device_scale_factor_ = 0.f; |
| 215 gfx::ColorSpace reshape_device_color_space_; |
| 216 bool reshape_has_alpha_ = false; |
| 217 |
210 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); | 218 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); |
211 }; | 219 }; |
212 | 220 |
213 } // namespace cc | 221 } // namespace cc |
214 | 222 |
215 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ | 223 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ |
OLD | NEW |