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

Side by Side Diff: cc/picture_layer_tiling.cc

Issue 12353003: cc: Refactored Tile::GetResourceId (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile fix Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/picture_layer_impl.cc ('k') | cc/picture_layer_tiling_set.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/picture_layer_tiling.h" 5 #include "cc/picture_layer_tiling.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "cc/math_util.h" 10 #include "cc/math_util.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 prioritized_rect); 380 prioritized_rect);
381 iter; 381 iter;
382 ++iter) { 382 ++iter) {
383 TileMap::iterator find = tiles_.find(iter.index()); 383 TileMap::iterator find = tiles_.find(iter.index());
384 if (find == tiles_.end()) 384 if (find == tiles_.end())
385 continue; 385 continue;
386 386
387 TilePriority priority; 387 TilePriority priority;
388 DCHECK(!priority.is_live); 388 DCHECK(!priority.is_live);
389 Tile* tile = find->second.get(); 389 Tile* tile = find->second.get();
390 tile->set_priority(tree, priority); 390 tile->SetPriority(tree, priority);
391 } 391 }
392 last_prioritized_rect_ = prioritized_rect; 392 last_prioritized_rect_ = prioritized_rect;
393 393
394 gfx::Rect view_rect(device_viewport); 394 gfx::Rect view_rect(device_viewport);
395 float current_scale = current_layer_contents_scale / contents_scale_; 395 float current_scale = current_layer_contents_scale / contents_scale_;
396 float last_scale = last_layer_contents_scale / contents_scale_; 396 float last_scale = last_layer_contents_scale / contents_scale_;
397 397
398 // Fast path tile priority calculation when both transforms are translations. 398 // Fast path tile priority calculation when both transforms are translations.
399 if (last_screen_transform.IsIdentityOrTranslation() && 399 if (last_screen_transform.IsIdentityOrTranslation() &&
400 current_screen_transform.IsIdentityOrTranslation()) 400 current_screen_transform.IsIdentityOrTranslation())
(...skipping 28 matching lines...) Expand all
429 429
430 float time_to_visible_in_seconds = 430 float time_to_visible_in_seconds =
431 TilePriority::TimeForBoundsToIntersect( 431 TilePriority::TimeForBoundsToIntersect(
432 last_screen_rect, current_screen_rect, time_delta, view_rect); 432 last_screen_rect, current_screen_rect, time_delta, view_rect);
433 TilePriority priority( 433 TilePriority priority(
434 resolution_, 434 resolution_,
435 time_to_visible_in_seconds, 435 time_to_visible_in_seconds,
436 distance_to_visible_in_pixels); 436 distance_to_visible_in_pixels);
437 if (store_screen_space_quads_on_tiles) 437 if (store_screen_space_quads_on_tiles)
438 priority.set_current_screen_quad(gfx::QuadF(current_screen_rect)); 438 priority.set_current_screen_quad(gfx::QuadF(current_screen_rect));
439 tile->set_priority(tree, priority); 439 tile->SetPriority(tree, priority);
440 } 440 }
441 } else { 441 } else {
442 for (TilingData::Iterator iter(&tiling_data_, prioritized_rect); 442 for (TilingData::Iterator iter(&tiling_data_, prioritized_rect);
443 iter; ++iter) { 443 iter; ++iter) {
444 TileMap::iterator find = tiles_.find(iter.index()); 444 TileMap::iterator find = tiles_.find(iter.index());
445 if (find == tiles_.end()) 445 if (find == tiles_.end())
446 continue; 446 continue;
447 Tile* tile = find->second.get(); 447 Tile* tile = find->second.get();
448 448
449 gfx::Rect tile_bounds = 449 gfx::Rect tile_bounds =
(...skipping 22 matching lines...) Expand all
472 resolution_, 472 resolution_,
473 time_to_visible_in_seconds, 473 time_to_visible_in_seconds,
474 distance_to_visible_in_pixels); 474 distance_to_visible_in_pixels);
475 if (store_screen_space_quads_on_tiles) { 475 if (store_screen_space_quads_on_tiles) {
476 bool clipped; 476 bool clipped;
477 priority.set_current_screen_quad( 477 priority.set_current_screen_quad(
478 MathUtil::mapQuad(current_screen_transform, 478 MathUtil::mapQuad(current_screen_transform,
479 gfx::QuadF(current_layer_content_rect), 479 gfx::QuadF(current_layer_content_rect),
480 clipped)); 480 clipped));
481 } 481 }
482 tile->set_priority(tree, priority); 482 tile->SetPriority(tree, priority);
483 } 483 }
484 } 484 }
485 485
486 last_source_frame_number_ = current_source_frame_number; 486 last_source_frame_number_ = current_source_frame_number;
487 last_impl_frame_time_ = current_frame_time; 487 last_impl_frame_time_ = current_frame_time;
488 } 488 }
489 489
490 void PictureLayerTiling::DidBecomeActive() { 490 void PictureLayerTiling::DidBecomeActive() {
491 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { 491 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
492 it->second->set_priority(ACTIVE_TREE, it->second->priority(PENDING_TREE)); 492 it->second->SetPriority(ACTIVE_TREE, it->second->priority(PENDING_TREE));
493 it->second->set_priority(PENDING_TREE, TilePriority()); 493 it->second->SetPriority(PENDING_TREE, TilePriority());
494 494
495 // Tile holds a ref onto a picture pile. If the tile never gets invalidated 495 // Tile holds a ref onto a picture pile. If the tile never gets invalidated
496 // and recreated, then that picture pile ref could exist indefinitely. To 496 // and recreated, then that picture pile ref could exist indefinitely. To
497 // prevent this, ask the client to update the pile to its own ref. This 497 // prevent this, ask the client to update the pile to its own ref. This
498 // will cause PicturePileImpls and their clones to get deleted once the 498 // will cause PicturePileImpls and their clones to get deleted once the
499 // corresponding PictureLayerImpl and any in flight raster jobs go out of 499 // corresponding PictureLayerImpl and any in flight raster jobs go out of
500 // scope. 500 // scope.
501 client_->UpdatePile(it->second); 501 client_->UpdatePile(it->second);
502 } 502 }
503 } 503 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 (bottom_complete ? 1 : 0); 714 (bottom_complete ? 1 : 0);
715 if (num_edges_complete == 4) 715 if (num_edges_complete == 4)
716 return working_rect; 716 return working_rect;
717 } 717 }
718 718
719 NOTREACHED(); 719 NOTREACHED();
720 return starting_rect; 720 return starting_rect;
721 } 721 }
722 722
723 } // namespace cc 723 } // namespace cc
OLDNEW
« no previous file with comments | « cc/picture_layer_impl.cc ('k') | cc/picture_layer_tiling_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698