| 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 "cc/font_atlas.h" | 10 #include "cc/font_atlas.h" |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 else | 727 else |
| 728 layer->setScrollOffset(layer->scrollOffset() + info.scrolls[i].scrol
lDelta); | 728 layer->setScrollOffset(layer->scrollOffset() + info.scrolls[i].scrol
lDelta); |
| 729 } | 729 } |
| 730 if (!rootScrollDelta.IsZero() || info.pageScaleDelta != 1) | 730 if (!rootScrollDelta.IsZero() || info.pageScaleDelta != 1) |
| 731 m_client->applyScrollAndScale(rootScrollDelta, info.pageScaleDelta); | 731 m_client->applyScrollAndScale(rootScrollDelta, info.pageScaleDelta); |
| 732 } | 732 } |
| 733 | 733 |
| 734 gfx::PointF LayerTreeHost::adjustEventPointForPinchZoom(const gfx::PointF& zoome
dViewportPoint) | 734 gfx::PointF LayerTreeHost::adjustEventPointForPinchZoom(const gfx::PointF& zoome
dViewportPoint) |
| 735 const | 735 const |
| 736 { | 736 { |
| 737 if (m_implTransform.isIdentity()) | 737 if (m_implTransform.IsIdentity()) |
| 738 return zoomedViewportPoint; | 738 return zoomedViewportPoint; |
| 739 | 739 |
| 740 DCHECK(m_implTransform.isInvertible()); | 740 DCHECK(m_implTransform.IsInvertible()); |
| 741 | 741 |
| 742 // Scale to screen space before applying implTransform inverse. | 742 // Scale to screen space before applying implTransform inverse. |
| 743 gfx::PointF zoomedScreenspacePoint = gfx::ScalePoint(zoomedViewportPoint, de
viceScaleFactor()); | 743 gfx::PointF zoomedScreenspacePoint = gfx::ScalePoint(zoomedViewportPoint, de
viceScaleFactor()); |
| 744 WebKit::WebTransformationMatrix inverseImplTransform = m_implTransform.inver
se(); | 744 gfx::Transform inverseImplTransform = MathUtil::inverse(m_implTransform); |
| 745 | 745 |
| 746 bool wasClipped = false; | 746 bool wasClipped = false; |
| 747 gfx::PointF unzoomedScreenspacePoint = MathUtil::projectPoint(inverseImplTra
nsform, zoomedScreenspacePoint, wasClipped); | 747 gfx::PointF unzoomedScreenspacePoint = MathUtil::projectPoint(inverseImplTra
nsform, zoomedScreenspacePoint, wasClipped); |
| 748 DCHECK(!wasClipped); | 748 DCHECK(!wasClipped); |
| 749 | 749 |
| 750 // Convert back to logical pixels for hit testing. | 750 // Convert back to logical pixels for hit testing. |
| 751 gfx::PointF unzoomedViewportPoint = gfx::ScalePoint(unzoomedScreenspacePoint
, 1 / deviceScaleFactor()); | 751 gfx::PointF unzoomedViewportPoint = gfx::ScalePoint(unzoomedScreenspacePoint
, 1 / deviceScaleFactor()); |
| 752 | 752 |
| 753 return unzoomedViewportPoint; | 753 return unzoomedViewportPoint; |
| 754 } | 754 } |
| 755 | 755 |
| 756 void LayerTreeHost::setImplTransform(const WebKit::WebTransformationMatrix& tran
sform) | 756 void LayerTreeHost::setImplTransform(const gfx::Transform& transform) |
| 757 { | 757 { |
| 758 m_implTransform = transform; | 758 m_implTransform = transform; |
| 759 } | 759 } |
| 760 | 760 |
| 761 void LayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context) | 761 void LayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context) |
| 762 { | 762 { |
| 763 if (m_animating) | 763 if (m_animating) |
| 764 return; | 764 return; |
| 765 | 765 |
| 766 DCHECK(context); | 766 DCHECK(context); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 else | 856 else |
| 857 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); | 857 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); |
| 858 } | 858 } |
| 859 } | 859 } |
| 860 | 860 |
| 861 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 861 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 862 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 862 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 863 } | 863 } |
| 864 | 864 |
| 865 } // namespace cc | 865 } // namespace cc |
| OLD | NEW |