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 <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 void DirectRenderer::DrawRenderPass(DrawingFrame* frame, | 326 void DirectRenderer::DrawRenderPass(DrawingFrame* frame, |
327 const RenderPass* render_pass, | 327 const RenderPass* render_pass, |
328 bool allow_partial_swap) { | 328 bool allow_partial_swap) { |
329 TRACE_EVENT0("cc", "DirectRenderer::DrawRenderPass"); | 329 TRACE_EVENT0("cc", "DirectRenderer::DrawRenderPass"); |
330 if (!UseRenderPass(frame, render_pass)) | 330 if (!UseRenderPass(frame, render_pass)) |
331 return; | 331 return; |
332 | 332 |
333 bool using_scissor_as_optimization = | 333 bool using_scissor_as_optimization = |
334 Capabilities().using_partial_swap && allow_partial_swap; | 334 Capabilities().using_partial_swap && allow_partial_swap; |
335 gfx::RectF render_pass_scissor; | 335 gfx::RectF render_pass_scissor; |
| 336 bool draw_rect_covers_full_surface = true; |
| 337 if (frame->current_render_pass == frame->root_render_pass && |
| 338 !client_->DeviceViewport().Contains( |
| 339 gfx::Rect(output_surface_->SurfaceSize()))) |
| 340 draw_rect_covers_full_surface = false; |
336 | 341 |
337 if (using_scissor_as_optimization) { | 342 if (using_scissor_as_optimization) { |
338 render_pass_scissor = ComputeScissorRectForRenderPass(frame); | 343 render_pass_scissor = ComputeScissorRectForRenderPass(frame); |
339 SetScissorTestRectInDrawSpace(frame, render_pass_scissor); | 344 SetScissorTestRectInDrawSpace(frame, render_pass_scissor); |
| 345 if (!render_pass_scissor.Contains(frame->current_render_pass->output_rect)) |
| 346 draw_rect_covers_full_surface = false; |
340 } | 347 } |
341 | 348 |
342 if (frame->current_render_pass != frame->root_render_pass || | 349 if (frame->current_render_pass != frame->root_render_pass || |
343 settings_->should_clear_root_render_pass) { | 350 settings_->should_clear_root_render_pass) { |
344 if (NeedDeviceClip(frame)) | 351 if (NeedDeviceClip(frame)) { |
345 SetScissorTestRect(DeviceClipRect(frame)); | 352 SetScissorTestRect(DeviceClipRect(frame)); |
346 else if (!using_scissor_as_optimization) | 353 draw_rect_covers_full_surface = false; |
| 354 } else if (!using_scissor_as_optimization) { |
347 EnsureScissorTestDisabled(); | 355 EnsureScissorTestDisabled(); |
348 ClearFramebuffer(frame); | 356 } |
| 357 |
| 358 bool has_external_stencil_test = |
| 359 output_surface_->HasExternalStencilTest() && |
| 360 frame->current_render_pass == frame->root_render_pass; |
| 361 |
| 362 DiscardPixels(has_external_stencil_test, draw_rect_covers_full_surface); |
| 363 ClearFramebuffer(frame, has_external_stencil_test); |
349 } | 364 } |
350 | 365 |
351 const QuadList& quad_list = render_pass->quad_list; | 366 const QuadList& quad_list = render_pass->quad_list; |
352 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); | 367 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); |
353 it != quad_list.BackToFrontEnd(); | 368 it != quad_list.BackToFrontEnd(); |
354 ++it) { | 369 ++it) { |
355 const DrawQuad& quad = *(*it); | 370 const DrawQuad& quad = *(*it); |
356 bool should_skip_quad = false; | 371 bool should_skip_quad = false; |
357 | 372 |
358 if (using_scissor_as_optimization) { | 373 if (using_scissor_as_optimization) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 return render_pass->output_rect.size(); | 435 return render_pass->output_rect.size(); |
421 } | 436 } |
422 | 437 |
423 // static | 438 // static |
424 ResourceFormat DirectRenderer::RenderPassTextureFormat( | 439 ResourceFormat DirectRenderer::RenderPassTextureFormat( |
425 const RenderPass* render_pass) { | 440 const RenderPass* render_pass) { |
426 return RGBA_8888; | 441 return RGBA_8888; |
427 } | 442 } |
428 | 443 |
429 } // namespace cc | 444 } // namespace cc |
OLD | NEW |