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

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

Powered by Google App Engine
This is Rietveld 408576698