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

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: Style nits 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
« no previous file with comments | « 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->SetViewportSize(layout_viewport_size_, 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::SetViewportSize(gfx::Size layout_viewport_size,
274 gfx::Size device_viewport_size) {
275 if (device_viewport_size_ == device_viewport_size &&
danakj 2013/02/13 08:19:54 sorry, but 2 space indent here :|
276 layout_viewport_size_ == layout_viewport_size)
277 return;
278
279 layout_viewport_size_ = layout_viewport_size;
280 device_viewport_size_ = device_viewport_size;
281
282 UpdateMaxScrollOffset();
283
284 if (IsActiveTree() && layer_tree_host_impl_->renderer())
285 layer_tree_host_impl_->renderer()->viewportChanged();
286
287 layer_tree_host_impl_->OnCanDrawStateChangedForTree(this);
288 }
289
272 bool LayerTreeImpl::AreVisibleResourcesReady() const { 290 bool LayerTreeImpl::AreVisibleResourcesReady() const {
273 TRACE_EVENT0("cc", "LayerTreeImpl::AreVisibleResourcesReady"); 291 TRACE_EVENT0("cc", "LayerTreeImpl::AreVisibleResourcesReady");
274 292
275 typedef LayerIterator<LayerImpl, 293 typedef LayerIterator<LayerImpl,
276 std::vector<LayerImpl*>, 294 std::vector<LayerImpl*>,
277 RenderSurfaceImpl, 295 RenderSurfaceImpl,
278 LayerIteratorActions::BackToFront> LayerIteratorType; 296 LayerIteratorActions::BackToFront> LayerIteratorType;
279 LayerIteratorType end = LayerIteratorType::end(&render_surface_layer_list_); 297 LayerIteratorType end = LayerIteratorType::end(&render_surface_layer_list_);
280 for (LayerIteratorType it = LayerIteratorType::begin( 298 for (LayerIteratorType it = LayerIteratorType::begin(
281 &render_surface_layer_list_); it != end; ++it) { 299 &render_surface_layer_list_); it != end; ++it) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 439 }
422 440
423 const LayerTreeDebugState& LayerTreeImpl::debug_state() const { 441 const LayerTreeDebugState& LayerTreeImpl::debug_state() const {
424 return layer_tree_host_impl_->debugState(); 442 return layer_tree_host_impl_->debugState();
425 } 443 }
426 444
427 float LayerTreeImpl::device_scale_factor() const { 445 float LayerTreeImpl::device_scale_factor() const {
428 return layer_tree_host_impl_->deviceScaleFactor(); 446 return layer_tree_host_impl_->deviceScaleFactor();
429 } 447 }
430 448
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 { 449 std::string LayerTreeImpl::layer_tree_as_text() const {
440 return layer_tree_host_impl_->layerTreeAsText(); 450 return layer_tree_host_impl_->layerTreeAsText();
441 } 451 }
442 452
443 DebugRectHistory* LayerTreeImpl::debug_rect_history() const { 453 DebugRectHistory* LayerTreeImpl::debug_rect_history() const {
444 return layer_tree_host_impl_->debugRectHistory(); 454 return layer_tree_host_impl_->debugRectHistory();
445 } 455 }
446 456
447 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { 457 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const {
448 return layer_tree_host_impl_->animationRegistrar(); 458 return layer_tree_host_impl_->animationRegistrar();
449 } 459 }
450 460
451 } // namespace cc 461 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698