OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layer_tree_host_impl.h" | 5 #include "cc/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 LayerImpl* renderSurfaceLayer = (*frame.renderSurfaceLayerList)[surfaceI
ndex]; | 382 LayerImpl* renderSurfaceLayer = (*frame.renderSurfaceLayerList)[surfaceI
ndex]; |
383 renderSurfaceLayer->renderSurface()->appendRenderPasses(frame); | 383 renderSurfaceLayer->renderSurface()->appendRenderPasses(frame); |
384 } | 384 } |
385 | 385 |
386 bool recordMetricsForFrame = m_settings.showOverdrawInTracing && base::debug
::TraceLog::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled(); | 386 bool recordMetricsForFrame = m_settings.showOverdrawInTracing && base::debug
::TraceLog::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled(); |
387 OcclusionTrackerImpl occlusionTracker(m_rootLayerImpl->renderSurface()->cont
entRect(), recordMetricsForFrame); | 387 OcclusionTrackerImpl occlusionTracker(m_rootLayerImpl->renderSurface()->cont
entRect(), recordMetricsForFrame); |
388 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS
ize); | 388 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS
ize); |
389 | 389 |
390 if (settings().showOccludingRects) | 390 if (settings().showOccludingRects) |
391 occlusionTracker.setOccludingScreenSpaceRectsContainer(&frame.occludingS
creenSpaceRects); | 391 occlusionTracker.setOccludingScreenSpaceRectsContainer(&frame.occludingS
creenSpaceRects); |
| 392 if (settings().showNonOccludingRects) |
| 393 occlusionTracker.setNonOccludingScreenSpaceRectsContainer(&frame.nonOccl
udingScreenSpaceRects); |
392 | 394 |
393 // Add quads to the Render passes in FrontToBack order to allow for testing
occlusion and performing culling during the tree walk. | 395 // Add quads to the Render passes in FrontToBack order to allow for testing
occlusion and performing culling during the tree walk. |
394 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl,
LayerIteratorActions::FrontToBack> LayerIteratorType; | 396 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl,
LayerIteratorActions::FrontToBack> LayerIteratorType; |
395 | 397 |
396 // Typically when we are missing a texture and use a checkerboard quad, we s
till draw the frame. However when the layer being | 398 // Typically when we are missing a texture and use a checkerboard quad, we s
till draw the frame. However when the layer being |
397 // checkerboarded is moving due to an impl-animation, we drop the frame to a
void flashing due to the texture suddenly appearing | 399 // checkerboarded is moving due to an impl-animation, we drop the frame to a
void flashing due to the texture suddenly appearing |
398 // in the future. | 400 // in the future. |
399 bool drawFrame = true; | 401 bool drawFrame = true; |
400 | 402 |
401 LayerIteratorType end = LayerIteratorType::end(frame.renderSurfaceLayerList)
; | 403 LayerIteratorType end = LayerIteratorType::end(frame.renderSurfaceLayerList)
; |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers"); | 688 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers"); |
687 DCHECK(canDraw()); | 689 DCHECK(canDraw()); |
688 DCHECK(!frame.renderPasses.empty()); | 690 DCHECK(!frame.renderPasses.empty()); |
689 | 691 |
690 // FIXME: use the frame begin time from the overall compositor scheduler. | 692 // FIXME: use the frame begin time from the overall compositor scheduler. |
691 // This value is currently inaccessible because it is up in Chromium's | 693 // This value is currently inaccessible because it is up in Chromium's |
692 // RenderWidget. | 694 // RenderWidget. |
693 m_fpsCounter->markBeginningOfFrame(base::TimeTicks::Now()); | 695 m_fpsCounter->markBeginningOfFrame(base::TimeTicks::Now()); |
694 | 696 |
695 if (m_settings.showDebugRects()) | 697 if (m_settings.showDebugRects()) |
696 m_debugRectHistory->saveDebugRectsForCurrentFrame(m_rootLayerImpl.get(),
*frame.renderSurfaceLayerList, frame.occludingScreenSpaceRects, settings()); | 698 m_debugRectHistory->saveDebugRectsForCurrentFrame(m_rootLayerImpl.get(),
*frame.renderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOcclud
ingScreenSpaceRects, settings()); |
697 | 699 |
698 // Because the contents of the HUD depend on everything else in the frame, t
he contents | 700 // Because the contents of the HUD depend on everything else in the frame, t
he contents |
699 // of its texture are updated as the last thing before the frame is drawn. | 701 // of its texture are updated as the last thing before the frame is drawn. |
700 if (m_hudLayerImpl) | 702 if (m_hudLayerImpl) |
701 m_hudLayerImpl->updateHudTexture(m_resourceProvider.get()); | 703 m_hudLayerImpl->updateHudTexture(m_resourceProvider.get()); |
702 | 704 |
703 m_renderer->drawFrame(frame.renderPasses, frame.renderPassesById); | 705 m_renderer->drawFrame(frame.renderPasses, frame.renderPassesById); |
704 | 706 |
705 // Once a RenderPass has been drawn, its damage should be cleared in | 707 // Once a RenderPass has been drawn, its damage should be cleared in |
706 // case the RenderPass will be reused next frame. | 708 // case the RenderPass will be reused next frame. |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio
nController(); | 1492 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio
nController(); |
1491 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); | 1493 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); |
1492 if (scrollbarController && scrollbarController->animate(monotonicTime)) | 1494 if (scrollbarController && scrollbarController->animate(monotonicTime)) |
1493 m_client->setNeedsRedrawOnImplThread(); | 1495 m_client->setNeedsRedrawOnImplThread(); |
1494 | 1496 |
1495 for (size_t i = 0; i < layer->children().size(); ++i) | 1497 for (size_t i = 0; i < layer->children().size(); ++i) |
1496 animateScrollbarsRecursive(layer->children()[i], time); | 1498 animateScrollbarsRecursive(layer->children()[i], time); |
1497 } | 1499 } |
1498 | 1500 |
1499 } // namespace cc | 1501 } // namespace cc |
OLD | NEW |