| 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 #include "cc/output/direct_renderer.h" | 5 #include "cc/output/direct_renderer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 } else { | 271 } else { |
| 272 DrawRenderPassAndExecuteCopyRequests(&frame, root_render_pass); | 272 DrawRenderPassAndExecuteCopyRequests(&frame, root_render_pass); |
| 273 } | 273 } |
| 274 | 274 |
| 275 FinishDrawingFrame(&frame); | 275 FinishDrawingFrame(&frame); |
| 276 render_passes_in_draw_order->clear(); | 276 render_passes_in_draw_order->clear(); |
| 277 } | 277 } |
| 278 | 278 |
| 279 gfx::Rect DirectRenderer::ComputeScissorRectForRenderPass( | 279 gfx::Rect DirectRenderer::ComputeScissorRectForRenderPass( |
| 280 const DrawingFrame* frame) { | 280 const DrawingFrame* frame) { |
| 281 gfx::Rect render_pass_scissor = frame->current_render_pass->output_rect; | 281 if (frame->current_render_pass == frame->root_render_pass) |
| 282 return frame->root_damage_rect; |
| 282 | 283 |
| 283 if (frame->root_damage_rect == frame->root_render_pass->output_rect || | 284 // If the root damage rect has been expanded due to overlays, all the other |
| 284 !frame->current_render_pass->copy_requests.empty()) | 285 // damage rect calculations are incorrect. |
| 285 return render_pass_scissor; | 286 if (!frame->root_render_pass->damage_rect.Contains(frame->root_damage_rect)) |
| 287 return frame->current_render_pass->output_rect; |
| 286 | 288 |
| 287 gfx::Transform inverse_transform(gfx::Transform::kSkipInitialization); | 289 DCHECK(frame->current_render_pass->copy_requests.empty() || |
| 288 if (frame->current_render_pass->transform_to_root_target.GetInverse( | 290 (frame->current_render_pass->damage_rect == |
| 289 &inverse_transform)) { | 291 frame->current_render_pass->output_rect)); |
| 290 // Only intersect inverse-projected damage if the transform is invertible. | 292 return frame->current_render_pass->damage_rect; |
| 291 gfx::Rect damage_rect_in_render_pass_space = | |
| 292 MathUtil::ProjectEnclosingClippedRect(inverse_transform, | |
| 293 frame->root_damage_rect); | |
| 294 render_pass_scissor.Intersect(damage_rect_in_render_pass_space); | |
| 295 } | |
| 296 | |
| 297 return render_pass_scissor; | |
| 298 } | 293 } |
| 299 | 294 |
| 300 bool DirectRenderer::NeedDeviceClip(const DrawingFrame* frame) const { | 295 bool DirectRenderer::NeedDeviceClip(const DrawingFrame* frame) const { |
| 301 if (frame->current_render_pass != frame->root_render_pass) | 296 if (frame->current_render_pass != frame->root_render_pass) |
| 302 return false; | 297 return false; |
| 303 | 298 |
| 304 return !frame->device_clip_rect.Contains(frame->device_viewport_rect); | 299 return !frame->device_clip_rect.Contains(frame->device_viewport_rect); |
| 305 } | 300 } |
| 306 | 301 |
| 307 gfx::Rect DirectRenderer::DeviceClipRectInDrawSpace( | 302 gfx::Rect DirectRenderer::DeviceClipRectInDrawSpace( |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 auto iter = render_pass_textures_.find(id); | 559 auto iter = render_pass_textures_.find(id); |
| 565 return iter != render_pass_textures_.end() && iter->second->id(); | 560 return iter != render_pass_textures_.end() && iter->second->id(); |
| 566 } | 561 } |
| 567 | 562 |
| 568 // static | 563 // static |
| 569 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { | 564 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
| 570 return render_pass->output_rect.size(); | 565 return render_pass->output_rect.size(); |
| 571 } | 566 } |
| 572 | 567 |
| 573 } // namespace cc | 568 } // namespace cc |
| OLD | NEW |