Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 15579002: Implement transform/clip support for Android WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address joth's code review Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy()); 1028 EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy());
1029 } else { 1029 } else {
1030 DCHECK(proxy_->IsImplThread()); 1030 DCHECK(proxy_->IsImplThread());
1031 EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy()); 1031 EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy());
1032 } 1032 }
1033 1033
1034 if (needs_commit) 1034 if (needs_commit)
1035 client_->SetNeedsCommitOnImplThread(); 1035 client_->SetNeedsCommitOnImplThread();
1036 } 1036 }
1037 1037
1038 void LayerTreeHostImpl::SetDeviceTransformAndClip(
1039 const gfx::Transform& transform,
1040 gfx::Rect clip) {
1041 device_transform_ = transform;
1042 device_clip_ = clip;
1043 }
1044
1038 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) { 1045 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) {
1039 client_->SetNeedsRedrawRectOnImplThread(damage_rect); 1046 client_->SetNeedsRedrawRectOnImplThread(damage_rect);
1040 } 1047 }
1041 1048
1042 void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase, 1049 void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase,
1043 base::TimeDelta interval) { 1050 base::TimeDelta interval) {
1044 client_->OnVSyncParametersChanged(timebase, interval); 1051 client_->OnVSyncParametersChanged(timebase, interval);
1045 } 1052 }
1046 1053
1047 void LayerTreeHostImpl::BeginFrame(base::TimeTicks frame_time) { 1054 void LayerTreeHostImpl::BeginFrame(base::TimeTicks frame_time) {
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 1516
1510 void LayerTreeHostImpl::SetDeviceScaleFactor(float device_scale_factor) { 1517 void LayerTreeHostImpl::SetDeviceScaleFactor(float device_scale_factor) {
1511 if (device_scale_factor == device_scale_factor_) 1518 if (device_scale_factor == device_scale_factor_)
1512 return; 1519 return;
1513 device_scale_factor_ = device_scale_factor; 1520 device_scale_factor_ = device_scale_factor;
1514 1521
1515 UpdateMaxScrollOffset(); 1522 UpdateMaxScrollOffset();
1516 SetFullRootLayerDamage(); 1523 SetFullRootLayerDamage();
1517 } 1524 }
1518 1525
1526 gfx::Rect LayerTreeHostImpl::DeviceClip() const {
1527 if (device_clip_.IsEmpty())
1528 return gfx::Rect(device_viewport_size_);
1529
1530 return device_clip_;
1531 }
1532
1533 gfx::Transform LayerTreeHostImpl::DeviceTransform() const {
1534 gfx::Transform device_transform = device_transform_;
1535 device_transform.Scale(device_scale_factor_, device_scale_factor_);
1536 return device_transform;
1537 }
1538
1539 gfx::Vector2d LayerTreeHostImpl::DeviceViewportOffset() const {
1540 return gfx::Vector2d(device_clip_.x(), device_clip_.y());
1541 }
1542
1519 void LayerTreeHostImpl::UpdateMaxScrollOffset() { 1543 void LayerTreeHostImpl::UpdateMaxScrollOffset() {
1520 active_tree_->UpdateMaxScrollOffset(); 1544 active_tree_->UpdateMaxScrollOffset();
1521 } 1545 }
1522 1546
1523 void LayerTreeHostImpl::DidChangeTopControlsPosition() { 1547 void LayerTreeHostImpl::DidChangeTopControlsPosition() {
1524 client_->SetNeedsRedrawOnImplThread(); 1548 client_->SetNeedsRedrawOnImplThread();
1525 active_tree_->set_needs_update_draw_properties(); 1549 active_tree_->set_needs_update_draw_properties();
1526 SetFullRootLayerDamage(); 1550 SetFullRootLayerDamage();
1527 } 1551 }
1528 1552
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 } 2260 }
2237 2261
2238 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { 2262 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) {
2239 if (debug_state_.continuous_painting != debug_state.continuous_painting) 2263 if (debug_state_.continuous_painting != debug_state.continuous_painting)
2240 paint_time_counter_->ClearHistory(); 2264 paint_time_counter_->ClearHistory();
2241 2265
2242 debug_state_ = debug_state; 2266 debug_state_ = debug_state;
2243 } 2267 }
2244 2268
2245 } // namespace cc 2269 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698