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/resources/picture_layer_tiling.h" | 5 #include "cc/resources/picture_layer_tiling.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Clone() const { | 24 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Clone() const { |
25 return make_scoped_ptr(new PictureLayerTiling(*this)); | 25 return make_scoped_ptr(new PictureLayerTiling(*this)); |
26 } | 26 } |
27 | 27 |
28 PictureLayerTiling::PictureLayerTiling(float contents_scale) | 28 PictureLayerTiling::PictureLayerTiling(float contents_scale) |
29 : client_(NULL), | 29 : client_(NULL), |
30 contents_scale_(contents_scale), | 30 contents_scale_(contents_scale), |
31 tiling_data_(gfx::Size(), gfx::Size(), true), | 31 tiling_data_(gfx::Size(), gfx::Size(), true), |
32 resolution_(NON_IDEAL_RESOLUTION), | 32 resolution_(NON_IDEAL_RESOLUTION), |
33 last_source_frame_number_(0), | 33 last_source_frame_number_(0), |
34 last_impl_frame_time_(0) { | 34 last_impl_frame_time_(0.0) { |
35 } | 35 } |
36 | 36 |
37 PictureLayerTiling::~PictureLayerTiling() { | 37 PictureLayerTiling::~PictureLayerTiling() { |
38 } | 38 } |
39 | 39 |
40 void PictureLayerTiling::SetClient(PictureLayerTilingClient* client) { | 40 void PictureLayerTiling::SetClient(PictureLayerTilingClient* client) { |
41 client_ = client; | 41 client_ = client; |
42 } | 42 } |
43 | 43 |
44 gfx::Rect PictureLayerTiling::ContentRect() const { | 44 gfx::Rect PictureLayerTiling::ContentRect() const { |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 float current_layer_contents_scale, | 349 float current_layer_contents_scale, |
350 const gfx::Transform& last_screen_transform, | 350 const gfx::Transform& last_screen_transform, |
351 const gfx::Transform& current_screen_transform, | 351 const gfx::Transform& current_screen_transform, |
352 int current_source_frame_number, | 352 int current_source_frame_number, |
353 double current_frame_time, | 353 double current_frame_time, |
354 bool store_screen_space_quads_on_tiles, | 354 bool store_screen_space_quads_on_tiles, |
355 size_t max_tiles_for_interest_area) { | 355 size_t max_tiles_for_interest_area) { |
356 if (ContentRect().IsEmpty()) | 356 if (ContentRect().IsEmpty()) |
357 return; | 357 return; |
358 | 358 |
359 bool first_update_in_new_source_frame = | |
360 current_source_frame_number != last_source_frame_number_; | |
361 | |
362 bool first_update_in_new_impl_frame = | |
363 current_frame_time != last_impl_frame_time_; | |
364 | |
365 // In pending tree, this is always called. We update priorities: | |
366 // - Immediately after a commit (first_update_in_new_source_frame). | |
367 // - On animation ticks after the first frame in the tree | |
368 // (first_update_in_new_impl_frame). | |
369 // In active tree, this is only called during draw. We update priorities: | |
370 // - On draw if properties were not already computed by the pending tree | |
371 // and activated for the frame (first_update_in_new_impl_frame). | |
372 if (!first_update_in_new_impl_frame && !first_update_in_new_source_frame) | |
373 return; | |
374 | |
375 double time_delta = 0; | 359 double time_delta = 0; |
376 if (last_impl_frame_time_ != 0 && last_layer_bounds == current_layer_bounds) | 360 if (last_impl_frame_time_ != 0 && last_layer_bounds == current_layer_bounds) |
377 time_delta = current_frame_time - last_impl_frame_time_; | 361 time_delta = current_frame_time - last_impl_frame_time_; |
378 | 362 |
379 gfx::Rect viewport_in_content_space = | 363 gfx::Rect viewport_in_content_space = |
380 gfx::ToEnclosingRect(gfx::ScaleRect(viewport_in_layer_space, | 364 gfx::ToEnclosingRect(gfx::ScaleRect(viewport_in_layer_space, |
381 contents_scale_)); | 365 contents_scale_)); |
382 gfx::Rect visible_content_rect = | 366 gfx::Rect visible_content_rect = |
383 gfx::ToEnclosingRect(gfx::ScaleRect(visible_layer_rect, | 367 gfx::ToEnclosingRect(gfx::ScaleRect(visible_layer_rect, |
384 contents_scale_)); | 368 contents_scale_)); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 | 637 |
654 // If our delta is less then our event distance, we're done. | 638 // If our delta is less then our event distance, we're done. |
655 if (delta < event.distance) | 639 if (delta < event.distance) |
656 break; | 640 break; |
657 } | 641 } |
658 | 642 |
659 return gfx::Rect(origin_x, origin_y, width, height); | 643 return gfx::Rect(origin_x, origin_y, width, height); |
660 } | 644 } |
661 | 645 |
662 } // namespace cc | 646 } // namespace cc |
OLD | NEW |