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

Side by Side Diff: cc/layers/picture_layer_impl.cc

Issue 12259027: cc: Simplify the logic for deciding to update tile priorities. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: in_seconds Created 7 years, 8 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 } 258 }
259 259
260 void PictureLayerImpl::DumpLayerProperties(std::string*, int indent) const { 260 void PictureLayerImpl::DumpLayerProperties(std::string*, int indent) const {
261 // TODO(enne): implement me 261 // TODO(enne): implement me
262 } 262 }
263 263
264 void PictureLayerImpl::UpdateTilePriorities() { 264 void PictureLayerImpl::UpdateTilePriorities() {
265 if (!tilings_->num_tilings()) 265 if (!tilings_->num_tilings())
266 return; 266 return;
267 267
268 double current_frame_time_in_seconds =
269 (layer_tree_impl()->CurrentFrameTimeTicks() -
270 base::TimeTicks()).InSecondsF();
271
272 bool tiling_needs_update = false;
273 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
274 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime(
275 current_frame_time_in_seconds)) {
276 tiling_needs_update = true;
277 break;
278 }
279 }
280 if (!tiling_needs_update)
281 return;
282
268 UpdateLCDTextStatus(); 283 UpdateLCDTextStatus();
269 284
270 int current_source_frame_number = layer_tree_impl()->source_frame_number();
271 double current_frame_time = (layer_tree_impl()->CurrentFrameTimeTicks() -
272 base::TimeTicks()).InSecondsF();
273
274 gfx::Transform current_screen_space_transform = screen_space_transform(); 285 gfx::Transform current_screen_space_transform = screen_space_transform();
275 286
276 gfx::Rect viewport_in_content_space; 287 gfx::Rect viewport_in_content_space;
277 gfx::Transform screen_to_layer(gfx::Transform::kSkipInitialization); 288 gfx::Transform screen_to_layer(gfx::Transform::kSkipInitialization);
278 if (screen_space_transform().GetInverse(&screen_to_layer)) { 289 if (screen_space_transform().GetInverse(&screen_to_layer)) {
279 gfx::Rect device_viewport(layer_tree_impl()->device_viewport_size()); 290 gfx::Rect device_viewport(layer_tree_impl()->device_viewport_size());
280 viewport_in_content_space = gfx::ToEnclosingRect( 291 viewport_in_content_space = gfx::ToEnclosingRect(
281 MathUtil::ProjectClippedRect(screen_to_layer, device_viewport)); 292 MathUtil::ProjectClippedRect(screen_to_layer, device_viewport));
282 } 293 }
283 294
284 WhichTree tree = 295 WhichTree tree =
285 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; 296 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE;
286 bool store_screen_space_quads_on_tiles = 297 bool store_screen_space_quads_on_tiles =
287 layer_tree_impl()->debug_state().trace_all_rendered_frames; 298 layer_tree_impl()->debug_state().trace_all_rendered_frames;
288 size_t max_tiles_for_interest_area = 299 size_t max_tiles_for_interest_area =
289 layer_tree_impl()->settings().max_tiles_for_interest_area; 300 layer_tree_impl()->settings().max_tiles_for_interest_area;
290 tilings_->UpdateTilePriorities( 301 tilings_->UpdateTilePriorities(
291 tree, 302 tree,
292 layer_tree_impl()->device_viewport_size(), 303 layer_tree_impl()->device_viewport_size(),
293 viewport_in_content_space, 304 viewport_in_content_space,
294 visible_content_rect(), 305 visible_content_rect(),
295 last_bounds_, 306 last_bounds_,
296 bounds(), 307 bounds(),
297 last_content_scale_, 308 last_content_scale_,
298 contents_scale_x(), 309 contents_scale_x(),
299 last_screen_space_transform_, 310 last_screen_space_transform_,
300 current_screen_space_transform, 311 current_screen_space_transform,
301 current_source_frame_number, 312 current_frame_time_in_seconds,
302 current_frame_time,
303 store_screen_space_quads_on_tiles, 313 store_screen_space_quads_on_tiles,
304 max_tiles_for_interest_area); 314 max_tiles_for_interest_area);
305 315
306 last_screen_space_transform_ = current_screen_space_transform; 316 last_screen_space_transform_ = current_screen_space_transform;
307 last_bounds_ = bounds(); 317 last_bounds_ = bounds();
308 last_content_scale_ = contents_scale_x(); 318 last_content_scale_ = contents_scale_x();
309 } 319 }
310 320
311 void PictureLayerImpl::DidBecomeActive() { 321 void PictureLayerImpl::DidBecomeActive() {
312 LayerImpl::DidBecomeActive(); 322 LayerImpl::DidBecomeActive();
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { 916 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const {
907 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 917 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
908 LayerImpl::AsValueInto(state.get()); 918 LayerImpl::AsValueInto(state.get());
909 919
910 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); 920 state->SetDouble("ideal_contents_scale", ideal_contents_scale_);
911 state->Set("tilings", tilings_->AsValue().release()); 921 state->Set("tilings", tilings_->AsValue().release());
912 return state.PassAs<base::Value>(); 922 return state.PassAs<base::Value>();
913 } 923 }
914 924
915 } // namespace cc 925 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698