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

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

Issue 775483002: cc: Remove max tiles and skewport constants from tiling client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 private: 53 private:
54 TreePriority tree_priority_; 54 TreePriority tree_priority_;
55 }; 55 };
56 56
57 } // namespace 57 } // namespace
58 58
59 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create( 59 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create(
60 float contents_scale, 60 float contents_scale,
61 const gfx::Size& layer_bounds, 61 const gfx::Size& layer_bounds,
62 PictureLayerTilingClient* client) { 62 PictureLayerTilingClient* client,
63 return make_scoped_ptr(new PictureLayerTiling(contents_scale, 63 size_t max_tiles_for_interest_area,
64 layer_bounds, 64 float skewport_target_time_in_seconds,
65 client)); 65 int skewport_extrapolation_limit_in_content_pixels) {
66 return make_scoped_ptr(new PictureLayerTiling(
67 contents_scale, layer_bounds, client, max_tiles_for_interest_area,
68 skewport_target_time_in_seconds,
69 skewport_extrapolation_limit_in_content_pixels));
66 } 70 }
67 71
68 PictureLayerTiling::PictureLayerTiling(float contents_scale, 72 PictureLayerTiling::PictureLayerTiling(
69 const gfx::Size& layer_bounds, 73 float contents_scale,
70 PictureLayerTilingClient* client) 74 const gfx::Size& layer_bounds,
71 : contents_scale_(contents_scale), 75 PictureLayerTilingClient* client,
76 size_t max_tiles_for_interest_area,
77 float skewport_target_time_in_seconds,
78 int skewport_extrapolation_limit_in_content_pixels)
79 : max_tiles_for_interest_area_(max_tiles_for_interest_area),
80 skewport_target_time_in_seconds_(skewport_target_time_in_seconds),
81 skewport_extrapolation_limit_in_content_pixels_(
82 skewport_extrapolation_limit_in_content_pixels),
83 contents_scale_(contents_scale),
72 layer_bounds_(layer_bounds), 84 layer_bounds_(layer_bounds),
73 resolution_(NON_IDEAL_RESOLUTION), 85 resolution_(NON_IDEAL_RESOLUTION),
74 client_(client), 86 client_(client),
75 tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels), 87 tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels),
76 last_impl_frame_time_in_seconds_(0.0), 88 last_impl_frame_time_in_seconds_(0.0),
77 content_to_screen_scale_(0.f), 89 content_to_screen_scale_(0.f),
78 can_require_tiles_for_activation_(false), 90 can_require_tiles_for_activation_(false),
79 has_visible_rect_tiles_(false), 91 has_visible_rect_tiles_(false),
80 has_skewport_rect_tiles_(false), 92 has_skewport_rect_tiles_(false),
81 has_soon_border_rect_tiles_(false), 93 has_soon_border_rect_tiles_(false),
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 const gfx::Rect& visible_rect_in_content_space) const { 505 const gfx::Rect& visible_rect_in_content_space) const {
494 gfx::Rect skewport = visible_rect_in_content_space; 506 gfx::Rect skewport = visible_rect_in_content_space;
495 if (last_impl_frame_time_in_seconds_ == 0.0) 507 if (last_impl_frame_time_in_seconds_ == 0.0)
496 return skewport; 508 return skewport;
497 509
498 double time_delta = 510 double time_delta =
499 current_frame_time_in_seconds - last_impl_frame_time_in_seconds_; 511 current_frame_time_in_seconds - last_impl_frame_time_in_seconds_;
500 if (time_delta == 0.0) 512 if (time_delta == 0.0)
501 return skewport; 513 return skewport;
502 514
503 float skewport_target_time_in_seconds =
504 client_->GetSkewportTargetTimeInSeconds();
505 double extrapolation_multiplier = 515 double extrapolation_multiplier =
506 skewport_target_time_in_seconds / time_delta; 516 skewport_target_time_in_seconds_ / time_delta;
507 517
508 int old_x = last_visible_rect_in_content_space_.x(); 518 int old_x = last_visible_rect_in_content_space_.x();
509 int old_y = last_visible_rect_in_content_space_.y(); 519 int old_y = last_visible_rect_in_content_space_.y();
510 int old_right = last_visible_rect_in_content_space_.right(); 520 int old_right = last_visible_rect_in_content_space_.right();
511 int old_bottom = last_visible_rect_in_content_space_.bottom(); 521 int old_bottom = last_visible_rect_in_content_space_.bottom();
512 522
513 int new_x = visible_rect_in_content_space.x(); 523 int new_x = visible_rect_in_content_space.x();
514 int new_y = visible_rect_in_content_space.y(); 524 int new_y = visible_rect_in_content_space.y();
515 int new_right = visible_rect_in_content_space.right(); 525 int new_right = visible_rect_in_content_space.right();
516 int new_bottom = visible_rect_in_content_space.bottom(); 526 int new_bottom = visible_rect_in_content_space.bottom();
517 527
518 int skewport_limit = client_->GetSkewportExtrapolationLimitInContentPixels(); 528 // Compute the maximum skewport based on
519 529 // |skewport_extrapolation_limit_in_content_pixels_|.
520 // Compute the maximum skewport based on |skewport_limit|.
521 gfx::Rect max_skewport = skewport; 530 gfx::Rect max_skewport = skewport;
522 max_skewport.Inset( 531 max_skewport.Inset(-skewport_extrapolation_limit_in_content_pixels_,
523 -skewport_limit, -skewport_limit, -skewport_limit, -skewport_limit); 532 -skewport_extrapolation_limit_in_content_pixels_);
524 533
525 // Inset the skewport by the needed adjustment. 534 // Inset the skewport by the needed adjustment.
526 skewport.Inset(extrapolation_multiplier * (new_x - old_x), 535 skewport.Inset(extrapolation_multiplier * (new_x - old_x),
527 extrapolation_multiplier * (new_y - old_y), 536 extrapolation_multiplier * (new_y - old_y),
528 extrapolation_multiplier * (old_right - new_right), 537 extrapolation_multiplier * (old_right - new_right),
529 extrapolation_multiplier * (old_bottom - new_bottom)); 538 extrapolation_multiplier * (old_bottom - new_bottom));
530 539
531 // Clip the skewport to |max_skewport|. 540 // Clip the skewport to |max_skewport|.
532 skewport.Intersect(max_skewport); 541 skewport.Intersect(max_skewport);
533 542
(...skipping 23 matching lines...) Expand all
557 last_visible_rect_in_content_space_ = visible_rect_in_content_space; 566 last_visible_rect_in_content_space_ = visible_rect_in_content_space;
558 return; 567 return;
559 } 568 }
560 569
561 // Calculate the skewport. 570 // Calculate the skewport.
562 gfx::Rect skewport = ComputeSkewport(current_frame_time_in_seconds, 571 gfx::Rect skewport = ComputeSkewport(current_frame_time_in_seconds,
563 visible_rect_in_content_space); 572 visible_rect_in_content_space);
564 DCHECK(skewport.Contains(visible_rect_in_content_space)); 573 DCHECK(skewport.Contains(visible_rect_in_content_space));
565 574
566 // Calculate the eventually/live tiles rect. 575 // Calculate the eventually/live tiles rect.
567 size_t max_tiles_for_interest_area = client_->GetMaxTilesForInterestArea();
568
569 gfx::Size tile_size = tiling_data_.max_texture_size(); 576 gfx::Size tile_size = tiling_data_.max_texture_size();
570 int64 eventually_rect_area = 577 int64 eventually_rect_area =
571 max_tiles_for_interest_area * tile_size.width() * tile_size.height(); 578 max_tiles_for_interest_area_ * tile_size.width() * tile_size.height();
572 579
573 gfx::Rect eventually_rect = 580 gfx::Rect eventually_rect =
574 ExpandRectEquallyToAreaBoundedBy(visible_rect_in_content_space, 581 ExpandRectEquallyToAreaBoundedBy(visible_rect_in_content_space,
575 eventually_rect_area, 582 eventually_rect_area,
576 gfx::Rect(tiling_size()), 583 gfx::Rect(tiling_size()),
577 &expansion_cache_); 584 &expansion_cache_);
578 585
579 DCHECK(eventually_rect.IsEmpty() || 586 DCHECK(eventually_rect.IsEmpty() ||
580 gfx::Rect(tiling_size()).Contains(eventually_rect)) 587 gfx::Rect(tiling_size()).Contains(eventually_rect))
581 << "tiling_size: " << tiling_size().ToString() 588 << "tiling_size: " << tiling_size().ToString()
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 } 1217 }
1211 current_tile_ = tiling_->TileAt(next_index.first, next_index.second); 1218 current_tile_ = tiling_->TileAt(next_index.first, next_index.second);
1212 } 1219 }
1213 1220
1214 if (current_tile_) 1221 if (current_tile_)
1215 tiling_->UpdateTileAndTwinPriority(current_tile_); 1222 tiling_->UpdateTileAndTwinPriority(current_tile_);
1216 return *this; 1223 return *this;
1217 } 1224 }
1218 1225
1219 } // namespace cc 1226 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698