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 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1717 | 1717 |
1718 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio
nController(); | 1718 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio
nController(); |
1719 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); | 1719 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); |
1720 if (scrollbarController && scrollbarController->animate(monotonicTime)) | 1720 if (scrollbarController && scrollbarController->animate(monotonicTime)) |
1721 m_client->setNeedsRedrawOnImplThread(); | 1721 m_client->setNeedsRedrawOnImplThread(); |
1722 | 1722 |
1723 for (size_t i = 0; i < layer->children().size(); ++i) | 1723 for (size_t i = 0; i < layer->children().size(); ++i) |
1724 animateScrollbarsRecursive(layer->children()[i], time); | 1724 animateScrollbarsRecursive(layer->children()[i], time); |
1725 } | 1725 } |
1726 | 1726 |
| 1727 // static |
| 1728 LayerImpl* LayerTreeHostImpl::getNonCompositedContentLayerRecursive(LayerImpl* l
ayer) |
| 1729 { |
| 1730 if (!layer) |
| 1731 return NULL; |
| 1732 |
| 1733 if (layer->drawsContent()) |
| 1734 return layer; |
| 1735 |
| 1736 for (LayerImpl::LayerList::const_iterator it = layer->children().begin(); |
| 1737 it != layer->children().end(); ++it) { |
| 1738 LayerImpl* nccr = getNonCompositedContentLayerRecursive(*it); |
| 1739 if (nccr) |
| 1740 return nccr; |
| 1741 } |
| 1742 |
| 1743 return NULL; |
| 1744 } |
| 1745 |
| 1746 skia::RefPtr<SkPicture> LayerTreeHostImpl::capturePicture() |
| 1747 { |
| 1748 LayerTreeImpl* tree = pendingTree() ? pendingTree() : activeTree(); |
| 1749 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); |
| 1750 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); |
| 1751 } |
| 1752 |
1727 } // namespace cc | 1753 } // namespace cc |
OLD | NEW |