| 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/tiles/picture_layer_tiling.h" | 5 #include "cc/tiles/picture_layer_tiling.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 const float kSoonBorderDistanceViewportPercentage = 0.15f; | 31 const float kSoonBorderDistanceViewportPercentage = 0.15f; |
| 32 const float kMaxSoonBorderDistanceInScreenPixels = 312.f; | 32 const float kMaxSoonBorderDistanceInScreenPixels = 312.f; |
| 33 | 33 |
| 34 } // namespace | 34 } // namespace |
| 35 | 35 |
| 36 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create( | 36 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create( |
| 37 WhichTree tree, | 37 WhichTree tree, |
| 38 float contents_scale, | 38 float contents_scale, |
| 39 scoped_refptr<RasterSource> raster_source, | 39 scoped_refptr<RasterSource> raster_source, |
| 40 PictureLayerTilingClient* client, | 40 PictureLayerTilingClient* client, |
| 41 float tiling_interest_area_viewport_multiplier, | 41 size_t max_tiles_for_interest_area, |
| 42 float skewport_target_time_in_seconds, | 42 float skewport_target_time_in_seconds, |
| 43 int skewport_extrapolation_limit_in_content_pixels) { | 43 int skewport_extrapolation_limit_in_content_pixels) { |
| 44 return make_scoped_ptr(new PictureLayerTiling( | 44 return make_scoped_ptr(new PictureLayerTiling( |
| 45 tree, contents_scale, raster_source, client, | 45 tree, contents_scale, raster_source, client, max_tiles_for_interest_area, |
| 46 tiling_interest_area_viewport_multiplier, skewport_target_time_in_seconds, | 46 skewport_target_time_in_seconds, |
| 47 skewport_extrapolation_limit_in_content_pixels)); | 47 skewport_extrapolation_limit_in_content_pixels)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 PictureLayerTiling::PictureLayerTiling( | 50 PictureLayerTiling::PictureLayerTiling( |
| 51 WhichTree tree, | 51 WhichTree tree, |
| 52 float contents_scale, | 52 float contents_scale, |
| 53 scoped_refptr<RasterSource> raster_source, | 53 scoped_refptr<RasterSource> raster_source, |
| 54 PictureLayerTilingClient* client, | 54 PictureLayerTilingClient* client, |
| 55 float tiling_interest_area_viewport_multiplier, | 55 size_t max_tiles_for_interest_area, |
| 56 float skewport_target_time_in_seconds, | 56 float skewport_target_time_in_seconds, |
| 57 int skewport_extrapolation_limit_in_content_pixels) | 57 int skewport_extrapolation_limit_in_content_pixels) |
| 58 : tiling_interest_area_viewport_multiplier_( | 58 : max_tiles_for_interest_area_(max_tiles_for_interest_area), |
| 59 tiling_interest_area_viewport_multiplier), | |
| 60 skewport_target_time_in_seconds_(skewport_target_time_in_seconds), | 59 skewport_target_time_in_seconds_(skewport_target_time_in_seconds), |
| 61 skewport_extrapolation_limit_in_content_pixels_( | 60 skewport_extrapolation_limit_in_content_pixels_( |
| 62 skewport_extrapolation_limit_in_content_pixels), | 61 skewport_extrapolation_limit_in_content_pixels), |
| 63 contents_scale_(contents_scale), | 62 contents_scale_(contents_scale), |
| 64 client_(client), | 63 client_(client), |
| 65 tree_(tree), | 64 tree_(tree), |
| 66 raster_source_(raster_source), | 65 raster_source_(raster_source), |
| 67 resolution_(NON_IDEAL_RESOLUTION), | 66 resolution_(NON_IDEAL_RESOLUTION), |
| 68 tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels), | 67 tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels), |
| 69 can_require_tiles_for_activation_(false), | 68 can_require_tiles_for_activation_(false), |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 last_viewport_in_layer_space_ = viewport_in_layer_space; | 618 last_viewport_in_layer_space_ = viewport_in_layer_space; |
| 620 return false; | 619 return false; |
| 621 } | 620 } |
| 622 | 621 |
| 623 // Calculate the skewport. | 622 // Calculate the skewport. |
| 624 gfx::Rect skewport = ComputeSkewport(current_frame_time_in_seconds, | 623 gfx::Rect skewport = ComputeSkewport(current_frame_time_in_seconds, |
| 625 visible_rect_in_content_space); | 624 visible_rect_in_content_space); |
| 626 DCHECK(skewport.Contains(visible_rect_in_content_space)); | 625 DCHECK(skewport.Contains(visible_rect_in_content_space)); |
| 627 | 626 |
| 628 // Calculate the eventually/live tiles rect. | 627 // Calculate the eventually/live tiles rect. |
| 629 int64 eventually_rect_area = tiling_interest_area_viewport_multiplier_ * | 628 gfx::Size tile_size = tiling_data_.max_texture_size(); |
| 630 visible_rect_in_content_space.width() * | 629 int64 eventually_rect_area = |
| 631 visible_rect_in_content_space.height(); | 630 max_tiles_for_interest_area_ * tile_size.width() * tile_size.height(); |
| 632 | 631 |
| 633 gfx::Rect eventually_rect = | 632 gfx::Rect eventually_rect = |
| 634 ExpandRectEquallyToAreaBoundedBy(visible_rect_in_content_space, | 633 ExpandRectEquallyToAreaBoundedBy(visible_rect_in_content_space, |
| 635 eventually_rect_area, | 634 eventually_rect_area, |
| 636 gfx::Rect(tiling_size()), | 635 gfx::Rect(tiling_size()), |
| 637 &expansion_cache_); | 636 &expansion_cache_); |
| 638 | 637 |
| 639 DCHECK(eventually_rect.IsEmpty() || | 638 DCHECK(eventually_rect.IsEmpty() || |
| 640 gfx::Rect(tiling_size()).Contains(eventually_rect)) | 639 gfx::Rect(tiling_size()).Contains(eventually_rect)) |
| 641 << "tiling_size: " << tiling_size().ToString() | 640 << "tiling_size: " << tiling_size().ToString() |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 break; | 1111 break; |
| 1113 } | 1112 } |
| 1114 | 1113 |
| 1115 gfx::Rect result(origin_x, origin_y, width, height); | 1114 gfx::Rect result(origin_x, origin_y, width, height); |
| 1116 if (cache) | 1115 if (cache) |
| 1117 cache->previous_result = result; | 1116 cache->previous_result = result; |
| 1118 return result; | 1117 return result; |
| 1119 } | 1118 } |
| 1120 | 1119 |
| 1121 } // namespace cc | 1120 } // namespace cc |
| OLD | NEW |