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

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: remove switch entry from chromeos cmdline. 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
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 15 matching lines...) Expand all
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 WhichTree tree, 32 WhichTree tree,
33 float contents_scale, 33 float contents_scale,
34 scoped_refptr<RasterSource> raster_source, 34 scoped_refptr<RasterSource> raster_source,
35 PictureLayerTilingClient* client, 35 PictureLayerTilingClient* client,
36 size_t max_tiles_for_interest_area, 36 float tiling_interest_area_viewport_multiplier,
37 float skewport_target_time_in_seconds, 37 float skewport_target_time_in_seconds,
38 int skewport_extrapolation_limit_in_content_pixels) { 38 int skewport_extrapolation_limit_in_content_pixels) {
39 return make_scoped_ptr(new PictureLayerTiling( 39 return make_scoped_ptr(new PictureLayerTiling(
40 tree, contents_scale, raster_source, client, max_tiles_for_interest_area, 40 tree, contents_scale, raster_source, client,
41 skewport_target_time_in_seconds, 41 tiling_interest_area_viewport_multiplier, skewport_target_time_in_seconds,
42 skewport_extrapolation_limit_in_content_pixels)); 42 skewport_extrapolation_limit_in_content_pixels));
43 } 43 }
44 44
45 PictureLayerTiling::PictureLayerTiling( 45 PictureLayerTiling::PictureLayerTiling(
46 WhichTree tree, 46 WhichTree tree,
47 float contents_scale, 47 float contents_scale,
48 scoped_refptr<RasterSource> raster_source, 48 scoped_refptr<RasterSource> raster_source,
49 PictureLayerTilingClient* client, 49 PictureLayerTilingClient* client,
50 size_t max_tiles_for_interest_area, 50 float tiling_interest_area_viewport_multiplier,
51 float skewport_target_time_in_seconds, 51 float skewport_target_time_in_seconds,
52 int skewport_extrapolation_limit_in_content_pixels) 52 int skewport_extrapolation_limit_in_content_pixels)
53 : max_tiles_for_interest_area_(max_tiles_for_interest_area), 53 : tiling_interest_area_viewport_multiplier_(
54 tiling_interest_area_viewport_multiplier),
54 skewport_target_time_in_seconds_(skewport_target_time_in_seconds), 55 skewport_target_time_in_seconds_(skewport_target_time_in_seconds),
55 skewport_extrapolation_limit_in_content_pixels_( 56 skewport_extrapolation_limit_in_content_pixels_(
56 skewport_extrapolation_limit_in_content_pixels), 57 skewport_extrapolation_limit_in_content_pixels),
57 contents_scale_(contents_scale), 58 contents_scale_(contents_scale),
58 client_(client), 59 client_(client),
59 tree_(tree), 60 tree_(tree),
60 raster_source_(raster_source), 61 raster_source_(raster_source),
61 resolution_(NON_IDEAL_RESOLUTION), 62 resolution_(NON_IDEAL_RESOLUTION),
62 tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels), 63 tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels),
63 can_require_tiles_for_activation_(false), 64 can_require_tiles_for_activation_(false),
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 const gfx::Rect& viewport_in_layer_space, 569 const gfx::Rect& viewport_in_layer_space,
569 float ideal_contents_scale, 570 float ideal_contents_scale,
570 double current_frame_time_in_seconds, 571 double current_frame_time_in_seconds,
571 const Occlusion& occlusion_in_layer_space) { 572 const Occlusion& occlusion_in_layer_space) {
572 if (!NeedsUpdateForFrameAtTimeAndViewport(current_frame_time_in_seconds, 573 if (!NeedsUpdateForFrameAtTimeAndViewport(current_frame_time_in_seconds,
573 viewport_in_layer_space)) { 574 viewport_in_layer_space)) {
574 // This should never be zero for the purposes of has_ever_been_updated(). 575 // This should never be zero for the purposes of has_ever_been_updated().
575 DCHECK_NE(current_frame_time_in_seconds, 0.0); 576 DCHECK_NE(current_frame_time_in_seconds, 0.0);
576 return false; 577 return false;
577 } 578 }
578
579 gfx::Rect visible_rect_in_content_space = 579 gfx::Rect visible_rect_in_content_space =
580 gfx::ScaleToEnclosingRect(viewport_in_layer_space, contents_scale_); 580 gfx::ScaleToEnclosingRect(viewport_in_layer_space, contents_scale_);
581 581
582 if (tiling_size().IsEmpty()) { 582 if (tiling_size().IsEmpty()) {
583 UpdateVisibleRectHistory(current_frame_time_in_seconds, 583 UpdateVisibleRectHistory(current_frame_time_in_seconds,
584 visible_rect_in_content_space); 584 visible_rect_in_content_space);
585 last_viewport_in_layer_space_ = viewport_in_layer_space; 585 last_viewport_in_layer_space_ = viewport_in_layer_space;
586 return false; 586 return false;
587 } 587 }
588 588
589 // Calculate the skewport. 589 // Calculate the skewport.
590 gfx::Rect skewport = ComputeSkewport(current_frame_time_in_seconds, 590 gfx::Rect skewport = ComputeSkewport(current_frame_time_in_seconds,
591 visible_rect_in_content_space); 591 visible_rect_in_content_space);
592 DCHECK(skewport.Contains(visible_rect_in_content_space)); 592 DCHECK(skewport.Contains(visible_rect_in_content_space));
593 593
594 // Calculate the eventually/live tiles rect. 594 // Calculate the eventually/live tiles rect.
595 gfx::Size tile_size = tiling_data_.max_texture_size(); 595 int64 eventually_rect_area = tiling_interest_area_viewport_multiplier_ *
596 int64 eventually_rect_area = 596 visible_rect_in_content_space.width() *
597 max_tiles_for_interest_area_ * tile_size.width() * tile_size.height(); 597 visible_rect_in_content_space.height();
598 598
599 gfx::Rect eventually_rect = 599 gfx::Rect eventually_rect =
600 ExpandRectEquallyToAreaBoundedBy(visible_rect_in_content_space, 600 ExpandRectEquallyToAreaBoundedBy(visible_rect_in_content_space,
601 eventually_rect_area, 601 eventually_rect_area,
602 gfx::Rect(tiling_size()), 602 gfx::Rect(tiling_size()),
603 &expansion_cache_); 603 &expansion_cache_);
604 604
605 DCHECK(eventually_rect.IsEmpty() || 605 DCHECK(eventually_rect.IsEmpty() ||
606 gfx::Rect(tiling_size()).Contains(eventually_rect)) 606 gfx::Rect(tiling_size()).Contains(eventually_rect))
607 << "tiling_size: " << tiling_size().ToString() 607 << "tiling_size: " << tiling_size().ToString()
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 break; 1035 break;
1036 } 1036 }
1037 1037
1038 gfx::Rect result(origin_x, origin_y, width, height); 1038 gfx::Rect result(origin_x, origin_y, width, height);
1039 if (cache) 1039 if (cache)
1040 cache->previous_result = result; 1040 cache->previous_result = result;
1041 return result; 1041 return result;
1042 } 1042 }
1043 1043
1044 } // namespace cc 1044 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698