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

Side by Side Diff: cc/resources/picture_layer_tiling.cc

Issue 1126793002: cc: Make tiling interest rect calc based on viewport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
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/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 #include <limits> 9 #include <limits>
10 #include <set> 10 #include <set>
(...skipping 14 matching lines...) Expand all
25 25
26 const float kSoonBorderDistanceViewportPercentage = 0.15f; 26 const float kSoonBorderDistanceViewportPercentage = 0.15f;
27 const float kMaxSoonBorderDistanceInScreenPixels = 312.f; 27 const float kMaxSoonBorderDistanceInScreenPixels = 312.f;
28 28
29 } // namespace 29 } // namespace
30 30
31 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create( 31 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create(
32 float contents_scale, 32 float contents_scale,
33 scoped_refptr<RasterSource> raster_source, 33 scoped_refptr<RasterSource> raster_source,
34 PictureLayerTilingClient* client, 34 PictureLayerTilingClient* client,
35 size_t max_tiles_for_interest_area, 35 size_t max_interest_area,
36 float skewport_target_time_in_seconds, 36 float skewport_target_time_in_seconds,
37 int skewport_extrapolation_limit_in_content_pixels) { 37 int skewport_extrapolation_limit_in_content_pixels) {
38 return make_scoped_ptr(new PictureLayerTiling( 38 return make_scoped_ptr(
39 contents_scale, raster_source, client, max_tiles_for_interest_area, 39 new PictureLayerTiling(contents_scale, raster_source, client,
40 skewport_target_time_in_seconds, 40 max_interest_area, skewport_target_time_in_seconds,
41 skewport_extrapolation_limit_in_content_pixels)); 41 skewport_extrapolation_limit_in_content_pixels));
42 } 42 }
43 43
44 PictureLayerTiling::PictureLayerTiling( 44 PictureLayerTiling::PictureLayerTiling(
45 float contents_scale, 45 float contents_scale,
46 scoped_refptr<RasterSource> raster_source, 46 scoped_refptr<RasterSource> raster_source,
47 PictureLayerTilingClient* client, 47 PictureLayerTilingClient* client,
48 size_t max_tiles_for_interest_area, 48 size_t max_interest_area,
49 float skewport_target_time_in_seconds, 49 float skewport_target_time_in_seconds,
50 int skewport_extrapolation_limit_in_content_pixels) 50 int skewport_extrapolation_limit_in_content_pixels)
51 : max_tiles_for_interest_area_(max_tiles_for_interest_area), 51 : max_interest_area_(max_interest_area),
52 skewport_target_time_in_seconds_(skewport_target_time_in_seconds), 52 skewport_target_time_in_seconds_(skewport_target_time_in_seconds),
53 skewport_extrapolation_limit_in_content_pixels_( 53 skewport_extrapolation_limit_in_content_pixels_(
54 skewport_extrapolation_limit_in_content_pixels), 54 skewport_extrapolation_limit_in_content_pixels),
55 contents_scale_(contents_scale), 55 contents_scale_(contents_scale),
56 client_(client), 56 client_(client),
57 raster_source_(raster_source), 57 raster_source_(raster_source),
58 resolution_(NON_IDEAL_RESOLUTION), 58 resolution_(NON_IDEAL_RESOLUTION),
59 tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels), 59 tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels),
60 can_require_tiles_for_activation_(false), 60 can_require_tiles_for_activation_(false),
61 current_content_to_screen_scale_(0.f), 61 current_content_to_screen_scale_(0.f),
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 return false; 582 return false;
583 } 583 }
584 584
585 // Calculate the skewport. 585 // Calculate the skewport.
586 gfx::Rect skewport = ComputeSkewport(current_frame_time_in_seconds, 586 gfx::Rect skewport = ComputeSkewport(current_frame_time_in_seconds,
587 visible_rect_in_content_space); 587 visible_rect_in_content_space);
588 DCHECK(skewport.Contains(visible_rect_in_content_space)); 588 DCHECK(skewport.Contains(visible_rect_in_content_space));
589 589
590 // Calculate the eventually/live tiles rect. 590 // Calculate the eventually/live tiles rect.
591 gfx::Size tile_size = tiling_data_.max_texture_size(); 591 gfx::Size tile_size = tiling_data_.max_texture_size();
592 int64 eventually_rect_area = 592 int64 eventually_rect_area = max_interest_area_;
593 max_tiles_for_interest_area_ * tile_size.width() * tile_size.height();
594 593
595 gfx::Rect eventually_rect = 594 gfx::Rect eventually_rect =
596 ExpandRectEquallyToAreaBoundedBy(visible_rect_in_content_space, 595 ExpandRectEquallyToAreaBoundedBy(visible_rect_in_content_space,
597 eventually_rect_area, 596 eventually_rect_area,
598 gfx::Rect(tiling_size()), 597 gfx::Rect(tiling_size()),
599 &expansion_cache_); 598 &expansion_cache_);
600 599
601 DCHECK(eventually_rect.IsEmpty() || 600 DCHECK(eventually_rect.IsEmpty() ||
602 gfx::Rect(tiling_size()).Contains(eventually_rect)) 601 gfx::Rect(tiling_size()).Contains(eventually_rect))
603 << "tiling_size: " << tiling_size().ToString() 602 << "tiling_size: " << tiling_size().ToString()
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 break; 1030 break;
1032 } 1031 }
1033 1032
1034 gfx::Rect result(origin_x, origin_y, width, height); 1033 gfx::Rect result(origin_x, origin_y, width, height);
1035 if (cache) 1034 if (cache)
1036 cache->previous_result = result; 1035 cache->previous_result = result;
1037 return result; 1036 return result;
1038 } 1037 }
1039 1038
1040 } // namespace cc 1039 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698