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

Side by Side Diff: cc/tiles/tile_manager.cc

Issue 1318733006: cc: Do the math for a tile's content rect in layer space once. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« cc/tiles/tile.cc ('K') | « cc/tiles/tile_manager.h ('k') | no next file » | 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/tiles/tile_manager.h" 5 #include "cc/tiles/tile_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 10
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 resource->size().ToString()); 680 resource->size().ToString());
681 } else { 681 } else {
682 resource = resource_pool_->AcquireResource( 682 resource = resource_pool_->AcquireResource(
683 tile->desired_texture_size(), tile_task_runner_->GetResourceFormat()); 683 tile->desired_texture_size(), tile_task_runner_->GetResourceFormat());
684 } 684 }
685 685
686 // Create and queue all image decode tasks that this tile depends on. 686 // Create and queue all image decode tasks that this tile depends on.
687 ImageDecodeTask::Vector decode_tasks; 687 ImageDecodeTask::Vector decode_tasks;
688 std::vector<skia::PositionPixelRef> pixel_refs; 688 std::vector<skia::PositionPixelRef> pixel_refs;
689 prioritized_tile.raster_source()->GatherPixelRefs( 689 prioritized_tile.raster_source()->GatherPixelRefs(
690 tile->content_rect(), tile->contents_scale(), &pixel_refs); 690 tile->enclosing_layer_rect(), &pixel_refs);
691 for (const skia::PositionPixelRef& pixel_ref : pixel_refs) { 691 for (const skia::PositionPixelRef& pixel_ref : pixel_refs) {
692 decode_tasks.push_back(image_decode_controller_.GetTaskForPixelRef( 692 decode_tasks.push_back(image_decode_controller_.GetTaskForPixelRef(
693 pixel_ref, tile->layer_id(), prepare_tiles_count_)); 693 pixel_ref, tile->layer_id(), prepare_tiles_count_));
694 } 694 }
695 695
696 return make_scoped_refptr(new RasterTaskImpl( 696 return make_scoped_refptr(new RasterTaskImpl(
697 resource, prioritized_tile.raster_source(), tile->content_rect(), 697 resource, prioritized_tile.raster_source(), tile->content_rect(),
698 tile->invalidated_content_rect(), tile->contents_scale(), 698 tile->invalidated_content_rect(), tile->contents_scale(),
699 prioritized_tile.priority().resolution, tile->layer_id(), 699 prioritized_tile.priority().resolution, tile->layer_id(),
700 prepare_tiles_count_, static_cast<const void*>(tile), tile->id(), 700 prepare_tiles_count_, static_cast<const void*>(tile), tile->id(),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 draw_info.resource_ = resource; 747 draw_info.resource_ = resource;
748 draw_info.contents_swizzled_ = 748 draw_info.contents_swizzled_ =
749 tile_task_runner_->GetResourceRequiresSwizzle(); 749 tile_task_runner_->GetResourceRequiresSwizzle();
750 } 750 }
751 DCHECK(draw_info.IsReadyToDraw()); 751 DCHECK(draw_info.IsReadyToDraw());
752 draw_info.set_was_ever_ready_to_draw(); 752 draw_info.set_was_ever_ready_to_draw();
753 753
754 client_->NotifyTileStateChanged(tile); 754 client_->NotifyTileStateChanged(tile);
755 } 755 }
756 756
757 ScopedTilePtr TileManager::CreateTile(const gfx::Size& desired_texture_size, 757 ScopedTilePtr TileManager::CreateTile(const Tile::CreateInfo& info,
758 const gfx::Rect& content_rect,
759 float contents_scale,
760 int layer_id, 758 int layer_id,
761 int source_frame_number, 759 int source_frame_number,
762 int flags) { 760 int flags) {
763 // We need to have a tile task worker pool to do anything meaningful with 761 // We need to have a tile task worker pool to do anything meaningful with
764 // tiles. 762 // tiles.
765 DCHECK(tile_task_runner_); 763 DCHECK(tile_task_runner_);
766 ScopedTilePtr tile(new Tile(this, desired_texture_size, content_rect, 764 ScopedTilePtr tile(
767 contents_scale, layer_id, source_frame_number, 765 new Tile(this, info, layer_id, source_frame_number, flags));
768 flags));
769 DCHECK(tiles_.find(tile->id()) == tiles_.end()); 766 DCHECK(tiles_.find(tile->id()) == tiles_.end());
770 767
771 tiles_[tile->id()] = tile.get(); 768 tiles_[tile->id()] = tile.get();
772 image_decode_controller_.AddLayerUsedCount(tile->layer_id()); 769 image_decode_controller_.AddLayerUsedCount(tile->layer_id());
773 return tile; 770 return tile;
774 } 771 }
775 772
776 void TileManager::SetTileTaskRunnerForTesting( 773 void TileManager::SetTileTaskRunnerForTesting(
777 TileTaskRunner* tile_task_runner) { 774 TileTaskRunner* tile_task_runner) {
778 tile_task_runner_ = tile_task_runner; 775 tile_task_runner_ = tile_task_runner;
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 void TileManager::Signals::reset() { 997 void TileManager::Signals::reset() {
1001 ready_to_activate = false; 998 ready_to_activate = false;
1002 did_notify_ready_to_activate = false; 999 did_notify_ready_to_activate = false;
1003 ready_to_draw = false; 1000 ready_to_draw = false;
1004 did_notify_ready_to_draw = false; 1001 did_notify_ready_to_draw = false;
1005 all_tile_tasks_completed = false; 1002 all_tile_tasks_completed = false;
1006 did_notify_all_tile_tasks_completed = false; 1003 did_notify_all_tile_tasks_completed = false;
1007 } 1004 }
1008 1005
1009 } // namespace cc 1006 } // namespace cc
OLDNEW
« cc/tiles/tile.cc ('K') | « cc/tiles/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698