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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 2490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2501 } else { | 2501 } else { |
2502 active_tree_->SetCurrentlyScrollingLayer( | 2502 active_tree_->SetCurrentlyScrollingLayer( |
2503 active_tree_->InnerViewportScrollLayer()); | 2503 active_tree_->InnerViewportScrollLayer()); |
2504 } | 2504 } |
2505 if (top_controls_manager_) | 2505 if (top_controls_manager_) |
2506 top_controls_manager_->PinchBegin(); | 2506 top_controls_manager_->PinchBegin(); |
2507 } | 2507 } |
2508 | 2508 |
2509 void LayerTreeHostImpl::PinchGestureUpdate(float magnify_delta, | 2509 void LayerTreeHostImpl::PinchGestureUpdate(float magnify_delta, |
2510 gfx::Point anchor) { | 2510 gfx::Point anchor) { |
| 2511 if (!InnerViewportScrollLayer()) |
| 2512 return; |
| 2513 |
2511 TRACE_EVENT0("cc", "LayerTreeHostImpl::PinchGestureUpdate"); | 2514 TRACE_EVENT0("cc", "LayerTreeHostImpl::PinchGestureUpdate"); |
2512 | 2515 |
2513 DCHECK(InnerViewportScrollLayer()); | |
2514 | |
2515 // Keep the center-of-pinch anchor specified by (x, y) in a stable | 2516 // Keep the center-of-pinch anchor specified by (x, y) in a stable |
2516 // position over the course of the magnify. | 2517 // position over the course of the magnify. |
2517 float page_scale_delta = active_tree_->page_scale_delta(); | 2518 float page_scale_delta = active_tree_->page_scale_delta(); |
2518 gfx::PointF previous_scale_anchor = | 2519 gfx::PointF previous_scale_anchor = |
2519 gfx::ScalePoint(anchor, 1.f / page_scale_delta); | 2520 gfx::ScalePoint(anchor, 1.f / page_scale_delta); |
2520 active_tree_->SetPageScaleDelta(page_scale_delta * magnify_delta); | 2521 active_tree_->SetPageScaleDelta(page_scale_delta * magnify_delta); |
2521 page_scale_delta = active_tree_->page_scale_delta(); | 2522 page_scale_delta = active_tree_->page_scale_delta(); |
2522 gfx::PointF new_scale_anchor = | 2523 gfx::PointF new_scale_anchor = |
2523 gfx::ScalePoint(anchor, 1.f / page_scale_delta); | 2524 gfx::ScalePoint(anchor, 1.f / page_scale_delta); |
2524 gfx::Vector2dF move = previous_scale_anchor - new_scale_anchor; | 2525 gfx::Vector2dF move = previous_scale_anchor - new_scale_anchor; |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2998 swap_promise_monitor_.erase(monitor); | 2999 swap_promise_monitor_.erase(monitor); |
2999 } | 3000 } |
3000 | 3001 |
3001 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 3002 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
3002 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3003 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3003 for (; it != swap_promise_monitor_.end(); it++) | 3004 for (; it != swap_promise_monitor_.end(); it++) |
3004 (*it)->OnSetNeedsRedrawOnImpl(); | 3005 (*it)->OnSetNeedsRedrawOnImpl(); |
3005 } | 3006 } |
3006 | 3007 |
3007 } // namespace cc | 3008 } // namespace cc |
OLD | NEW |