Chromium Code Reviews| 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 redraw_rect_covers_full_surface = true; | |
|
danakj
2013/09/20 00:41:46
ok cool.. don't hate me for suggesting: "draw_rect
piman
2013/09/20 00:51:51
Done.
| |
| 337 if (frame->current_render_pass == frame->root_render_pass && | |
| 338 !client_->DeviceViewport().Contains( | |
| 339 gfx::Rect(output_surface_->SurfaceSize()))) | |
| 340 redraw_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 redraw_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 redraw_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, | |
| 363 redraw_rect_covers_full_surface); | |
| 364 ClearFramebuffer(frame, | |
|
danakj
2013/09/20 00:41:46
git cl format? :)
piman
2013/09/20 00:51:51
Done.
| |
| 365 has_external_stencil_test); | |
| 349 } | 366 } |
| 350 | 367 |
| 351 const QuadList& quad_list = render_pass->quad_list; | 368 const QuadList& quad_list = render_pass->quad_list; |
| 352 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); | 369 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); |
| 353 it != quad_list.BackToFrontEnd(); | 370 it != quad_list.BackToFrontEnd(); |
| 354 ++it) { | 371 ++it) { |
| 355 const DrawQuad& quad = *(*it); | 372 const DrawQuad& quad = *(*it); |
| 356 bool should_skip_quad = false; | 373 bool should_skip_quad = false; |
| 357 | 374 |
| 358 if (using_scissor_as_optimization) { | 375 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(); | 437 return render_pass->output_rect.size(); |
| 421 } | 438 } |
| 422 | 439 |
| 423 // static | 440 // static |
| 424 ResourceFormat DirectRenderer::RenderPassTextureFormat( | 441 ResourceFormat DirectRenderer::RenderPassTextureFormat( |
| 425 const RenderPass* render_pass) { | 442 const RenderPass* render_pass) { |
| 426 return RGBA_8888; | 443 return RGBA_8888; |
| 427 } | 444 } |
| 428 | 445 |
| 429 } // namespace cc | 446 } // namespace cc |
| OLD | NEW |