Chromium Code Reviews

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

Issue 93663004: [#2] Pass gfx structs by const ref (gfx::Rect, gfx::RectF) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT, fix builds on non-linux platforms! Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_set.h » ('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 10
(...skipping 84 matching lines...)
95 } 95 }
96 } 96 }
97 97
98 // Create a new tile because our twin didn't have a valid one. 98 // Create a new tile because our twin didn't have a valid one.
99 scoped_refptr<Tile> tile = client_->CreateTile(this, tile_rect); 99 scoped_refptr<Tile> tile = client_->CreateTile(this, tile_rect);
100 if (tile.get()) 100 if (tile.get())
101 tiles_[key] = tile; 101 tiles_[key] = tile;
102 } 102 }
103 103
104 Region PictureLayerTiling::OpaqueRegionInContentRect( 104 Region PictureLayerTiling::OpaqueRegionInContentRect(
105 gfx::Rect content_rect) const { 105 const gfx::Rect& content_rect) const {
106 Region opaque_region; 106 Region opaque_region;
107 // TODO(enne): implement me 107 // TODO(enne): implement me
108 return opaque_region; 108 return opaque_region;
109 } 109 }
110 110
111 void PictureLayerTiling::SetCanUseLCDText(bool can_use_lcd_text) { 111 void PictureLayerTiling::SetCanUseLCDText(bool can_use_lcd_text) {
112 for (TileMap::iterator it = tiles_.begin(); it != tiles_.end(); ++it) 112 for (TileMap::iterator it = tiles_.begin(); it != tiles_.end(); ++it)
113 it->second->set_can_use_lcd_text(can_use_lcd_text); 113 it->second->set_can_use_lcd_text(can_use_lcd_text);
114 } 114 }
115 115
(...skipping 72 matching lines...)
188 tile_j_(0), 188 tile_j_(0),
189 left_(0), 189 left_(0),
190 top_(0), 190 top_(0),
191 right_(-1), 191 right_(-1),
192 bottom_(-1) { 192 bottom_(-1) {
193 } 193 }
194 194
195 PictureLayerTiling::CoverageIterator::CoverageIterator( 195 PictureLayerTiling::CoverageIterator::CoverageIterator(
196 const PictureLayerTiling* tiling, 196 const PictureLayerTiling* tiling,
197 float dest_scale, 197 float dest_scale,
198 gfx::Rect dest_rect) 198 const gfx::Rect& dest_rect)
199 : tiling_(tiling), 199 : tiling_(tiling),
200 dest_rect_(dest_rect), 200 dest_rect_(dest_rect),
201 dest_to_content_scale_(0), 201 dest_to_content_scale_(0),
202 current_tile_(NULL), 202 current_tile_(NULL),
203 tile_i_(0), 203 tile_i_(0),
204 tile_j_(0), 204 tile_j_(0),
205 left_(0), 205 left_(0),
206 top_(0), 206 top_(0),
207 right_(-1), 207 right_(-1),
208 bottom_(-1) { 208 bottom_(-1) {
(...skipping 126 matching lines...)
335 } 335 }
336 336
337 void PictureLayerTiling::Reset() { 337 void PictureLayerTiling::Reset() {
338 live_tiles_rect_ = gfx::Rect(); 338 live_tiles_rect_ = gfx::Rect();
339 tiles_.clear(); 339 tiles_.clear();
340 } 340 }
341 341
342 void PictureLayerTiling::UpdateTilePriorities( 342 void PictureLayerTiling::UpdateTilePriorities(
343 WhichTree tree, 343 WhichTree tree,
344 gfx::Size device_viewport, 344 gfx::Size device_viewport,
345 gfx::Rect viewport_in_layer_space, 345 const gfx::Rect& viewport_in_layer_space,
346 gfx::Rect visible_layer_rect, 346 const gfx::Rect& visible_layer_rect,
347 gfx::Size last_layer_bounds, 347 gfx::Size last_layer_bounds,
348 gfx::Size current_layer_bounds, 348 gfx::Size current_layer_bounds,
349 float last_layer_contents_scale, 349 float last_layer_contents_scale,
350 float current_layer_contents_scale, 350 float current_layer_contents_scale,
351 const gfx::Transform& last_screen_transform, 351 const gfx::Transform& last_screen_transform,
352 const gfx::Transform& current_screen_transform, 352 const gfx::Transform& current_screen_transform,
353 double current_frame_time_in_seconds, 353 double current_frame_time_in_seconds,
354 size_t max_tiles_for_interest_area) { 354 size_t max_tiles_for_interest_area) {
355 if (!NeedsUpdateForFrameAtTime(current_frame_time_in_seconds)) { 355 if (!NeedsUpdateForFrameAtTime(current_frame_time_in_seconds)) {
356 // This should never be zero for the purposes of has_ever_been_updated(). 356 // This should never be zero for the purposes of has_ever_been_updated().
(...skipping 195 matching lines...)
552 time_to_visible_in_seconds, 552 time_to_visible_in_seconds,
553 distance_to_visible_in_pixels); 553 distance_to_visible_in_pixels);
554 tile->SetPriority(tree, priority); 554 tile->SetPriority(tree, priority);
555 } 555 }
556 } 556 }
557 557
558 last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds; 558 last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds;
559 } 559 }
560 560
561 void PictureLayerTiling::SetLiveTilesRect( 561 void PictureLayerTiling::SetLiveTilesRect(
562 gfx::Rect new_live_tiles_rect) { 562 const gfx::Rect& new_live_tiles_rect) {
563 DCHECK(new_live_tiles_rect.IsEmpty() || 563 DCHECK(new_live_tiles_rect.IsEmpty() ||
564 ContentRect().Contains(new_live_tiles_rect)); 564 ContentRect().Contains(new_live_tiles_rect));
565 if (live_tiles_rect_ == new_live_tiles_rect) 565 if (live_tiles_rect_ == new_live_tiles_rect)
566 return; 566 return;
567 567
568 // Iterate to delete all tiles outside of our new live_tiles rect. 568 // Iterate to delete all tiles outside of our new live_tiles rect.
569 for (TilingData::DifferenceIterator iter(&tiling_data_, 569 for (TilingData::DifferenceIterator iter(&tiling_data_,
570 live_tiles_rect_, 570 live_tiles_rect_,
571 new_live_tiles_rect); 571 new_live_tiles_rect);
572 iter; 572 iter;
(...skipping 96 matching lines...)
669 669
670 // Compute the delta for our edges using the quadratic equation. 670 // Compute the delta for our edges using the quadratic equation.
671 return a == 0 ? -c / b : 671 return a == 0 ? -c / b :
672 (-b + static_cast<int>( 672 (-b + static_cast<int>(
673 std::sqrt(static_cast<int64>(b) * b - 4.0 * a * c))) / (2 * a); 673 std::sqrt(static_cast<int64>(b) * b - 4.0 * a * c))) / (2 * a);
674 } 674 }
675 675
676 } // namespace 676 } // namespace
677 677
678 gfx::Rect PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( 678 gfx::Rect PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
679 gfx::Rect starting_rect, 679 const gfx::Rect& starting_rect,
680 int64 target_area, 680 int64 target_area,
681 gfx::Rect bounding_rect, 681 const gfx::Rect& bounding_rect,
682 RectExpansionCache* cache) { 682 RectExpansionCache* cache) {
683 if (starting_rect.IsEmpty()) 683 if (starting_rect.IsEmpty())
684 return starting_rect; 684 return starting_rect;
685 685
686 if (cache && 686 if (cache &&
687 cache->previous_start == starting_rect && 687 cache->previous_start == starting_rect &&
688 cache->previous_bounds == bounding_rect && 688 cache->previous_bounds == bounding_rect &&
689 cache->previous_target == target_area) 689 cache->previous_target == target_area)
690 return cache->previous_result; 690 return cache->previous_result;
691 691
(...skipping 94 matching lines...)
786 break; 786 break;
787 } 787 }
788 788
789 gfx::Rect result(origin_x, origin_y, width, height); 789 gfx::Rect result(origin_x, origin_y, width, height);
790 if (cache) 790 if (cache)
791 cache->previous_result = result; 791 cache->previous_result = result;
792 return result; 792 return result;
793 } 793 }
794 794
795 } // namespace cc 795 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_set.h » ('j') | no next file with comments »

Powered by Google App Engine