| 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.h" | 5 #include "cc/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 continue; | 745 continue; |
| 746 if (layer == rootScrollLayer) | 746 if (layer == rootScrollLayer) |
| 747 rootScrollDelta += info.scrolls[i].scrollDelta; | 747 rootScrollDelta += info.scrolls[i].scrollDelta; |
| 748 else | 748 else |
| 749 layer->setScrollOffset(layer->scrollOffset() + info.scrolls[i].scrol
lDelta); | 749 layer->setScrollOffset(layer->scrollOffset() + info.scrolls[i].scrol
lDelta); |
| 750 } | 750 } |
| 751 if (!rootScrollDelta.IsZero() || info.pageScaleDelta != 1) | 751 if (!rootScrollDelta.IsZero() || info.pageScaleDelta != 1) |
| 752 m_client->applyScrollAndScale(rootScrollDelta, info.pageScaleDelta); | 752 m_client->applyScrollAndScale(rootScrollDelta, info.pageScaleDelta); |
| 753 } | 753 } |
| 754 | 754 |
| 755 gfx::PointF LayerTreeHost::adjustEventPointForPinchZoom(const gfx::PointF& zoome
dViewportPoint) | |
| 756 const | |
| 757 { | |
| 758 if (m_implTransform.IsIdentity()) | |
| 759 return zoomedViewportPoint; | |
| 760 | |
| 761 DCHECK(m_implTransform.IsInvertible()); | |
| 762 | |
| 763 // Scale to screen space before applying implTransform inverse. | |
| 764 gfx::PointF zoomedScreenspacePoint = gfx::ScalePoint(zoomedViewportPoint, de
viceScaleFactor()); | |
| 765 | |
| 766 gfx::Transform inverseImplTransform(gfx::Transform::kSkipInitialization); | |
| 767 if (!m_implTransform.GetInverse(&inverseImplTransform)) { | |
| 768 // TODO(shawnsingh): Either we need to handle uninvertible transforms | |
| 769 // here, or DCHECK that the transform is invertible. | |
| 770 } | |
| 771 | |
| 772 bool wasClipped = false; | |
| 773 gfx::PointF unzoomedScreenspacePoint = MathUtil::projectPoint(inverseImplTra
nsform, zoomedScreenspacePoint, wasClipped); | |
| 774 DCHECK(!wasClipped); | |
| 775 | |
| 776 // Convert back to logical pixels for hit testing. | |
| 777 gfx::PointF unzoomedViewportPoint = gfx::ScalePoint(unzoomedScreenspacePoint
, 1 / deviceScaleFactor()); | |
| 778 | |
| 779 return unzoomedViewportPoint; | |
| 780 } | |
| 781 | |
| 782 void LayerTreeHost::setImplTransform(const gfx::Transform& transform) | 755 void LayerTreeHost::setImplTransform(const gfx::Transform& transform) |
| 783 { | 756 { |
| 784 m_implTransform = transform; | 757 m_implTransform = transform; |
| 785 } | 758 } |
| 786 | 759 |
| 787 void LayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context) | 760 void LayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context) |
| 788 { | 761 { |
| 789 if (m_animating) | 762 if (m_animating) |
| 790 return; | 763 return; |
| 791 | 764 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 850 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 878 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 851 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 879 } | 852 } |
| 880 | 853 |
| 881 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() | 854 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() |
| 882 { | 855 { |
| 883 return m_proxy->capturePicture(); | 856 return m_proxy->capturePicture(); |
| 884 } | 857 } |
| 885 | 858 |
| 886 } // namespace cc | 859 } // namespace cc |
| OLD | NEW |