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

Side by Side Diff: cc/layer_tree_impl.cc

Issue 12212156: cc: Only allow trees created at the current viewport size to draw. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« cc/layer_tree_host_impl.cc ('K') | « cc/layer_tree_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/layer_tree_impl.h" 5 #include "cc/layer_tree_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/heads_up_display_layer_impl.h" 8 #include "cc/heads_up_display_layer_impl.h"
9 #include "cc/layer_tree_host_common.h" 9 #include "cc/layer_tree_host_common.h"
10 #include "cc/layer_tree_host_impl.h" 10 #include "cc/layer_tree_host_impl.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 set_needs_update_draw_properties(); 85 set_needs_update_draw_properties();
86 return root_layer_.Pass(); 86 return root_layer_.Pass();
87 } 87 }
88 88
89 void LayerTreeImpl::pushPropertiesTo(LayerTreeImpl* target_tree) { 89 void LayerTreeImpl::pushPropertiesTo(LayerTreeImpl* target_tree) {
90 target_tree->SetPageScaleFactorAndLimits( 90 target_tree->SetPageScaleFactorAndLimits(
91 page_scale_factor(), min_page_scale_factor(), max_page_scale_factor()); 91 page_scale_factor(), min_page_scale_factor(), max_page_scale_factor());
92 target_tree->SetPageScaleDelta( 92 target_tree->SetPageScaleDelta(
93 target_tree->page_scale_delta() / target_tree->sent_page_scale_delta()); 93 target_tree->page_scale_delta() / target_tree->sent_page_scale_delta());
94 target_tree->set_sent_page_scale_delta(1); 94 target_tree->set_sent_page_scale_delta(1);
95 target_tree->SetDeviceViewportSize(device_viewport_size_);
95 96
96 // This should match the property synchronization in 97 // This should match the property synchronization in
97 // LayerTreeHost::finishCommitOnImplThread(). 98 // LayerTreeHost::finishCommitOnImplThread().
98 target_tree->set_source_frame_number(source_frame_number()); 99 target_tree->set_source_frame_number(source_frame_number());
99 target_tree->set_background_color(background_color()); 100 target_tree->set_background_color(background_color());
100 target_tree->set_has_transparent_background(has_transparent_background()); 101 target_tree->set_has_transparent_background(has_transparent_background());
101 102
102 if (ContentsTexturesPurged()) 103 if (ContentsTexturesPurged())
103 target_tree->SetContentsTexturesPurged(); 104 target_tree->SetContentsTexturesPurged();
104 else 105 else
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 ClearRenderSurfacesOnLayerImplRecursive(current->children()[i]); 263 ClearRenderSurfacesOnLayerImplRecursive(current->children()[i]);
263 current->clearRenderSurface(); 264 current->clearRenderSurface();
264 } 265 }
265 266
266 void LayerTreeImpl::ClearRenderSurfaces() { 267 void LayerTreeImpl::ClearRenderSurfaces() {
267 ClearRenderSurfacesOnLayerImplRecursive(RootLayer()); 268 ClearRenderSurfacesOnLayerImplRecursive(RootLayer());
268 render_surface_layer_list_.clear(); 269 render_surface_layer_list_.clear();
269 set_needs_update_draw_properties(); 270 set_needs_update_draw_properties();
270 } 271 }
271 272
273 void LayerTreeImpl::SetDeviceViewportSize(const gfx::Size& device_viewport_size)
274 {
275 if (device_viewport_size_ == device_viewport_size)
276 return;
277
278 device_viewport_size_ = device_viewport_size;
279
280 UpdateMaxScrollOffset();
281
282 layer_tree_host_impl_->OnCanDrawStateChangedForTree(this);
283 }
284
272 bool LayerTreeImpl::AreVisibleResourcesReady() const { 285 bool LayerTreeImpl::AreVisibleResourcesReady() const {
273 TRACE_EVENT0("cc", "LayerTreeImpl::AreVisibleResourcesReady"); 286 TRACE_EVENT0("cc", "LayerTreeImpl::AreVisibleResourcesReady");
274 287
275 typedef LayerIterator<LayerImpl, 288 typedef LayerIterator<LayerImpl,
276 std::vector<LayerImpl*>, 289 std::vector<LayerImpl*>,
277 RenderSurfaceImpl, 290 RenderSurfaceImpl,
278 LayerIteratorActions::BackToFront> LayerIteratorType; 291 LayerIteratorActions::BackToFront> LayerIteratorType;
279 LayerIteratorType end = LayerIteratorType::end(&render_surface_layer_list_); 292 LayerIteratorType end = LayerIteratorType::end(&render_surface_layer_list_);
280 for (LayerIteratorType it = LayerIteratorType::begin( 293 for (LayerIteratorType it = LayerIteratorType::begin(
281 &render_surface_layer_list_); it != end; ++it) { 294 &render_surface_layer_list_); it != end; ++it) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 434 }
422 435
423 const LayerTreeDebugState& LayerTreeImpl::debug_state() const { 436 const LayerTreeDebugState& LayerTreeImpl::debug_state() const {
424 return layer_tree_host_impl_->debugState(); 437 return layer_tree_host_impl_->debugState();
425 } 438 }
426 439
427 float LayerTreeImpl::device_scale_factor() const { 440 float LayerTreeImpl::device_scale_factor() const {
428 return layer_tree_host_impl_->deviceScaleFactor(); 441 return layer_tree_host_impl_->deviceScaleFactor();
429 } 442 }
430 443
431 const gfx::Size& LayerTreeImpl::device_viewport_size() const {
432 return layer_tree_host_impl_->deviceViewportSize();
433 }
434
435 const gfx::Size& LayerTreeImpl::layout_viewport_size() const {
436 return layer_tree_host_impl_->layoutViewportSize();
437 }
438
439 std::string LayerTreeImpl::layer_tree_as_text() const { 444 std::string LayerTreeImpl::layer_tree_as_text() const {
440 return layer_tree_host_impl_->layerTreeAsText(); 445 return layer_tree_host_impl_->layerTreeAsText();
441 } 446 }
442 447
443 DebugRectHistory* LayerTreeImpl::debug_rect_history() const { 448 DebugRectHistory* LayerTreeImpl::debug_rect_history() const {
444 return layer_tree_host_impl_->debugRectHistory(); 449 return layer_tree_host_impl_->debugRectHistory();
445 } 450 }
446 451
447 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { 452 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const {
448 return layer_tree_host_impl_->animationRegistrar(); 453 return layer_tree_host_impl_->animationRegistrar();
449 } 454 }
450 455
451 } // namespace cc 456 } // namespace cc
OLDNEW
« cc/layer_tree_host_impl.cc ('K') | « cc/layer_tree_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698