| 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 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 gfx::PointF LayerTreeHost::adjustEventPointForPinchZoom(const gfx::PointF& zoome
dViewportPoint) | 789 gfx::PointF LayerTreeHost::adjustEventPointForPinchZoom(const gfx::PointF& zoome
dViewportPoint) |
| 790 const | 790 const |
| 791 { | 791 { |
| 792 if (m_implTransform.IsIdentity()) | 792 if (m_implTransform.IsIdentity()) |
| 793 return zoomedViewportPoint; | 793 return zoomedViewportPoint; |
| 794 | 794 |
| 795 DCHECK(m_implTransform.IsInvertible()); | 795 DCHECK(m_implTransform.IsInvertible()); |
| 796 | 796 |
| 797 // Scale to screen space before applying implTransform inverse. | 797 // Scale to screen space before applying implTransform inverse. |
| 798 gfx::PointF zoomedScreenspacePoint = gfx::ScalePoint(zoomedViewportPoint, de
viceScaleFactor()); | 798 gfx::PointF zoomedScreenspacePoint = gfx::ScalePoint(zoomedViewportPoint, de
viceScaleFactor()); |
| 799 gfx::Transform inverseImplTransform = MathUtil::inverse(m_implTransform); | 799 |
| 800 // Note carefully, this remains an identity matrix if m_implTransform is uni
nvertible. |
| 801 // TODO: see if there is something more reasonable we can do if m_implTransf
orm really is uninvertible. |
| 802 // or perhaps we can just DCHECK that m_implTransform should be invert
ible? |
| 803 gfx::Transform inverseImplTransform(gfx::Transform::kSkipInitialization); |
| 804 if (!m_implTransform.GetInverse(&inverseImplTransform)) |
| 805 inverseImplTransform.MakeIdentity(); |
| 800 | 806 |
| 801 bool wasClipped = false; | 807 bool wasClipped = false; |
| 802 gfx::PointF unzoomedScreenspacePoint = MathUtil::projectPoint(inverseImplTra
nsform, zoomedScreenspacePoint, wasClipped); | 808 gfx::PointF unzoomedScreenspacePoint = MathUtil::projectPoint(inverseImplTra
nsform, zoomedScreenspacePoint, wasClipped); |
| 803 DCHECK(!wasClipped); | 809 DCHECK(!wasClipped); |
| 804 | 810 |
| 805 // Convert back to logical pixels for hit testing. | 811 // Convert back to logical pixels for hit testing. |
| 806 gfx::PointF unzoomedViewportPoint = gfx::ScalePoint(unzoomedScreenspacePoint
, 1 / deviceScaleFactor()); | 812 gfx::PointF unzoomedViewportPoint = gfx::ScalePoint(unzoomedScreenspacePoint
, 1 / deviceScaleFactor()); |
| 807 | 813 |
| 808 return unzoomedViewportPoint; | 814 return unzoomedViewportPoint; |
| 809 } | 815 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 else | 900 else |
| 895 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); | 901 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); |
| 896 } | 902 } |
| 897 } | 903 } |
| 898 | 904 |
| 899 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 905 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 900 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 906 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 901 } | 907 } |
| 902 | 908 |
| 903 } // namespace cc | 909 } // namespace cc |
| OLD | NEW |