OLD | NEW |
---|---|
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 Loading... | |
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 = (layer_tree_impl()->CurrentFrameTimeTicks() - | |
enne (OOO)
2013/04/22 19:19:40
current_frame_time_in_seconds?
Also, can you use
danakj
2013/04/22 19:26:53
ok
| |
269 base::TimeTicks()).InSecondsF(); | |
270 | |
271 bool tiling_needs_update = false; | |
272 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | |
273 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime(current_frame_time)) { | |
274 tiling_needs_update = true; | |
275 break; | |
276 } | |
277 } | |
278 if (!tiling_needs_update) | |
279 return; | |
280 | |
268 UpdateLCDTextStatus(); | 281 UpdateLCDTextStatus(); |
269 | 282 |
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(); | 283 gfx::Transform current_screen_space_transform = screen_space_transform(); |
275 | 284 |
276 gfx::Rect viewport_in_content_space; | 285 gfx::Rect viewport_in_content_space; |
277 gfx::Transform screen_to_layer(gfx::Transform::kSkipInitialization); | 286 gfx::Transform screen_to_layer(gfx::Transform::kSkipInitialization); |
278 if (screen_space_transform().GetInverse(&screen_to_layer)) { | 287 if (screen_space_transform().GetInverse(&screen_to_layer)) { |
279 gfx::Rect device_viewport(layer_tree_impl()->device_viewport_size()); | 288 gfx::Rect device_viewport(layer_tree_impl()->device_viewport_size()); |
280 viewport_in_content_space = gfx::ToEnclosingRect( | 289 viewport_in_content_space = gfx::ToEnclosingRect( |
281 MathUtil::ProjectClippedRect(screen_to_layer, device_viewport)); | 290 MathUtil::ProjectClippedRect(screen_to_layer, device_viewport)); |
282 } | 291 } |
283 | 292 |
284 WhichTree tree = | 293 WhichTree tree = |
285 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; | 294 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; |
286 bool store_screen_space_quads_on_tiles = | 295 bool store_screen_space_quads_on_tiles = |
287 layer_tree_impl()->debug_state().trace_all_rendered_frames; | 296 layer_tree_impl()->debug_state().trace_all_rendered_frames; |
288 size_t max_tiles_for_interest_area = | 297 size_t max_tiles_for_interest_area = |
289 layer_tree_impl()->settings().max_tiles_for_interest_area; | 298 layer_tree_impl()->settings().max_tiles_for_interest_area; |
290 tilings_->UpdateTilePriorities( | 299 tilings_->UpdateTilePriorities( |
291 tree, | 300 tree, |
292 layer_tree_impl()->device_viewport_size(), | 301 layer_tree_impl()->device_viewport_size(), |
293 viewport_in_content_space, | 302 viewport_in_content_space, |
294 visible_content_rect(), | 303 visible_content_rect(), |
295 last_bounds_, | 304 last_bounds_, |
296 bounds(), | 305 bounds(), |
297 last_content_scale_, | 306 last_content_scale_, |
298 contents_scale_x(), | 307 contents_scale_x(), |
299 last_screen_space_transform_, | 308 last_screen_space_transform_, |
300 current_screen_space_transform, | 309 current_screen_space_transform, |
301 current_source_frame_number, | |
302 current_frame_time, | 310 current_frame_time, |
303 store_screen_space_quads_on_tiles, | 311 store_screen_space_quads_on_tiles, |
304 max_tiles_for_interest_area); | 312 max_tiles_for_interest_area); |
305 | 313 |
306 last_screen_space_transform_ = current_screen_space_transform; | 314 last_screen_space_transform_ = current_screen_space_transform; |
307 last_bounds_ = bounds(); | 315 last_bounds_ = bounds(); |
308 last_content_scale_ = contents_scale_x(); | 316 last_content_scale_ = contents_scale_x(); |
309 } | 317 } |
310 | 318 |
311 void PictureLayerImpl::DidBecomeActive() { | 319 void PictureLayerImpl::DidBecomeActive() { |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
906 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { | 914 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { |
907 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 915 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
908 LayerImpl::AsValueInto(state.get()); | 916 LayerImpl::AsValueInto(state.get()); |
909 | 917 |
910 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); | 918 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); |
911 state->Set("tilings", tilings_->AsValue().release()); | 919 state->Set("tilings", tilings_->AsValue().release()); |
912 return state.PassAs<base::Value>(); | 920 return state.PassAs<base::Value>(); |
913 } | 921 } |
914 | 922 |
915 } // namespace cc | 923 } // namespace cc |
OLD | NEW |